Shuvit game release repo.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

controller2.py 173KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344
  1. #shuvit.org
  2. # control script
  3. def main():
  4. #scale = .3
  5. #action layers
  6. #0-14 rolling
  7. #fliplay = 500
  8. #grindlay = 700
  9. os = 'Windows'
  10. from sys import platform
  11. if platform != "win32":
  12. os = 'Linux'
  13. def onWindows():
  14. return os == 'Windows'
  15. from mathutils import Vector
  16. import bge
  17. import GameLogic
  18. import ctypes
  19. import math
  20. scene = bge.logic.getCurrentScene()
  21. try:
  22. GameLogic.DictObjects
  23. init=1
  24. except:
  25. init=0
  26. if init:
  27. cont.GameLogic.getCurrentController()
  28. own = cont.getOwner()
  29. name = own.getName()
  30. if not GameLogic.DictObjects.has_key(name):
  31. GameLogic.DictObjects[name]=cont
  32. own.init=0
  33. #reduction = 400000
  34. #axisTh = 0.03
  35. #initialize quadrant variables
  36. q1on = 0
  37. q2on = 0
  38. q3on = 0
  39. q4on = 0
  40. q5on = 0
  41. q6on = 0
  42. q7on = 0
  43. q8on = 0
  44. lq1on = 0
  45. lq2on = 0
  46. lq3on = 0
  47. lq4on = 0
  48. lq5on = 0
  49. lq6on = 0
  50. lq7on = 0
  51. lq8on = 0
  52. #number of frames / length of the location timers
  53. countdown = 20
  54. cont = GameLogic.getCurrentController()
  55. char = bge.constraints.getCharacter
  56. own = cont.owner
  57. dict = bge.logic.globalDict #Get the global dictionary
  58. #dict['trick_string'] = ''
  59. #last frame stuff
  60. lGRAB_ON = own["lGRAB_ON"]
  61. lastgrab = own["lastGrab"]
  62. lastpump = own["lastPump"]
  63. lf_ground = own["lF_ground"]
  64. lastopos = own["last_Opos"]
  65. lastnopos = own["last_nOpos"]
  66. LAST_STANCE = own["last_stance"]
  67. LAST_GROUND = own["last_ground"]
  68. lastStop = own["lastStop"]
  69. LAST_LEFT = own["LAST_LEFT"]
  70. last_trick_string = dict.get('last_trick_sting')
  71. lasta = own["lasta"]
  72. lastx = own["lastx"]
  73. lastaf = own["lastaf"]
  74. lastxf = own["lastxf"]
  75. lgf = own['last_grind_frame']
  76. frame = own['framenum']
  77. frames_since_grinding = frame - lgf
  78. ground_since = own["framenum"] - own['lF_air_frame']
  79. gsf = frame - own['grind_start_frame']
  80. own['last_footplant'] = own['footplant_on']
  81. lastaBut_ground = own['lastaBut_ground']
  82. lastxBut_ground = own['lastxBut_ground']
  83. aBut_ground = own['aBut_ground']
  84. xBut_ground = own['xBut_ground']
  85. own['last_manual_v2'] = own['manual_v2']
  86. lRequest = own['requestAction']
  87. lAs = own['actionState']
  88. #current frame stuff
  89. GRAB_ON = own["GRAB_ON"]
  90. pumpon = own["Pump"]
  91. vib_countdown = own["vib_Countdown"]
  92. grindold = own['grindOld']
  93. #grindHit = own["LAST_GRIND"]
  94. LAST_GRIND = own["LAST_GRIND"]
  95. #grindTouch = cont.sensors['grindCol']
  96. grindTouch = cont.sensors['grindCol_bottom']
  97. touched = grindTouch.triggered
  98. leftgrabon = own["Leftgrabon"]
  99. rightgrabon = own["Rightgrabon"]
  100. linvel = own.getLinearVelocity
  101. zvel = own.worldLinearVelocity.z
  102. own["Zvel"] = zvel
  103. r_ground = cont.sensors["r_Ground"]
  104. trigger = r_ground.triggered
  105. STANCE = own["stance"]
  106. motion = cont.actuators['MotionPump']
  107. linVelocity = own.getLinearVelocity(True)
  108. countdown = own['countdown']
  109. jump_timer = own['jump_timer']
  110. pos = own.localPosition
  111. rot = own.getAxisVect( [0.0, 0.0, 1.0])
  112. gray = cont.sensors["gRay"]
  113. #airconst = cont.actuators["airConst"]
  114. pop = cont.actuators["pop"]
  115. grindHit = own["grindHit"]
  116. grindCement = cont.actuators["grind_cement"]
  117. grindRail = cont.actuators["grind_rail"]
  118. grindSound = own["grindSound"]
  119. skater = scene.objects["Char4"]
  120. deck = scene.objects["deck"]
  121. trucks = scene.objects["trucks"]
  122. wheel1 = scene.objects["rollen.000"]
  123. wheel2 = scene.objects["rollen.001"]
  124. wheel3 = scene.objects["rollen.002"]
  125. wheel4 = scene.objects["rollen.003"]
  126. turnsens = .04
  127. turnsens2 = .06 #air_turn_boost
  128. grindDar = own["grindDar_hit"]
  129. grindEmpty = scene.objects["grindEmpty"]
  130. grindDar2 = grindEmpty.sensors["grindDar2"]
  131. #invertCol = cont.sensors["invertCol"]
  132. cam = scene.objects["Camera.003"]
  133. freecam = scene.objects["freecam"]
  134. followcam = scene.objects["followcam"]
  135. coping_on = own["coping"]
  136. invert_on = own['invert_on']
  137. grab_type = own['grab_type']
  138. c_ground = cont.sensors['c_ground']
  139. #
  140. control_bottom = scene.objects['control_bottom']
  141. invertTouch = control_bottom.sensors['grindCol_bottom']
  142. wallride = own["wallride"]
  143. wallride_col = cont.sensors['wallride']
  144. wallrideL = cont.sensors['wallrideL']
  145. wallrideR = cont.sensors['wallrideR']
  146. wallrideconstL = cont.actuators['wallrideconstL']
  147. wallrideconstR = cont.actuators['wallrideconstR']
  148. if r_ground.triggered: own['wallride_off'] = 0
  149. own['pop_sound'] = 0
  150. own['land_sound'] = 0
  151. own['revert_sound'] = 0
  152. #own['fall'] = 0
  153. #joystick location timers
  154. q1oncd = own["Q1oncd"]
  155. q2oncd = own["Q2oncd"]
  156. q3oncd = own["Q3oncd"]
  157. q4oncd = own["Q4oncd"]
  158. q5oncd = own["Q5oncd"]
  159. q6oncd = own["Q6oncd"]
  160. q7oncd = own["Q7oncd"]
  161. q8oncd = own["Q8oncd"]
  162. q1oncdl = own["Q1oncdl"]
  163. q2oncdl = own["Q2oncdl"]
  164. q3oncdl = own["Q3oncdl"]
  165. q4oncdl = own["Q4oncdl"]
  166. q5oncdl = own["Q5oncdl"]
  167. q6oncdl = own["Q6oncdl"]
  168. q7oncdl = own["Q7oncdl"]
  169. q8oncdl = own["Q8oncdl"]
  170. fliplay = 4
  171. #setable
  172. MAX_VEL = dict['MAX_VEL']
  173. SPEEDUP = .055
  174. SPEEDPUMP = .14 #.09
  175. SPEEDPUMPFAST = .16 #.13
  176. PUMP_SPEED_SENS = .4
  177. PUMP_SENS = .98
  178. ACCEL = 10
  179. CRUISE = 9
  180. COUNTDOWN = 20 #pump and speed stuff
  181. JUMPHEIGHT = dict['JUMPHEIGHT'] #775#750
  182. JUMPSTRENGTH = 0
  183. own['flip_manual_stance'] = 0
  184. LAND_LAYER = 100
  185. LAND_END = 20
  186. lLR = dict['lLR']
  187. lUD = dict['lUD']
  188. rLR = dict['rLR']
  189. rUD = dict['rUD']
  190. lTrig = dict['lTrig']
  191. rTrig = dict['rTrig']
  192. aBut = dict['aBut']
  193. bBut = dict['bBut']
  194. xBut = dict['xBut']
  195. yBut = dict['yBut']
  196. lBump = dict['lBump']
  197. rBump = dict['rBump']
  198. bkBut = dict['bkBut']
  199. stBut = dict['stBut']
  200. xbBut = dict['xbBut']
  201. ltsBut = dict['ltsBut']
  202. rtsBut = dict['rtsBut']
  203. ldPad = dict['ldPad']
  204. rdPad = dict['rdPad']
  205. udPad = dict['udPad']
  206. ddPad = dict['ddPad']
  207. #fliptricks after manuals
  208. if (frame - own['last_manual_frame']) < 25:
  209. flip_start_lay = 8
  210. flipspeed = .4
  211. own['flipspeed'] = .4
  212. own['flip_start_lay'] = 8
  213. #print("chopping flip start")
  214. else:
  215. flip_start_lay = 1
  216. own['flip_start_lay'] = 1
  217. flipspeed = .6
  218. own['flipspeed'] = .6
  219. def printplaying():
  220. splaying_layers = "S: "
  221. playing_layers = "D: "
  222. tplaying_layers = "T: "
  223. for x in range(9900):
  224. if skater.isPlayingAction(x):
  225. #if trucks.isPlayingAction(x):
  226. #if skater.isPlayingAction(x):
  227. splaying_layers += str(x)
  228. splaying_layers += " "
  229. if deck.isPlayingAction(x):
  230. #if trucks.isPlayingAction(x):
  231. #if skater.isPlayingAction(x):
  232. playing_layers += str(x)
  233. playing_layers += " "
  234. if trucks.isPlayingAction(x):
  235. #if trucks.isPlayingAction(x):
  236. #if skater.isPlayingAction(x):
  237. tplaying_layers += str(x)
  238. tplaying_layers += " "
  239. print(splaying_layers, playing_layers, tplaying_layers)
  240. if aBut == True and lasta == False and r_ground.triggered:
  241. aBut_ground = True
  242. own['aBut_ground'] = True
  243. #else:
  244. if aBut == False:
  245. aBut_ground = False
  246. own['aBut_ground'] = False
  247. if xBut == True and lastx == False and r_ground.triggered:
  248. xBut_ground = True
  249. own['xBut_ground'] = True
  250. #else:
  251. if xBut == False:
  252. xBut_ground = False
  253. own['xBut_ground'] = False
  254. def killact(layer):
  255. if skater.isPlayingAction(layer):
  256. skater.stopAction(layer)
  257. if deck.isPlayingAction(layer):
  258. deck.stopAction(layer)
  259. if trucks.isPlayingAction(layer):
  260. trucks.stopAction(layer)
  261. def killall():
  262. for x in range(9000):
  263. skater.stopAction(x)
  264. deck.stopAction(x)
  265. trucks.stopAction(x)
  266. def reset_rtimers_done():
  267. pass
  268. #print('rtimer reset:', q1oncd, q2oncd, q3oncd, q4oncd, q5oncd, q6oncd, q7oncd, q8oncd)
  269. def reset_rtimers():
  270. own["Q1oncd"] = 0
  271. own["Q2oncd"] = 0
  272. own["Q3oncd"] = 0
  273. own["Q4oncd"] = 0
  274. own["Q5oncd"] = 0
  275. own["Q6oncd"] = 0
  276. own["Q7oncd"] = 0
  277. own["Q8oncd"] = 0
  278. q1oncd = 0
  279. q2oncd = 0
  280. q3oncd = 0
  281. q4oncd = 0
  282. q5oncd = 0
  283. q6oncd = 0
  284. q7oncd = 0
  285. q8oncd = 0
  286. reset_rtimers_done()
  287. def check_fall():
  288. playing_frame = 20
  289. if skater.isPlayingAction(fliplay):
  290. playing_frame = skater.getActionFrame(fliplay)
  291. if r_ground.triggered == True and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
  292. own['fall'] = 1
  293. own['last_fall_frame'] = frame
  294. if STANCE == 0:
  295. own['requestAction'] = 'reg_air-walk_air'
  296. if STANCE == 1:
  297. own['requestAction'] = 'fak_air-walk_air'
  298. check_fall()
  299. def check_landing():
  300. lf_ground = own["lF_ground"]
  301. STANCE = own["stance"]
  302. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  303. if lf_ground == False and r_ground.triggered == True:
  304. own['no_grind'] = False
  305. own['jump_from_trans'] = 0
  306. nearestObject = None
  307. minDist = None
  308. detectedObjects = grindDar2.hitObjectList
  309. if grindDar == 0:
  310. lastheight = own["air_height"]
  311. pos = own.worldPosition.z
  312. dist = lastheight - pos
  313. dist = dist * 2
  314. if dist > 1:
  315. dist = 1
  316. own.actuators["land"].volume = dist
  317. sact = own.actuators["land"]
  318. sact.stopSound()
  319. cont.activate(own.actuators["land"])
  320. own['land_sound'] = 1
  321. if grindDar == 1:
  322. pass
  323. own["vib_Countdown"] = 14
  324. cont.activate(own.actuators["Vibration"])
  325. if own['manual_v2'] == 0 and grindDar == 0:
  326. if STANCE == 0:
  327. own['requestAction'] = 'reg_land'
  328. elif STANCE == 1:
  329. own['requestAction'] = 'fak_land'
  330. lf_ground = r_ground.triggered
  331. own["lF_ground"] = lf_ground
  332. vib_countdown = own["vib_Countdown"]
  333. if vib_countdown > 0:
  334. vib_countdown = vib_countdown - 1
  335. own["vib_Countdown"] = vib_countdown
  336. if vib_countdown == 1:
  337. stopAnims()
  338. stance()
  339. #air anim
  340. if r_ground.triggered == False:
  341. if STANCE == 0:
  342. own['requestAction'] = 'reg_air'
  343. if STANCE == 1:
  344. own['requestAction'] = 'fak_air'
  345. else:
  346. if STANCE == 0:
  347. own['requestAction'] = 'reg_roll'
  348. if STANCE == 1:
  349. own['requestAction'] = 'fak_roll'
  350. #check manual_v2
  351. if (rUD > dict['man_sens_l'] and rUD < dict['man_sens_r']) or (rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r']):
  352. #if (rUD > .04 and rUD < .07):
  353. #print("zoned")
  354. timer = own['manual_v2_timer']
  355. timer = timer + 1
  356. if timer > 20:
  357. own['manual_v2'] = 1
  358. own['manual_v2_timer'] = timer
  359. if rUD < .04 and rUD > -.04:
  360. own['manual_v2_timer'] = 0
  361. own['manual_v2'] = 0
  362. own['manual_v2_type'] = None
  363. if own['manual_v2'] == 1:
  364. if own['last_manual_v2'] == 0:
  365. if STANCE == 0:
  366. if rUD > .04 and rUD < .07:
  367. #print("reg manual")
  368. own['manual_v2_type'] = 'reg manual'
  369. if rUD < -.04 and rUD > -.07:
  370. own['manual_v2_type'] = 'reg nose manual'
  371. if STANCE == 1:
  372. if rUD > .04 and rUD < .07:
  373. own['manual_v2_type'] = 'fak manual'
  374. if lRequest == 'reg_air_tail to manual':
  375. #print('chaaaaange init')
  376. own['manual_v2_type'] = 'fak nose manual'
  377. if rUD < -.04 and rUD > -.07:
  378. own['manual_v2_type'] = 'fak nose manual'
  379. else:
  380. #print("flip stance")
  381. if own['jump_stance'] == 0:
  382. #print('flipstance 0')
  383. if own['manual_v2_type'] == 'fak manual':
  384. own['manual_v2_type'] = 'reg nose manual'
  385. if own['manual_v2_type'] == 'fak nose manual':
  386. own['manual_v2_type'] = 'reg manual'
  387. if lAs == 'fak_air_tail to manual' and own['manual_v2_type'] == 'reg manual':
  388. #print('---requesting reg nose manual')
  389. own['manual_v2_type'] = 'reg nose manual'
  390. if lAs == 'fak_air_nose to nmanual' and own['manual_v2_type'] == 'reg nose manual':
  391. #print('---requesting reg nose manual')
  392. own['manual_v2_type'] = 'reg manual'
  393. if own['jump_stance'] == 1:
  394. #print('flipstance 1')
  395. if own['manual_v2_type'] == 'reg manual':
  396. own['manual_v2_type'] = 'fak nose manual'
  397. if own['manual_v2_type'] == 'reg nose manual':
  398. #print("asdfasdfasdfsdfasdfasdf")
  399. own['manual_v2_type'] = 'fak manual'
  400. if lAs == 'reg_air_tail to manual' and own['manual_v2_type'] == 'fak manual':
  401. #print('---requesting fak nose manual')
  402. own['manual_v2_type'] = 'fak nose manual'
  403. if lAs == 'reg_air_nose to nmanual' and own['manual_v2_type'] == 'fak nose manual':
  404. #print('---requesting fak nose manual')
  405. own['manual_v2_type'] = 'fak manual'
  406. if STANCE == 0 and (own['manual_v2_type'] == 'fak manual' or own['actionState'] == 'fak-reg_nmanual'):
  407. own['manual_v2_type'] = 'reg nose manual'
  408. if STANCE == 1 and (own['manual_v2_type'] == 'reg manual' or own['actionState'] == 'reg-fak_nmanual'):
  409. own['manual_v2_type'] = 'fak nose manual'
  410. if STANCE == 0 and (own['manual_v2_type'] == 'fak nose manual' or own['actionState'] == 'fak-reg_manual'):
  411. own['manual_v2_type'] = 'reg manual'
  412. if STANCE == 1 and (own['manual_v2_type'] == 'reg nose manual' or own['actionState'] == 'reg-fak_manual'):
  413. own['manual_v2_type'] = 'fak manual'
  414. #check manual
  415. ####
  416. #reg
  417. if rUD > dict['man_sens_l'] and rUD < dict['man_sens_r'] and STANCE == 0 and rLR < .035 and rLR > -.035:
  418. timer = own["reg_manual_timer"]
  419. timer = timer + 1
  420. own["reg_manual_timer"] = timer
  421. if timer > 20 and rUD < .04:
  422. own["reg_manual"] = 0
  423. if rUD <= dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  424. own["reg_manual_timer"] = 0
  425. own["reg_manual"] = 0
  426. #####
  427. if own["reg_manual_timer"] > 10 and own["fak_manual"] == 0 and own['reg_nmanual'] == 0:
  428. own["reg_manual"] = 1
  429. ######
  430. if own["reg_manual_timer"] == 0:
  431. own["reg_manual"] = 0
  432. ####
  433. #fak
  434. if rUD > dict['man_sens_l'] and rUD < dict['man_sens_r'] and STANCE == 1 and rLR < .035 and rLR > -.035:
  435. timer = own["fak_manual_timer"]
  436. timer = timer + 1
  437. own["fak_manual_timer"] = timer
  438. if timer > 20:
  439. own["fak_manual"] = 0
  440. if rUD <= dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
  441. own["fak_manual_timer"] = 0
  442. own["fak_manual"] = 0
  443. if own["fak_manual_timer"] > 10 and own["reg_manual"] == 0:
  444. own["fak_manual"] = 1
  445. if own["fak_manual_timer"] == 0:
  446. own["fak_manual"] = 0
  447. #####
  448. #reg nmanual
  449. if rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r'] and STANCE == 0 and rLR < .035 and rLR > -.035:
  450. timer = own["reg_nmanual_timer"]
  451. timer = timer + 1
  452. own["reg_nmanual_timer"] = timer
  453. if timer > 20:
  454. own["reg_nmanual"] = 0
  455. if rUD >= -dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  456. own["reg_nmanual_timer"] = 0
  457. own["reg_nmanual"] = 0
  458. if own["reg_nmanual_timer"] > 10 and own["fak_nmanual"] == 0 and own['reg_manual'] == 0 and own['fak_manual'] == 0:
  459. if own['last_fak_manual'] == False and own['last_reg_manual'] == False and own['last_fak_manual'] == False:
  460. own["reg_nmanual"] = 1
  461. if own["reg_nmanual_timer"] == 0:
  462. own["reg_nmanual"] = 0
  463. #####
  464. #fak nmanual
  465. #print (rUD)
  466. if rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r'] and STANCE == 1 and rLR < .035 and rLR > -.035:
  467. timer = own["fak_nmanual_timer"]
  468. timer = timer + 1
  469. own["fak_nmanual_timer"] = timer
  470. if timer > 20:
  471. own["fak_nmanual"] = 0
  472. if rUD >= -dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD <= .04:
  473. own["fak_nmanual_timer"] = 0
  474. own["fak_nmanual"] = 0
  475. if own["fak_nmanual_timer"] > 10 and own["reg_nmanual"] == 0 and own['fak_manual'] == 0 and own ['reg_manual'] == 0:
  476. own["fak_nmanual"] = 1
  477. if own["fak_nmanual_timer"] == 0 and own['reg_manual'] == 0:
  478. own["fak_nmanual"] = 0
  479. if own['last_fak_nmanual'] == 1 and own['fak_nmanual'] == 0:
  480. pass
  481. def reg_stance_left_off():
  482. LAST_LEFT = own["LAST_LEFT"]
  483. own["LAST_LEFT"] = 0
  484. def reg_stance_right_off():
  485. LAST_RIGHT = own["LAST_RIGHT"]
  486. own["LAST_RIGHT"] = 0
  487. def reg_stance_on(inc):
  488. playing = deck.isPlayingAction(40)
  489. if own["revert_timer"] < 1 and own['manual_v2'] == 0 and playing == 0:
  490. own['requestAction'] = 'reg_roll'
  491. def reg_manual_on():
  492. own['requestAction'] = 'reg_manual'
  493. def fak_manual_on():
  494. own['requestAction'] = 'fak_manual'
  495. def reg_nmanual_on():
  496. own['requestAction'] = 'reg_nmanual'
  497. def fak_nmanual_on():
  498. own['requestAction'] = 'fak_nmanual'
  499. if own['l_actionState'] == 'reg_manual_revert_ccw':
  500. own['manual_v2_type'] = 'fak nose manual'
  501. fak_nmanual_on()
  502. if own['l_actionState'] == 'reg_manual_revert_cw':
  503. own['manual_v2_type'] = 'fak nose manual'
  504. fak_nmanual_on()
  505. ###########
  506. def reg_stanceinc_on():
  507. pass
  508. def reg_stanceinc_off():
  509. pass
  510. def reg_stance_left_on():
  511. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
  512. if own["Pump"] == 1:
  513. own['requestAction'] = 'reg_pump_left'
  514. else:
  515. own['requestAction'] = 'reg_turnLeft'
  516. LAST_LEFT = own["LAST_LEFT"]
  517. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  518. if LAST_LEFT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  519. LAST_LEFT = 1
  520. own["LAST_LEFT"] = 1
  521. def reg_stance_right_on():
  522. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
  523. if own["Pump"] == 1:
  524. own['requestAction'] = 'reg_pump_right'
  525. else:
  526. own['requestAction'] = 'reg_turnRight'
  527. LAST_RIGHT = own["LAST_RIGHT"]
  528. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  529. if LAST_RIGHT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  530. LAST_RIGHT = 1
  531. own["LAST_RIGHT"] = 1
  532. def fak_stance_on(inc):
  533. playing = deck.isPlayingAction(40)
  534. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and playing == 0 and own['gt_cd2'] < 1:
  535. own['requestAction'] = 'fak_roll'
  536. def fak_stance_left_on():
  537. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
  538. if own["Pump"] == 1:
  539. own['requestAction'] = 'fak_pump_left'
  540. else:
  541. own['requestAction'] = 'fak_turnLeft'
  542. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  543. playing_action_frame = skater.getActionFrame(LAND_LAYER)
  544. if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
  545. LAST_LEFT_FAK = 1
  546. own["LAST_LEFT_FAK"] = 1
  547. def fak_stance_left_off():
  548. LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
  549. own["LAST_LEFT_FAK"] = 0
  550. def fak_stance_right_on():
  551. if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
  552. if own["Pump"] == 1:
  553. own['requestAction'] = 'fak_pump_right'
  554. else:
  555. own['requestAction'] = 'fak_turnRight'
  556. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  557. own["LAST_RIGHT_FAK"] = 1
  558. def fak_stance_right_off():
  559. LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
  560. own["LAST_RIGHT_FAK"] = 0
  561. def reg_air_on():
  562. playing = deck.isPlayingAction(fliplay)
  563. if playing == False:
  564. own['requestAction'] = 'reg_air'
  565. def reg_air_off():
  566. pass
  567. def fak_air_on():
  568. flipping = skater.isPlayingAction(fliplay)
  569. if flipping == False:
  570. own['requestAction'] = 'fak_air'
  571. def fak_air_off():
  572. pass
  573. def stance():
  574. rotation = .96
  575. turnsens = 0.06
  576. if rot.z < .9: inc = 1
  577. else: inc = 0
  578. flipping = False
  579. #ground
  580. ground_since = own["framenum"] - own['lF_air_frame']
  581. inc = 0
  582. if rot.z < .98:
  583. inc = 1
  584. if r_ground.triggered == True and grindHit == False and flipping == False and own["wallride"] == None and own['revert_timer'] < 2:
  585. if STANCE == 0:
  586. reg_manual = own['reg_manual']
  587. fak_manual = own["fak_manual"]
  588. reg_nmanual = own['reg_nmanual']
  589. fak_nmanual = own["fak_nmanual"]
  590. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  591. reg_air_off()
  592. fak_air_off()
  593. if reg_manual == 0 and fak_manual == 0:
  594. last_manual = own['last_reg_manual']
  595. reg_stance_on(inc)
  596. if own['manual_v2_type'] == 'reg manual':
  597. reg_manual_on()
  598. elif own['manual_v2_type'] == 'reg nose manual':
  599. reg_nmanual_on()
  600. elif own['manual_v2_type'] == 'fak manual':
  601. fak_manual_on()
  602. elif own['manual_v2_type'] == 'fak nose manual':
  603. fak_nmanual_on()
  604. if STANCE == 1:
  605. reg_manual = own['reg_manual']
  606. fak_manual = own["fak_manual"]
  607. reg_nmanual = own['reg_nmanual']
  608. fak_nmanual = own["fak_nmanual"]
  609. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  610. reg_air_off()
  611. fak_air_off
  612. if fak_manual == 0:
  613. last_manual = own['last_fak_manual']
  614. fak_stance_on(inc)
  615. if own['manual_v2_type'] == 'fak manual':
  616. fak_manual_on()
  617. elif own['manual_v2_type'] == 'fak nose manual':
  618. fak_nmanual_on()
  619. elif own['manual_v2_type'] == 'reg manual':
  620. reg_manual_on()
  621. elif own['manual_v2_type'] == 'reg nose manual':
  622. reg_nmanual_on()
  623. #if own["Pump"] == False:
  624. if (lLR < -turnsens or dict['kb_la'] == 2) and STANCE == 0:
  625. reg_stance_left_on()
  626. if lLR > -turnsens or LAST_GRIND != grindHit or dict['kb_la'] == 0:
  627. reg_stance_left_off()
  628. if (lLR > turnsens or dict['kb_ra'] == 2) and STANCE == 0:
  629. reg_stance_right_on()
  630. if lLR < turnsens or LAST_GRIND != grindHit or dict['kb_ra'] == 0:
  631. reg_stance_right_off()
  632. if (lLR < -turnsens or dict['kb_la'] == 2) and STANCE == 1:
  633. fak_stance_left_on()
  634. if lLR > -turnsens or LAST_GRIND != grindHit or dict['kb_la'] == 0:
  635. fak_stance_left_off()
  636. if (lLR > turnsens or dict['kb_ra'] == 2) and STANCE == 1:
  637. fak_stance_right_on()
  638. if lLR < turnsens or LAST_GRIND != grindHit or dict['kb_ra'] == 0:
  639. fak_stance_right_off()
  640. #air
  641. playing = deck.isPlayingAction(fliplay)
  642. if r_ground.triggered == False and playing == False and flipping == False:
  643. if STANCE == 0:
  644. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  645. fak_air_off()
  646. reg_stance_left_off()
  647. reg_stance_right_off()
  648. fak_stance_left_off()
  649. fak_stance_right_off()
  650. reg_air_on()
  651. if STANCE == 1:
  652. if LAST_STANCE != STANCE or LAST_GROUND != r_ground.triggered:
  653. reg_air_off()
  654. reg_stance_left_off()
  655. reg_stance_right_off()
  656. fak_stance_left_off()
  657. fak_stance_right_off()
  658. fak_air_on()
  659. ###################
  660. #trick definitions#
  661. ###################
  662. def jump():
  663. #print("jump funct")
  664. jump_timer = own['jump_timer']
  665. cont.deactivate(wallrideconstL)
  666. cont.deactivate(wallrideconstR)
  667. own['last_jump_frame'] = frame
  668. own['no_grind_timer'] = 0
  669. if JUMPSTRENGTH != 0:
  670. height = JUMPSTRENGTH * JUMPHEIGHT
  671. else:
  672. height = JUMPHEIGHT
  673. #if jump_timer == 0:
  674. if jump_timer < 50:
  675. jump_timer = 60
  676. own['jump_timer'] = jump_timer
  677. if zvel < 7 and jump_timer == 60:
  678. cont.activate(own.actuators["pop"])
  679. own['pop_sound'] = 1
  680. #print("jump")
  681. #
  682. posx = own.worldPosition[0]
  683. posy = own.worldPosition[1]
  684. posz = own.worldPosition[2]
  685. jumppos = Vector((posx, posy, posz))
  686. own['jumpPos'] = jumppos
  687. force = [ 0.0, 0.0, height]
  688. # use local axis
  689. local = False
  690. # apply force
  691. try:
  692. if 'trans' in r_ground.hitObject:
  693. #print('jump from trans')
  694. own['jump_from_trans'] = 1
  695. own['trans_jump_obj'] = r_ground.hitObject
  696. except:
  697. #print('trans jump broke')
  698. pass
  699. if grindHit == False:
  700. if rot.z < .7:
  701. rotamt = rot.z * .5
  702. own.applyRotation([0, rotamt,0], True)
  703. own['no_grind'] = True
  704. own['no_grind_pull'] = 1
  705. own.applyForce(force, local)
  706. force2 = [0.0, 0, 150]
  707. own.applyForce(force2, True)
  708. #print("apply jump force1")
  709. if grindHit == True:
  710. linvelloc = own.getLinearVelocity(True)
  711. own.applyForce(force, True)
  712. force2 = [0.0, 0, 150]
  713. own.applyForce(force2, True)
  714. linvelloc2 = own.getLinearVelocity(True)
  715. force = (linvelloc.x, linvelloc.y, linvelloc2.z)
  716. own.setLinearVelocity(force, True)
  717. #print("apply jump force2 grindHit")
  718. own['jump_stance'] = STANCE
  719. if STANCE == True:
  720. own["jump_stance"] = 1
  721. if STANCE == False:
  722. own["jump_stance"] = 0
  723. own["jump_stance"] = own["stance"]
  724. if grindHit == True:
  725. own['grind_jump'] = 1
  726. if lLR > turnsens or lLR < -turnsens or lUD > turnsens or lUD < -turnsens:
  727. own['grindjumpturn'] = True
  728. num = 1
  729. if num ==1:
  730. rString = "R"
  731. lString = "L"
  732. cont.deactivate(wallrideconstL)
  733. cont.deactivate(wallrideconstR)
  734. if own["wallride"] == "R":
  735. force = [0,170,0]
  736. own.applyForce(force, True)
  737. cont.activate(own.actuators["pop2"])
  738. jump_timer = 60
  739. own['jump_timer'] = jump_timer
  740. if own["wallride"] == "L":
  741. force = [0,-170,0] #325
  742. own.applyForce(force, True)
  743. cont.activate(own.actuators["pop2"])
  744. jump_timer = 60
  745. own['jump_timer'] = jump_timer
  746. own["Q1oncd"] = 0
  747. own["Q2oncd"] = 0
  748. own["Q3oncd"] = 0
  749. own["Q4oncd"] = 0
  750. own["Q5oncd"] = 0
  751. own["Q6oncd"] = 0
  752. own["Q7oncd"] = 0
  753. own["Q8oncd"] = 0
  754. if own['jump_timer'] == 60:
  755. own['jump_timer'] = 59
  756. def jump_Timer():
  757. jump_timer = own['jump_timer']
  758. if jump_timer > 0:
  759. jump_timer = jump_timer - 1
  760. own['jump_timer'] = jump_timer
  761. if own['grindjumpturn'] == True:
  762. jump_timer = 30
  763. own['jump_timer'] = jump_timer
  764. def pump():
  765. velocity = own['velocity']
  766. #switch
  767. local = True
  768. downforce = -.1
  769. lF_air_frame = own['lF_air_frame']
  770. frames_since_ground = own['framenum'] - own['lF_air_frame']
  771. if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:
  772. countdown = COUNTDOWN
  773. yvel = linVelocity.x + SPEEDPUMP
  774. yvel2 = linVelocity.x + SPEEDPUMPFAST
  775. own['countdown'] = countdown
  776. force = [(yvel), 0, linVelocity.z + downforce]
  777. force2 = [(yvel2), 0, linVelocity.z + downforce]
  778. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  779. own.setLinearVelocity(force, local)
  780. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  781. own.setLinearVelocity(force2, local)
  782. if own['requestAction'] not in ['fak_pump_left', 'fak_pump_right'] and own['l_actionState'] not in ['fak_turnLeft', 'fak_turnRight']:
  783. own['requestAction'] = 'fak_pump'
  784. #reg
  785. if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:
  786. countdown = COUNTDOWN
  787. yvel = linVelocity.x - SPEEDPUMP
  788. yvel2 = linVelocity.x - SPEEDPUMPFAST
  789. own['countdown'] = countdown
  790. force = [(yvel), 0, linVelocity.z + downforce]
  791. force2 = [(yvel2), 0, linVelocity.z + downforce]
  792. if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
  793. own.setLinearVelocity(force, local)
  794. if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
  795. own.setLinearVelocity(force2, local)
  796. if own['requestAction'] not in ['reg_pump_left', 'reg_pump_right'] and own['l_actionState'] not in ['reg_turnLeft', 'reg_turnRight']:
  797. own['requestAction'] = 'reg_pump'
  798. own["Pump"] = True
  799. own["lastPump"] = True
  800. def roll():
  801. if r_ground.triggered == 1:
  802. pass
  803. def stop():
  804. if linVelocity.x < .05 and linVelocity.x > -.05:
  805. can_stop = 0
  806. own["lastStop"] = True
  807. else:
  808. can_stop = 1
  809. if r_ground.triggered == 1 and STANCE == False and can_stop == 1:
  810. own['requestAction'] = 'reg_stop'
  811. yvel = linVelocity.x * .985
  812. force = [(yvel), 0, linVelocity.z]
  813. own.setLinearVelocity(force, True)
  814. elif r_ground.triggered == 1 and STANCE == True and can_stop == 1:
  815. own['requestAction'] = 'fak_stop'
  816. yvel = linVelocity.x * .985
  817. force = [(yvel), 0, linVelocity.z]
  818. own.setLinearVelocity(force, True)
  819. if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
  820. own["lastStop"] == False
  821. def oposin():
  822. if ground_since > 30:
  823. if (r_ground.triggered == 1) and STANCE == False and own['manual'] == 0:
  824. if grindold == 0:
  825. own['requestAction'] = 'reg_opos'
  826. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  827. if grindold == 0:
  828. own['requestAction'] = 'fak_opos'
  829. own["last_Opos"] = True
  830. def noposin():
  831. if ground_since > 30:
  832. if (r_ground.triggered == 1) and STANCE == False and own['manual'] == 0:
  833. if grindold == 0:
  834. own['requestAction'] = 'reg_nopos'
  835. elif (r_ground.triggered == 1) and STANCE == True and own['manual'] == 0:
  836. if grindold == 0:
  837. own['requestAction'] = 'fak_nopos'
  838. own["last_nOpos"] = True
  839. def aollie():
  840. print("ollie")
  841. #dict['trick_string'] = 'Ollie'
  842. r_ground = cont.sensors["r_Ground"]
  843. trigger = r_ground.triggered
  844. STANCE = own["stance"]
  845. wallride = own["wallride"]
  846. dict['trick_string'] = 'Ollie'
  847. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  848. own["wallride_off"] = 1
  849. own['requestAction'] = 'reg_ollie'
  850. jump()
  851. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  852. own["wallride_off"] = 1
  853. own['requestAction'] = 'fak_ollie'
  854. jump()
  855. def nollie():
  856. print("nollie")
  857. dict['trick_string'] = 'Nollie'
  858. r_ground = cont.sensors["r_Ground"]
  859. trigger = r_ground.triggered
  860. STANCE = own["stance"]
  861. if (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  862. own['requestAction'] = 'fak_nollie'
  863. own["wallride_off"] = 1
  864. jump()
  865. elif (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  866. own["wallride_off"] = 1
  867. own['requestAction'] = 'reg_nollie'
  868. jump()
  869. def kickflip():
  870. print("kickflip")
  871. STANCE = own["stance"]
  872. print(flip_start_lay)
  873. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  874. own["wallride_off"] = 1
  875. own['requestAction'] = 'reg_kickflip'
  876. jump()
  877. dict['trick_string'] = 'Kickflip'
  878. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  879. own["wallride_off"] = 1
  880. own['requestAction'] = 'fak_heelflip'
  881. jump()
  882. if own["wallride"] !=1: jump()
  883. dict['trick_string'] = 'Heelflip'
  884. if r_ground.triggered == 0 and STANCE == False:
  885. own["wallride_off"] = 1
  886. own['requestAction'] = 'reg_kickflip'
  887. if own["wallride"] != None:
  888. jump()
  889. dict['trick_string'] = 'Kickflip'
  890. elif r_ground.triggered == 0 and STANCE == True:
  891. own["wallride_off"] = 1
  892. own['requestAction'] = 'fak_heelflip'
  893. if own["wallride"] != None:
  894. jump()
  895. dict['trick_string'] = 'Heelflip'
  896. def inward_heelflip():
  897. print("inward heelflip")
  898. dict['trick_string'] = 'Inward Heelflip'
  899. STANCE = own["stance"]
  900. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  901. own["wallride_off"] = 1
  902. own['requestAction'] = 'reg_inward_heelflip'
  903. jump()
  904. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  905. own["wallride_off"] = 1
  906. own['requestAction'] = 'fak_inward_heelflip'
  907. jump()
  908. if r_ground.triggered == 0 and STANCE == False:
  909. own["wallride_off"] = 1
  910. if own["wallride"] != None:
  911. jump()
  912. elif r_ground.triggered == 0 and STANCE == True:
  913. own["wallride_off"] = 1
  914. if own["wallride"] != None:
  915. jump()
  916. def hardflip():
  917. print("hardflip")
  918. dict['trick_string'] = 'Hardflip'
  919. STANCE = own["stance"]
  920. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  921. own["wallride_off"] = 1
  922. own['requestAction'] = 'reg_hardflip'
  923. jump()
  924. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  925. own["wallride_off"] = 1
  926. own['requestAction'] = 'fak_hardflip'
  927. jump()
  928. if r_ground.triggered == 0 and STANCE == False:
  929. own["wallride_off"] = 1
  930. if own["wallride"] != None:
  931. jump()
  932. elif r_ground.triggered == 0 and STANCE == True:
  933. own["wallride_off"] = 1
  934. if own["wallride"] != None:
  935. jump()
  936. def nollie_inward_heelflip():
  937. print("nollie inward heelflip")
  938. dict['trick_string'] = 'Nollie Inward Heelflip'
  939. STANCE = own["stance"]
  940. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  941. own["wallride_off"] = 1
  942. own['requestAction'] = 'reg_nollie_inward_heelflip'
  943. jump()
  944. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  945. own["wallride_off"] = 1
  946. own['requestAction'] = 'fak_nollie_inward_heelflip'
  947. jump()
  948. if r_ground.triggered == 0 and STANCE == False:
  949. own["wallride_off"] = 1
  950. if own["wallride"] != None:
  951. jump()
  952. elif r_ground.triggered == 0 and STANCE == True:
  953. own["wallride_off"] = 1
  954. if own["wallride"] != None:
  955. jump()
  956. def nollie_hardflip():
  957. print("nollie hardflip")
  958. dict['trick_string'] = 'Nollie Hardflip'
  959. STANCE = own["stance"]
  960. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  961. own["wallride_off"] = 1
  962. own['requestAction'] = 'reg_nollie_hardflip'
  963. jump()
  964. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  965. own["wallride_off"] = 1
  966. own['requestAction'] = 'fak_nollie_hardflip'
  967. jump()
  968. if r_ground.triggered == 0 and STANCE == False:
  969. own["wallride_off"] = 1
  970. if own["wallride"] != None:
  971. jump()
  972. elif r_ground.triggered == 0 and STANCE == True:
  973. own["wallride_off"] = 1
  974. if own["wallride"] != None:
  975. jump()
  976. def varial_kickflip():
  977. print("varial kickflip")
  978. dict['trick_string'] = 'Varial Kickflip'
  979. STANCE = own["stance"]
  980. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  981. own["wallride_off"] = 1
  982. own['requestAction'] = 'reg_varial_kickflip'
  983. jump()
  984. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  985. own["wallride_off"] = 1
  986. own['requestAction'] = 'fak_varial_kickflip'
  987. jump()
  988. if r_ground.triggered == 0 and STANCE == False:
  989. own["wallride_off"] = 1
  990. if own["wallride"] != None:
  991. jump()
  992. elif r_ground.triggered == 0 and STANCE == True:
  993. own["wallride_off"] = 1
  994. if own["wallride"] != None:
  995. jump()
  996. def nollie_varial_kickflip():
  997. print("nollie varial kickflip")
  998. dict['trick_string'] = 'Nollie Varial Kickflip'
  999. STANCE = own["stance"]
  1000. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1001. own["wallride_off"] = 1
  1002. own['requestAction'] = 'reg_nollie_varial_kickflip'
  1003. jump()
  1004. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1005. own["wallride_off"] = 1
  1006. own['requestAction'] = 'fak_nollie_varial_kickflip'
  1007. jump()
  1008. if r_ground.triggered == 0 and STANCE == False:
  1009. own["wallride_off"] = 1
  1010. if own["wallride"] != None:
  1011. jump()
  1012. elif r_ground.triggered == 0 and STANCE == True:
  1013. own["wallride_off"] = 1
  1014. if own["wallride"] != None:
  1015. jump()
  1016. def nollie_varial_heelflip():
  1017. print("nollie varial heelflip")
  1018. dict['trick_string'] = 'Nollie Varial Heelflip'
  1019. STANCE = own["stance"]
  1020. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1021. own["wallride_off"] = 1
  1022. own['requestAction'] = 'reg_nollie_varial_heelflip'
  1023. jump()
  1024. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1025. own["wallride_off"] = 1
  1026. own['requestAction'] = 'fak_nollie_varial_heelflip'
  1027. jump()
  1028. if r_ground.triggered == 0 and STANCE == False:
  1029. own["wallride_off"] = 1
  1030. if own["wallride"] != None:
  1031. jump()
  1032. elif r_ground.triggered == 0 and STANCE == True:
  1033. own["wallride_off"] = 1
  1034. if own["wallride"] != None:
  1035. jump()
  1036. def varial_heelflip():
  1037. print("varial heelflip")
  1038. dict['trick_string'] = 'Varial Heelflip'
  1039. STANCE = own["stance"]
  1040. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1041. own["wallride_off"] = 1
  1042. own['requestAction'] = 'reg_varial_heelflip'
  1043. jump()
  1044. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1045. own["wallride_off"] = 1
  1046. own['requestAction'] = 'fak_varial_heelflip'
  1047. jump()
  1048. if r_ground.triggered == 0 and STANCE == False:
  1049. own["wallride_off"] = 1
  1050. if own["wallride"] != None:
  1051. jump()
  1052. elif r_ground.triggered == 0 and STANCE == True:
  1053. own["wallride_off"] = 1
  1054. if own["wallride"] != None:
  1055. jump()
  1056. def nollie_kickflip():
  1057. print("kickflip")
  1058. STANCE = own["stance"]
  1059. dict['trick_string'] = 'Nollie Kickflip'
  1060. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1061. own["wallride_off"] = 1
  1062. own['requestAction'] = 'reg_nollie_kickflip'
  1063. jump()
  1064. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1065. own["wallride_off"] = 1
  1066. own['requestAction'] = 'fak_nollie_kickflip'
  1067. jump()
  1068. if r_ground.triggered == 0 and STANCE == False:
  1069. own["wallride_off"] = 1
  1070. elif r_ground.triggered == 0 and STANCE == True:
  1071. own["wallride_off"] = 1
  1072. def heelflip():
  1073. print("heelflip")
  1074. STANCE = own["stance"]
  1075. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1076. own["wallride_off"] = 1
  1077. own['requestAction'] = 'reg_heelflip'
  1078. jump()
  1079. dict['trick_string'] = 'Heelflip'
  1080. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1081. own["wallride_off"] = 1
  1082. own['requestAction'] = 'fak_kickflip'
  1083. jump()
  1084. dict['trick_string'] = 'Kickflip'
  1085. if r_ground.triggered == 0 and STANCE == False:
  1086. own["wallride_off"] = 1
  1087. elif r_ground.triggered == 0 and STANCE == True:
  1088. own["wallride_off"] = 1
  1089. def nollie_heelflip():
  1090. print("heelflip")
  1091. dict['trick_string'] = 'Nollie Heelflip'
  1092. STANCE = own["stance"]
  1093. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1094. own["wallride_off"] = 1
  1095. own['requestAction'] = 'reg_nollie_heelflip'
  1096. jump()
  1097. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1098. own["wallride_off"] = 1
  1099. own['requestAction'] = 'fak_nollie_heelflip'
  1100. jump()
  1101. if r_ground.triggered == 0 and STANCE == False:
  1102. own["wallride_off"] = 1
  1103. if own["wallride"] != None:
  1104. jump()
  1105. elif r_ground.triggered == 0 and STANCE == True:
  1106. own["wallride_off"] = 1
  1107. if own["wallride"] != None:
  1108. jump()
  1109. def shuvit():
  1110. print("shuvit")
  1111. dict['trick_string'] = 'Shuvit'
  1112. STANCE = own["stance"]
  1113. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1114. own["wallride_off"] = 1
  1115. own['requestAction'] = 'reg_shuvit'
  1116. jump()
  1117. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1118. own["wallride_off"] = 1
  1119. own['requestAction'] = 'fak_shuvit'
  1120. jump()
  1121. if r_ground.triggered == 0 and STANCE == False:
  1122. if own["wallride"] != None:
  1123. jump()
  1124. elif r_ground.triggered == 0 and STANCE == True:
  1125. own["wallride_off"] = 1
  1126. if own["wallride"] != None:
  1127. jump()
  1128. def shuvit360():
  1129. print("360shuvit")
  1130. dict['trick_string'] = '360 Shuvit'
  1131. STANCE = own["stance"]
  1132. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1133. own["wallride_off"] = 1
  1134. own['requestAction'] = 'reg_shuvit360'
  1135. jump()
  1136. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1137. own["wallride_off"] = 1
  1138. own['requestAction'] = 'fak_shuvit360'
  1139. jump()
  1140. if r_ground.triggered == 0 and STANCE == False:
  1141. own["wallride_off"] = 1
  1142. if own["wallride"] != None:
  1143. jump()
  1144. elif r_ground.triggered == 0 and STANCE == True:
  1145. own["wallride_off"] = 1
  1146. if own["wallride"] != None:
  1147. jump()
  1148. def fsshuvit360():
  1149. print("360shuvit")
  1150. dict['trick_string'] = 'FS 360 Shuvit'
  1151. STANCE = own["stance"]
  1152. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1153. own["wallride_off"] = 1
  1154. own['requestAction'] = 'reg_fsshuvit360'
  1155. jump()
  1156. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1157. own["wallride_off"] = 1
  1158. own['requestAction'] = 'fak_fsshuvit360'
  1159. jump()
  1160. if r_ground.triggered == 0 and STANCE == False:
  1161. own["wallride_off"] = 1
  1162. if own["wallride"] != None:
  1163. jump()
  1164. elif r_ground.triggered == 0 and STANCE == True:
  1165. own["wallride_off"] = 1
  1166. if own["wallride"] != None:
  1167. jump()
  1168. def nollie_shuvit():
  1169. print("shuvit")
  1170. dict['trick_string'] = 'Nollie Shuvit'
  1171. STANCE = own["stance"]
  1172. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1173. own["wallride_off"] = 1
  1174. own['requestAction'] = 'reg_nollie_shuvit'
  1175. jump()
  1176. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1177. own["wallride_off"] = 1
  1178. own['requestAction'] = 'fak_nollie_shuvit'
  1179. jump()
  1180. if r_ground.triggered == 0 and STANCE == False:
  1181. own["wallride_off"] = 1
  1182. if own["wallride"] != None:
  1183. jump()
  1184. elif r_ground.triggered == 0 and STANCE == True:
  1185. own["wallride_off"] = 1
  1186. if own["wallride"] != None:
  1187. jump()
  1188. def fsshuvit():
  1189. dict['trick_string'] = 'FS Shuvit'
  1190. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1191. own["wallride_off"] = 1
  1192. own['requestAction'] = 'reg_fsshuvit'
  1193. jump()
  1194. elif (r_ground.triggered == 1 and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
  1195. own["wallride_off"] = 1
  1196. own['requestAction'] = 'fak_fsshuvit'
  1197. jump()
  1198. if r_ground.triggered == 0 and STANCE == False:
  1199. own["wallride_off"] = 1
  1200. if own["wallride"] != None:
  1201. jump()
  1202. elif r_ground.triggered == 0 and STANCE == True:
  1203. own["wallride_off"] = 1
  1204. if own["wallride"] != None:
  1205. jump()
  1206. def nollie_fsshuvit():
  1207. dict['trick_string'] = 'Nollie FS Shuvit'
  1208. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1209. own["wallride_off"] = 1
  1210. own['requestAction'] = 'reg_nollie_fsshuvit'
  1211. jump()
  1212. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1213. own["wallride_off"] = 1
  1214. own['requestAction'] = 'fak_nollie_fsshuvit'
  1215. jump()
  1216. if r_ground.triggered == 0 and STANCE == False:
  1217. own["wallride_off"] = 1
  1218. if own["wallride"] != None:
  1219. jump()
  1220. elif r_ground.triggered == 0 and STANCE == True:
  1221. own["wallride_off"] = 1
  1222. if own["wallride"] != None:
  1223. jump()
  1224. #nollie_shuvit360()
  1225. def nollie_shuvit360():
  1226. dict['trick_string'] = 'Nollie FS Shuvit 360'
  1227. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1228. own["wallride_off"] = 1
  1229. own['requestAction'] = 'reg_nollie_shuvit360'
  1230. jump()
  1231. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1232. own["wallride_off"] = 1
  1233. own['requestAction'] = 'fak_nollie_shuvit360'
  1234. jump()
  1235. if r_ground.triggered == 0 and STANCE == False:
  1236. own["wallride_off"] = 1
  1237. if own["wallride"] != None:
  1238. jump()
  1239. elif r_ground.triggered == 0 and STANCE == True:
  1240. own["wallride_off"] = 1
  1241. if own["wallride"] != None:
  1242. jump()
  1243. #nollie_fsshuvit360()
  1244. def nollie_fsshuvit360():
  1245. dict['trick_string'] = 'Nollie FS Shuvit 360'
  1246. if (r_ground.triggered == 1 and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
  1247. own["wallride_off"] = 1
  1248. own['requestAction'] = 'reg_nollie_fsshuvit_360'
  1249. jump()
  1250. elif (r_ground.triggered == 1 and STANCE == True) or (grindHit == True and STANCE == True):
  1251. own["wallride_off"] = 1
  1252. own['requestAction'] = 'fak_nollie_fsshuvit_360'
  1253. jump()
  1254. if r_ground.triggered == 0 and STANCE == False:
  1255. own["wallride_off"] = 1
  1256. if own["wallride"] != None:
  1257. jump()
  1258. elif r_ground.triggered == 0 and STANCE == True:
  1259. own["wallride_off"] = 1
  1260. if own["wallride"] != None:
  1261. jump()
  1262. #-------
  1263. def reg_frigid_grab_on():
  1264. GRAB_PLAYED = own["GRAB_PLAYED"]
  1265. GRAB_ON = own["GRAB_ON"]
  1266. dict['trick_string'] = 'Frigid'
  1267. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1268. own['requestAction'] = 'reg_frigid'
  1269. GRAB_PLAYED = True
  1270. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1271. def reg_fsonefoot_grab_on():
  1272. GRAB_PLAYED = own["GRAB_PLAYED"]
  1273. GRAB_ON = own["GRAB_ON"]
  1274. dict['trick_string'] = 'FS One Foot'
  1275. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1276. own['requestAction'] = 'reg_fsonefoot'
  1277. GRAB_PLAYED = True
  1278. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1279. def reg_onefoot_grab_on():
  1280. GRAB_PLAYED = own["GRAB_PLAYED"]
  1281. GRAB_ON = own["GRAB_ON"]
  1282. dict['trick_string'] = 'One Foot'
  1283. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1284. own['requestAction'] = 'reg_onefoot'
  1285. GRAB_PLAYED = True
  1286. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1287. def fak_frigid_grab_on():
  1288. GRAB_PLAYED = own["GRAB_PLAYED"]
  1289. GRAB_ON = own["GRAB_ON"]
  1290. dict['trick_string'] = 'Frigid'
  1291. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1292. own['requestAction'] = 'fak_frigid'
  1293. GRAB_PLAYED = True
  1294. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1295. def fak_fsonefoot_grab_on():
  1296. GRAB_PLAYED = own["GRAB_PLAYED"]
  1297. GRAB_ON = own["GRAB_ON"]
  1298. dict['trick_string'] = 'FS One Foot'
  1299. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1300. own['requestAction'] = 'fak_fsonefoot'
  1301. GRAB_PLAYED = True
  1302. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1303. def fak_onefoot_grab_on():
  1304. GRAB_PLAYED = own["GRAB_PLAYED"]
  1305. GRAB_ON = own["GRAB_ON"]
  1306. dict['trick_string'] = 'One Foot'
  1307. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1308. own['requestAction'] = 'fak_onefoot'
  1309. GRAB_PLAYED = True
  1310. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1311. #----
  1312. def reg_judo_grab_on():
  1313. GRAB_PLAYED = own["GRAB_PLAYED"]
  1314. GRAB_ON = own["GRAB_ON"]
  1315. dict['trick_string'] = 'Judo'
  1316. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1317. own['requestAction'] = 'reg_judo'
  1318. GRAB_PLAYED = True
  1319. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1320. def fak_judo_grab_on():
  1321. GRAB_PLAYED = own["GRAB_PLAYED"]
  1322. GRAB_ON = own["GRAB_ON"]
  1323. dict['trick_string'] = 'Judo'
  1324. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1325. own['requestAction'] = 'fak_judo'
  1326. GRAB_PLAYED = True
  1327. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1328. def frontside_grab_on():
  1329. GRAB_PLAYED = own["GRAB_PLAYED"]
  1330. GRAB_ON = own["GRAB_ON"]
  1331. dict['trick_string'] = 'Mute'
  1332. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1333. own['requestAction'] = 'frontside_grab'
  1334. GRAB_PLAYED = True
  1335. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1336. def backside_grab_on():
  1337. GRAB_PLAYED = own["GRAB_PLAYED"]
  1338. GRAB_ON = own["GRAB_ON"]
  1339. dict['trick_string'] = 'Backside'
  1340. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1341. own['requestAction'] = 'reg_fp_rback'
  1342. elif GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1343. own['requestAction'] = 'backside_grab'
  1344. GRAB_PLAYED = True
  1345. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1346. def fakfrontside_grab_on():
  1347. GRAB_PLAYED = own["GRAB_PLAYED"]
  1348. GRAB_ON = own["GRAB_ON"]
  1349. dict['trick_string'] = 'Mute'
  1350. if GRAB_ON == True and r_ground.triggered == 0 and aBut == True:
  1351. own['requestAction'] = 'fak_fp_rback'
  1352. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1353. own['requestAction'] = 'fak_frontside_grab'
  1354. GRAB_PLAYED = True
  1355. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1356. def fakbackside_grab_on():
  1357. GRAB_PLAYED = own["GRAB_PLAYED"]
  1358. GRAB_ON = own["GRAB_ON"]
  1359. dict['trick_string'] = 'Backside'
  1360. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1361. own['requestAction'] = 'fak_backside_grab'
  1362. GRAB_PLAYED = True
  1363. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1364. #nose/tail grabs
  1365. def frontside_nose_grab_on():
  1366. GRAB_PLAYED = own["GRAB_PLAYED"]
  1367. GRAB_ON = own["GRAB_ON"]
  1368. dict['trick_string'] = 'FS Nose'
  1369. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1370. own['requestAction'] = 'frontside_nose_grab'
  1371. GRAB_PLAYED = True
  1372. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1373. def frontside_tail_grab_on():
  1374. GRAB_PLAYED = own["GRAB_PLAYED"]
  1375. GRAB_ON = own["GRAB_ON"]
  1376. dict['trick_string'] = 'FS Tail'
  1377. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1378. own['requestAction'] = 'frontside_tail_grab'
  1379. GRAB_PLAYED = True
  1380. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1381. def backside_nose_grab_on():
  1382. GRAB_PLAYED = own["GRAB_PLAYED"]
  1383. GRAB_ON = own["GRAB_ON"]
  1384. dict['trick_string'] = 'BS Nose'
  1385. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1386. own['requestAction'] = 'backside_nose_grab'
  1387. GRAB_PLAYED = True
  1388. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1389. def backside_tail_grab_on():
  1390. GRAB_PLAYED = own["GRAB_PLAYED"]
  1391. GRAB_ON = own["GRAB_ON"]
  1392. dict['trick_string'] = 'BS Tail'
  1393. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1394. own['requestAction'] = 'backside_tail_grab'
  1395. GRAB_PLAYED = True
  1396. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1397. def reg_airwalk():
  1398. GRAB_PLAYED = own["GRAB_PLAYED"]
  1399. GRAB_ON = own["GRAB_ON"]
  1400. dict['trick_string'] = 'Airwalk'
  1401. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1402. own['requestAction'] = 'reg_airwalk'
  1403. GRAB_PLAYED = True
  1404. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1405. #switch
  1406. def fak_frontside_nose_grab_on():
  1407. GRAB_PLAYED = own["GRAB_PLAYED"]
  1408. GRAB_ON = own["GRAB_ON"]
  1409. dict['trick_string'] = 'FS Nose'
  1410. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1411. own['requestAction'] = 'fak_frontside_nose_grab'
  1412. GRAB_PLAYED = True
  1413. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1414. def fak_frontside_tail_grab_on():
  1415. GRAB_PLAYED = own["GRAB_PLAYED"]
  1416. GRAB_ON = own["GRAB_ON"]
  1417. dict['trick_string'] = 'FS Tail'
  1418. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1419. own['requestAction'] = 'fak_frontside_tail_grab'
  1420. GRAB_PLAYED = True
  1421. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1422. def fak_backside_nose_grab_on():
  1423. GRAB_PLAYED = own["GRAB_PLAYED"]
  1424. GRAB_ON = own["GRAB_ON"]
  1425. dict['trick_string'] = 'BS Nose'
  1426. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1427. own['requestAction'] = 'fak_backside_nose_grab'
  1428. GRAB_PLAYED = True
  1429. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1430. def fak_backside_tail_grab_on():
  1431. GRAB_PLAYED = own["GRAB_PLAYED"]
  1432. GRAB_ON = own["GRAB_ON"]
  1433. dict['trick_string'] = 'BS Tail'
  1434. if GRAB_ON == True and GRAB_PLAYED == False and r_ground.triggered == 0:
  1435. own['requestAction'] = 'fak_backside_tail_grab'
  1436. GRAB_PLAYED = True
  1437. own["GRAB_PLAYED)"] = GRAB_PLAYED
  1438. #--------------------
  1439. def SWAG():
  1440. if r_ground.triggered == 1:
  1441. SWAG = own["swag"]
  1442. SWAG = own.getLinearVelocity(True)
  1443. SWAG = SWAG[1]
  1444. own["swag"] = SWAG
  1445. if STANCE == True:
  1446. if SWAG > 1 and SWAG < 2:
  1447. rotation = [ 0.0, 0, (SWAG / 200)]
  1448. own.applyRotation( rotation, True)
  1449. elif SWAG > 2:
  1450. rotation = [ 0.0, 0, (SWAG / 50)]
  1451. own.applyRotation( rotation, True)
  1452. elif SWAG < -1 and SWAG > -2:
  1453. rotation = [ 0.0, 0, (SWAG / 200)]
  1454. own.applyRotation( rotation, True)
  1455. elif SWAG < -2:
  1456. rotation = [ 0.0, 0, (SWAG / 50)]
  1457. own.applyRotation( rotation, True)
  1458. if STANCE == False:
  1459. if SWAG > 1 and SWAG < 2:
  1460. rotation = [ 0.0, 0, (-SWAG / 200)]
  1461. own.applyRotation( rotation, True)
  1462. elif SWAG > 2:
  1463. rotation = [ 0.0, 0, (-SWAG / 50)]
  1464. own.applyRotation( rotation, True)
  1465. elif SWAG < -1 and SWAG > -2:
  1466. rotation = [ 0.0, 0, (-SWAG / 200)]
  1467. own.applyRotation( rotation, True)
  1468. elif SWAG < -2:
  1469. rotation = [ 0.0, 0, (-SWAG / 50)]
  1470. own.applyRotation( rotation, True)
  1471. def air():
  1472. if r_ground.triggered == False and own['airup'] == 0:
  1473. distance = own.getDistanceTo(gray.hitPosition)
  1474. since_grind_buf = 3
  1475. if gray.hitObject != None and grindDar2.triggered == False and (frame - lgf) > since_grind_buf:
  1476. if distance < .5:
  1477. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1478. elif distance >= .5 and distance < 1.75:
  1479. own.alignAxisToVect(gray.hitNormal, 2, .05)
  1480. elif distance >= 1.75:
  1481. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1482. if grindDar2.triggered and (frame - lgf) > since_grind_buf:
  1483. if distance < .5:
  1484. own.alignAxisToVect(gray.hitNormal, 2, .1)
  1485. elif distance >= .5 and distance < 1.75:
  1486. own.alignAxisToVect(gray.hitNormal, 2, .03)
  1487. elif distance >= 1.75:
  1488. own.alignAxisToVect([0.0,0.0,1.0], 2, .03)
  1489. elif r_ground.triggered == True:
  1490. pass
  1491. def stopAnims():
  1492. pass
  1493. def isplaying():
  1494. # for x in range(9000):
  1495. # l1 = deck.isPlayingAction(x)
  1496. # if l1 == True:
  1497. # print(x)
  1498. pass
  1499. def nextframe():
  1500. framenumber = own["framenum"]
  1501. framenumber = framenumber + 1
  1502. if framenumber == 900000:
  1503. framenumber = 0
  1504. own["framenum"] = framenumber
  1505. own['last_roll_frame'] = framenumber
  1506. def push():
  1507. local = True
  1508. #print("push")
  1509. linVelocity15 = own.linearVelocity
  1510. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0 and own['last_footplant'] == False:
  1511. countdown = COUNTDOWN
  1512. yvel = linVelocity15.x + SPEEDUP
  1513. own['countdown'] = countdown
  1514. force = [(yvel), 0, linVelocity15.z]
  1515. own.setLinearVelocity(force, local)
  1516. own['requestAction'] = 'fak_push_goof'
  1517. #switch
  1518. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1519. countdown = COUNTDOWN
  1520. yvel = linVelocity15.x - SPEEDUP
  1521. own['countdown'] = countdown
  1522. force = [(yvel), 0, linVelocity15.z]
  1523. own.setLinearVelocity(force, local)
  1524. own['requestAction'] = 'reg_push'
  1525. def push_goof():
  1526. linVelocity15 = own.linearVelocity
  1527. local = True
  1528. #print("push goof")
  1529. if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1530. countdown = COUNTDOWN
  1531. yvel = linVelocity15.x + SPEEDUP
  1532. own['countdown'] = countdown
  1533. force = [(yvel), 0, linVelocity15.z]
  1534. own.setLinearVelocity(force, local)
  1535. own['requestAction'] = 'fak_push'
  1536. #switch
  1537. if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and r_ground.triggered == True and own['hippy'] == 0 and own['last_hippy'] == 0:
  1538. countdown = COUNTDOWN
  1539. yvel = linVelocity15.x - SPEEDUP
  1540. own['countdown'] = countdown
  1541. force = [(yvel), 0, linVelocity15.z]
  1542. own.setLinearVelocity(force, local)
  1543. own['requestAction'] = 'reg_push_goof'
  1544. def brfoot():
  1545. if STANCE == 0:
  1546. own['requestAction'] = 'reg_brfoot'
  1547. if STANCE == 1:
  1548. own['requestAction'] = 'fak_brfoot'
  1549. jump()
  1550. def frfoot():
  1551. if STANCE == 0:
  1552. own['requestAction'] = 'reg_frfoot'
  1553. if STANCE == 1:
  1554. own['requestAction'] = 'fak_frfoot'
  1555. jump()
  1556. def blfoot():
  1557. if STANCE == 0:
  1558. own['requestAction'] = 'reg_blfoot'
  1559. if STANCE == 1:
  1560. own['requestAction'] = 'fak_blfoot'
  1561. jump()
  1562. def flfoot():
  1563. if STANCE == 0:
  1564. own['requestAction'] = 'reg_flfoot'
  1565. if STANCE == 1:
  1566. own['requestAction'] = 'fak_flfoot'
  1567. jump()
  1568. def rollsound():
  1569. #onground
  1570. if r_ground.triggered == 1 and grindDar == 0 and own['invert_on'] == 0:
  1571. num1 = .05
  1572. num2 = .25
  1573. if linVelocity.x <= -num1 and linVelocity.x >= num1:
  1574. own.actuators["sroll"].volume = .0001
  1575. cont.deactivate(own.actuators["sroll"])
  1576. own.actuators["sroll"].stopSound()
  1577. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1578. own.actuators["sroll"].volume = .02
  1579. own.actuators["sroll"].pitch = .65
  1580. num1 = .25
  1581. num2 = .5
  1582. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1583. own.actuators["sroll"].volume = .03
  1584. own.actuators["sroll"].pitch = .7
  1585. num1 = .5
  1586. num2 = .75
  1587. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1588. own.actuators["sroll"].volume = .04
  1589. own.actuators["sroll"].pitch = .75
  1590. num1 = .75
  1591. num2 = 1
  1592. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1593. own.actuators["sroll"].volume = .05
  1594. own.actuators["sroll"].pitch = .8
  1595. num1 = 1
  1596. num2 = 1.5
  1597. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1598. own.actuators["sroll"].volume = .06
  1599. own.actuators["sroll"].pitch = .85
  1600. num1 = 1.5
  1601. num2 = 2
  1602. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1603. own.actuators["sroll"].volume = .07
  1604. own.actuators["sroll"].pitch = .9
  1605. num1 = 2
  1606. num2 = 3
  1607. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1608. own.actuators["sroll"].volume = .08
  1609. own.actuators["sroll"].pitch = .95
  1610. num1 = 3
  1611. num2 = 4
  1612. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1613. own.actuators["sroll"].volume = .09
  1614. own.actuators["sroll"].pitch = 1
  1615. num1 = 4
  1616. num2 = 5
  1617. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1618. own.actuators["sroll"].volume = .11
  1619. own.actuators["sroll"].pitch = 1.05
  1620. num1 = 5
  1621. num2 = 6
  1622. if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
  1623. own.actuators["sroll"].volume = .1
  1624. own.actuators["sroll"].pitch = 1.1
  1625. own.actuators['sroll'].mode = 2
  1626. cont.activate(own.actuators["sroll"])
  1627. if grindDar == 1 or own['invert_on'] == 1:
  1628. own.actuators["sroll"].volume = .0001
  1629. cont.deactivate(own.actuators["sroll"])
  1630. own.actuators["sroll"].stopSound()
  1631. #in air
  1632. if r_ground.triggered == False:
  1633. own.actuators["sroll"].volume = .0001
  1634. cont.deactivate(own.actuators["sroll"])
  1635. own.actuators["sroll"].stopSound()
  1636. act = cont.actuators["sroll"]
  1637. own['sroll_vol'] = act.volume
  1638. own['sroll_pitch'] = act.pitch
  1639. def wheelroll():
  1640. #still
  1641. if linVelocity.x <= -0.05 and linVelocity.x >= 0.05:
  1642. wheel1.stopAction(2)
  1643. wheel2.stopAction(2)
  1644. wheel3.stopAction(2)
  1645. wheel4.stopAction(2)
  1646. #regular
  1647. if linVelocity.x > 0.05 and linVelocity.x < .5:
  1648. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=0, speed=.25)
  1649. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=0, speed=.25)
  1650. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=0, speed=.25)
  1651. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=0, speed=.25)
  1652. if linVelocity.x > 0.5 and linVelocity.x < 1:
  1653. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1)
  1654. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1)
  1655. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1)
  1656. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1)
  1657. if linVelocity.x > 1 and linVelocity.x < 4:
  1658. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1659. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1660. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1661. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=1.5)
  1662. if linVelocity.x > 4:
  1663. wheel2.playAction("roll1.001", 1,20, layer=2, play_mode=1, speed=2)
  1664. wheel3.playAction("roll2.001", 1,20, layer=2, play_mode=1, speed=2)
  1665. wheel4.playAction("roll3.001", 1,20, layer=2, play_mode=1, speed=2)
  1666. wheel1.playAction("roll4.001", 1,20, layer=2, play_mode=1, speed=2)
  1667. #switch
  1668. if linVelocity.x < -0.05 and linVelocity.x > -.5:
  1669. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=0, speed=.25)
  1670. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=0, speed=.25)
  1671. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=0, speed=.25)
  1672. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=0, speed=.25)
  1673. if linVelocity.x < -0.5 and linVelocity.x > -1:
  1674. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1)
  1675. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1)
  1676. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1)
  1677. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1)
  1678. if linVelocity.x < -1 and linVelocity > -4:
  1679. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1680. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1681. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1682. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=1.5)
  1683. if linVelocity.x < -4:
  1684. wheel2.playAction("roll1.001", 20,1, layer=2, play_mode=1, speed=2)
  1685. wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
  1686. wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
  1687. wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=2)
  1688. def transspeed():
  1689. num1 = .1
  1690. num2 = .4
  1691. speed = 20
  1692. def turn():
  1693. rotamt = .02
  1694. linVelocity2 = own.getLinearVelocity(True)
  1695. speed = .004
  1696. manual = 0
  1697. if own['manual_v2'] == 1:
  1698. manual = 1
  1699. if abs(linVelocity.x) < 2:
  1700. speed = .005
  1701. jumpstance = own['jump_stance']
  1702. if lLR > turnsens or lLR < -turnsens:
  1703. own["turn"] = 1
  1704. else:
  1705. own["turn"] = 0
  1706. if lUD > turnsens or lUD < -turnsens:
  1707. own["turnud"] = 1
  1708. else:
  1709. own["turnud"] = 0
  1710. #light
  1711. #if manual and grindhit = true
  1712. if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1713. rotation = [ 0.0, 0.0, (-rotamt)]
  1714. local = False # use world axis
  1715. own.applyRotation( rotation, local)
  1716. if r_ground.triggered == True:
  1717. #print("light turn")
  1718. if STANCE == 0:
  1719. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1720. if STANCE == 1:
  1721. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1722. if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
  1723. rotation = [ 0.0, 0.0, rotamt]
  1724. local = False # use world axis
  1725. own.applyRotation( rotation, local)
  1726. if r_ground.triggered == True:
  1727. #print("light turn")
  1728. if STANCE == 0:
  1729. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1730. if STANCE == 1:
  1731. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1732. #medium
  1733. if (lLR > (turnsens * 1.3) or dict['kb_ra'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
  1734. #turn left
  1735. if rot.z < .4:
  1736. rotation = [ 0.0, 0.0, (-rotamt * 5)]
  1737. if rot.z < .6 and rot.z > .4:
  1738. rotation = [ 0.0, 0.0, (-rotamt * 2)]
  1739. else:
  1740. rotation = [ 0.0, 0.0, (-rotamt * 1.6)]
  1741. local = True # use world axis
  1742. own.applyRotation( rotation, local)
  1743. if r_ground.triggered == True:
  1744. #print("med turn")
  1745. if STANCE == 0:
  1746. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1747. if STANCE == 1:
  1748. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1749. if (lLR < (-turnsens * 1.3) or dict['kb_la'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
  1750. #turn right
  1751. if rot.z < .4:
  1752. rotation = [ 0.0, 0.0, (rotamt * 5)]
  1753. if rot.z < .6 and rot.z > .4:
  1754. rotation = [ 0.0, 0.0, (rotamt * 2)]
  1755. else:
  1756. rotation = [ 0.0, 0.0, (rotamt * 1.6)]
  1757. local = True # use world axis
  1758. own.applyRotation( rotation, local)
  1759. if r_ground.triggered == True:
  1760. #print("med turn")
  1761. if STANCE == 0:
  1762. own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
  1763. if STANCE == 1:
  1764. own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
  1765. #air
  1766. if r_ground.triggered == False and (lLR > turnsens or dict['kb_ra'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1767. rotamt = .07
  1768. if STANCE == 0:
  1769. own.applyRotation([0,0,-rotamt], 1)
  1770. if STANCE == 1:
  1771. own.applyRotation([0,0,-rotamt], 1)
  1772. if r_ground.triggered == False and (lLR < -turnsens or dict['kb_la'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
  1773. rotamt = .07
  1774. if STANCE == 0:
  1775. own.applyRotation([0,0,rotamt], 1)
  1776. if STANCE == 1:
  1777. own.applyRotation([0,0,rotamt], 1)
  1778. ###########
  1779. def grindsound():
  1780. dropin = own['dropinTimer']
  1781. lif = own['last_invert_frame']
  1782. if grindSound != None and grindHit == True and own['nogrindsound'] == 0:
  1783. if abs(linVelocity.x) > abs(linVelocity.y):
  1784. vel = linVelocity.x
  1785. elif abs(linVelocity.x) < abs(linVelocity.y):
  1786. vel = linVelocity.y
  1787. else:
  1788. vel = 0
  1789. if grindSound == "rail":
  1790. cont.deactivate(own.actuators['grind_cement'])
  1791. num1 = .000
  1792. num2 = .05
  1793. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1794. own.actuators["grind_rail"].volume = .0001
  1795. own.actuators["grind_rail"].pitch = .6
  1796. num1 = .05
  1797. num2 = .25
  1798. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1799. own.actuators["grind_rail"].volume = .05
  1800. own.actuators["grind_rail"].pitch = .7
  1801. num1 = .25
  1802. num2 = .5
  1803. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1804. own.actuators["grind_rail"].volume = .1
  1805. own.actuators["grind_rail"].pitch = .75
  1806. num1 = .5
  1807. num2 = .75
  1808. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1809. own.actuators["grind_rail"].volume = .14
  1810. own.actuators["grind_rail"].pitch = .8
  1811. num1 = .75
  1812. num2 = 1
  1813. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1814. own.actuators["grind_rail"].volume = .17
  1815. own.actuators["grind_rail"].pitch = .85
  1816. num1 = 1
  1817. num2 = 1.25
  1818. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1819. own.actuators["grind_rail"].volume = .18
  1820. own.actuators["grind_rail"].pitch = .9
  1821. num1 = 1.25
  1822. num2 = 2
  1823. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1824. own.actuators["grind_rail"].volume = .19
  1825. own.actuators["grind_rail"].pitch = .95
  1826. num1 = 2
  1827. num2 = 40
  1828. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1829. own.actuators["grind_rail"].volume = .19
  1830. own.actuators["grind_rail"].pitch = 1
  1831. cont.activate(own.actuators['grind_rail'])
  1832. if grindSound == "concrete":
  1833. #play sound
  1834. cont.deactivate(own.actuators['grind_rail'])
  1835. num1 = .000
  1836. num2 = .05
  1837. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1838. own.actuators["grind_cement"].volume = .01
  1839. own.actuators["grind_cement"].pitch = .6
  1840. num1 = .05
  1841. num2 = .25
  1842. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1843. own.actuators["grind_cement"].volume = .05
  1844. own.actuators["grind_cement"].pitch = .7
  1845. num1 = .25
  1846. num2 = .5
  1847. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1848. own.actuators["grind_cement"].volume = .1
  1849. own.actuators["grind_cement"].pitch = .75
  1850. num1 = .5
  1851. num2 = .75
  1852. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1853. own.actuators["grind_cement"].volume = .14
  1854. own.actuators["grind_cement"].pitch = .8
  1855. num1 = .75
  1856. num2 = 1
  1857. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1858. own.actuators["grind_cement"].volume = .17
  1859. own.actuators["grind_cement"].pitch = .85
  1860. num1 = 1
  1861. num2 = 1.25
  1862. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1863. own.actuators["grind_cement"].volume = .18
  1864. own.actuators["grind_cement"].pitch = .9
  1865. num1 = 1.25
  1866. num2 = 2
  1867. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1868. own.actuators["grind_cement"].volume = .19
  1869. own.actuators["grind_cement"].pitch = .95
  1870. num1 = 2
  1871. num2 = 40
  1872. if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
  1873. own.actuators["grind_cement"].volume = .19
  1874. own.actuators["grind_cement"].pitch = 1
  1875. cont.activate(own.actuators['grind_cement'])
  1876. else:
  1877. cont.deactivate(own.actuators['grind_cement'])
  1878. cont.deactivate(own.actuators['grind_rail'])
  1879. def record_grindsound():
  1880. dropin = own['dropinTimer']
  1881. lif = own['last_invert_frame']
  1882. if grindHit == True and dropin == 0 and own['invert_on'] == 0 and own["LAST_GRIND"] == True and own["nogrindsound"] == 0 and (frame - lif > 13):
  1883. if grindSound == "concrete":
  1884. act = own.actuators["grind_cement"]
  1885. own['grindcement_vol'] = act.volume
  1886. own['grindcement_pitch'] = act.pitch
  1887. elif grindSound == "rail":
  1888. act = own.actuators["grind_rail"]
  1889. own['grindrail_vol'] = act.volume
  1890. own['grindrail_pitch'] = act.pitch
  1891. if own["LAST_GRIND"] == False:
  1892. own['grindcement_vol'] = 0
  1893. own['grindcement_pitch'] = 0
  1894. own['grindrail_vol'] = 0
  1895. own['grindrail_pitch'] = 0
  1896. def grind():
  1897. grindsound()
  1898. STANCE = own["stance"]
  1899. jumpstance = own["jump_stance"]
  1900. lif = frame - own['last_invert_frame']
  1901. giniter = 0
  1902. if own['LAST_GRIND'] == False and grindHit == True:
  1903. own['grindstartFrame'] = own['framenum']
  1904. giniter = 1
  1905. if grindHit == True and own['invert_on'] == 0 and own['footplant_on'] == False and own['manual'] == 0 and lif > 40 and own['dropinTimer'] < 30 and giniter == 0:
  1906. control_bottom = scene.objects['control_bottom']
  1907. grindTouch = control_bottom.sensors['grindCol_bottom']
  1908. edge = 0
  1909. try:
  1910. if 'edge' in grindTouch.hitObject:
  1911. #print('Edge')
  1912. edge = 1
  1913. except:
  1914. pass
  1915. gblend = 1
  1916. if LAST_GRIND == 0:
  1917. gt = own['grindType']
  1918. tempstance = 3
  1919. if jumpstance != 3:
  1920. tempstance = jumpstance
  1921. else:
  1922. tempstance = STANCE
  1923. grindpos = own['grindpos']
  1924. if grindpos == "reg_5050" and own['grindType'] == "empty":
  1925. own['grindType'] = grindpos
  1926. if own['grindType'] == "empty" and grindpos == 'reg_board':
  1927. if STANCE == 0:
  1928. own['grindType'] = "reg_bsboard"
  1929. else:
  1930. own['grindType'] = "fak_bsboard"
  1931. if STANCE == True:
  1932. if own['grindType'] == "reg_bsboard":
  1933. own['grind_stance'] = 0
  1934. own['requestAction'] = 'reg_bsboard'
  1935. elif own['grindType'] == "fak_bsboard":
  1936. own['grind_stance'] = 1
  1937. own['requestAction'] = 'fak_bsboard'
  1938. elif own['grindType'] == "reg_fsboard":
  1939. own['grind_stance'] = 0
  1940. own['requestAction'] = 'reg_fsboard'
  1941. elif own['grindType'] == "fak_noseg":
  1942. own['requestAction'] = 'fak_noseg'
  1943. elif own['grindType'] == "fak_nosegR":
  1944. own['requestAction'] = 'fak_nosegr'
  1945. elif own['grindType'] == "fak_nosegL":
  1946. own['requestAction'] = 'fak_nosegl'
  1947. elif own['grindType'] == "fak_tailg":
  1948. own['requestAction'] = 'fak_tailg'
  1949. elif own['grindType'] == "fak_tailgR":
  1950. own['requestAction'] = 'fak_tailgr'
  1951. elif own['grindType'] == "fak_tailgL":
  1952. own['requestAction'] = 'fak_tailgl'
  1953. elif own['grindType'] == "reg_tailg":
  1954. own['requestAction'] = 'fak_noseg'
  1955. elif own['grindType'] == "reg_tailgR":
  1956. own['requestAction'] = 'fak_nosegr'
  1957. elif own['grindType'] == "reg_tailgL":
  1958. own['requestAction'] = 'fak_nosegl'
  1959. elif own['grindType'] == "reg_noseg":
  1960. own['requestAction'] = 'fak_tailg'
  1961. elif own['grindType'] == "reg_nosegR":
  1962. own['requestAction'] = 'fak_tailgr'
  1963. elif own['grindType'] == "reg_nosegL":
  1964. own['requestAction'] = 'fak_tailgl'
  1965. elif own['grindType'] == "reg_tailslide":
  1966. own['requestAction'] = 'reg_tailslide'
  1967. elif own['grindType'] == "reg_noseslide":
  1968. own['requestAction'] = 'reg_noseslide'
  1969. elif own['grindType'] == "fak_tailslide":
  1970. own['requestAction'] = 'fak_tailslide'
  1971. elif own['grindType'] == "fak_noseslide":
  1972. own['requestAction'] = 'fak_noseslide'
  1973. elif own['grindType'] == "reg_tailslide" and edge == 1:
  1974. own['requestAction'] = 'fak_noseslide'
  1975. STANCE = 0
  1976. elif own['grindType'] == "fak_tailslide":
  1977. own['requestAction'] = 'fak_tailslide'
  1978. own['grind_stance'] = 1
  1979. elif own['grindType'] == "reg_noseslide" and edge == 1:
  1980. own['requestAction'] = 'fak_tailslide'
  1981. own['grind_stance'] = 0
  1982. elif own['grindType'] == "fak_noseslide":
  1983. own['requestAction'] = 'fak_noseslide'
  1984. own['grind_stance'] = 1
  1985. else:
  1986. if STANCE == 0:
  1987. own['requestAction'] = 'reg_5050'
  1988. dict['trick_string'] = '5050'
  1989. if STANCE == 1:
  1990. own['requestAction'] = 'fak_5050'
  1991. dict['trick_string'] = '5050'
  1992. elif STANCE == False:
  1993. if own['grindType'] == "reg_bsboard":
  1994. own['grind_stance'] = 0
  1995. own['requestAction'] = 'reg_bsboard'
  1996. elif own['grindType'] == "fak_bsboard":
  1997. own['grind_stance'] = 1
  1998. own['requestAction'] = 'fak_bsboard'
  1999. elif own['grindType'] == "reg_tailg":
  2000. own['grind_stance'] = 0
  2001. own['requestAction'] = 'reg_tailg'
  2002. elif own['grindType'] == "reg_tailgR":
  2003. own['requestAction'] = 'reg_tailgr'
  2004. elif own['grindType'] == "reg_tailgL":
  2005. own['requestAction'] = 'reg_tailgl'
  2006. elif own['grindType'] == "reg_noseg":
  2007. own['requestAction'] = 'reg_noseg'
  2008. elif own['grindType'] == "reg_nosegR":
  2009. own['requestAction'] = 'reg_nosegr'
  2010. elif own['grindType'] == "reg_nosegL":
  2011. own['requestAction'] = 'reg_nosegl'
  2012. elif own['grindType'] == "reg_tailslide":
  2013. own['requestAction'] = 'reg_tailslide'
  2014. elif own['grindType'] == "reg_noseslide":
  2015. own['requestAction'] = 'reg_noseslide'
  2016. elif own['grindType'] == "fak_tailslide":
  2017. own['requestAction'] = 'fak_tailslide'
  2018. elif own['grindType'] == "fak_noseslide":
  2019. own['requestAction'] = 'fak_noseslide'
  2020. elif own['grindType'] == "fak_noseg":
  2021. own['requestAction'] = 'reg_tailg'
  2022. elif own['grindType'] == "fak_nosegR":
  2023. own['requestAction'] = 'reg_tailgr'
  2024. elif own['grindType'] == "fak_nosegL":
  2025. own['requestAction'] = 'reg_tailgl'
  2026. elif own['grindType'] == "fak_tailg":
  2027. own['requestAction'] = 'reg_noseg'
  2028. elif own['grindType'] == "fak_tailgR":
  2029. own['requestAction'] = 'reg_nosegr'
  2030. elif own['grindType'] == "fak_tailgL":
  2031. own['requestAction'] = 'reg_nosegl'
  2032. elif own['grindType'] == "fak_tailslide" and edge == 1:
  2033. own['grind_stance'] = 1
  2034. own['requestAction'] = 'reg_noseslide'
  2035. elif own['grindType'] == "reg_noseslide":
  2036. own['grind_stance'] = 0
  2037. own['requestAction'] = 'reg_noseslide'
  2038. elif own['grindType'] == "fak_noseslide" and edge == 1:
  2039. own['grind_stance'] = 1
  2040. own['requestAction'] = 'reg_tailslide'
  2041. else:
  2042. if STANCE == 0:
  2043. own['requestAction'] = 'reg_5050'
  2044. if STANCE == 1:
  2045. own['requestAction'] = 'fak_5050'
  2046. if 'fak' in own['l_actionState']:
  2047. STANCE = 1
  2048. own['lg_stance'] = 1
  2049. lg_stance = 1
  2050. if 'reg' in own['l_actionState']:
  2051. STANCE = 0
  2052. own['lg_stance'] = 0
  2053. lg_stance = 0
  2054. own['stance'] = STANCE
  2055. def rotmult():
  2056. if r_ground.triggered:
  2057. num = ((rot.z * -1) +1)
  2058. num = num * 100
  2059. def airup():
  2060. if r_ground.triggered == False:
  2061. pos = own.worldPosition
  2062. pos = own.worldPosition.z
  2063. last_pos = own['last_posz']
  2064. if last_pos - pos > 0:
  2065. own['airup'] = 0
  2066. if last_pos - pos < 0:
  2067. own['airup'] = 1
  2068. if pos > own['last_posz']:
  2069. own["air_height"] = pos
  2070. own['last_posz'] = pos
  2071. else:
  2072. own['airup'] = 0
  2073. def onramp():
  2074. if r_ground.positive:
  2075. if 'ramp' in r_ground.hitObject:
  2076. own['onramp'] = 60
  2077. own['last_ramp'] = frame
  2078. own['no_grind_timer'] = 60
  2079. #print('on ramp')
  2080. else:
  2081. own['onramp'] = 0
  2082. else:
  2083. if own['onramp'] > 0:
  2084. own['onramp'] -= 1
  2085. def grindtype(gtype):
  2086. own['grindType'] = gtype
  2087. def transmult():
  2088. lastrotz = own["rotz"]
  2089. linvel = own.getLinearVelocity(True)
  2090. newx = (linvel.x + (linvel.x * .039))
  2091. if linvel.x < 7 and linvel.x > -7 and rot.z > lastrotz and r_ground.triggered == 1 and rot.z > .3 and rot.z < .93:
  2092. own.setLinearVelocity([newx, linvel.y, linvel.z], True)
  2093. def speedmult():
  2094. vel = own.getLinearVelocity(True)
  2095. xyz = own.worldOrientation.to_euler()
  2096. roty = math.degrees(xyz[1])
  2097. roty = abs(roty)
  2098. roty = roty * .0005
  2099. if abs(vel.x) > 1:
  2100. mult = .0015 + roty
  2101. else:
  2102. mult = .000
  2103. mult2 = .018
  2104. mult3 = .007
  2105. lastrotz = own["rotz"]
  2106. x = vel.x * mult
  2107. x2 = x + vel.x
  2108. x3 = vel.x * mult2
  2109. x4 = x3 + vel.x
  2110. x5 = vel.x * mult3
  2111. x6 = x5 + vel.x
  2112. if r_ground.triggered and vel.x < 4 and vel.x > -4:
  2113. own.setLinearVelocity([x2, vel.y, vel.z], True)
  2114. def coping():
  2115. if invertTouch.positive:
  2116. own["coping"] = 1
  2117. else:
  2118. own["coping"] = 0
  2119. def onboard():
  2120. if own['walk'] == 1 and own['lasty'] == False and own['requestAction'] not in ['reg_dropin', 'fak_dropin']:
  2121. cont.deactivate(cam.actuators['replayCam'])
  2122. cont.activate(cam.actuators['Camera'])
  2123. killall()
  2124. walklay = 40
  2125. ob_speed = .5
  2126. if STANCE == 0:
  2127. killall()
  2128. if own['dropinCol'] == True:
  2129. own['requestAction'] = 'reg_dropin'
  2130. own['dropinTimer'] = 60
  2131. else:
  2132. own['requestAction'] = 'reg_onboard'
  2133. force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
  2134. if own['dropinTimer'] == 0:
  2135. own.setLinearVelocity(force, True)
  2136. if STANCE == 1:
  2137. killall()
  2138. if own['dropinCol'] == True:
  2139. own['requestAction'] = 'fak_dropin'
  2140. own['dropinTimer'] = 60
  2141. else:
  2142. own['requestAction'] = 'fak_onboard'
  2143. force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
  2144. if own['dropinTimer'] == 0:
  2145. own.setLinearVelocity(force, True)
  2146. else:
  2147. num = own['dropinTimer']
  2148. if num > 0:
  2149. num = num - 1
  2150. own['dropinTimer'] = num
  2151. def offboard():
  2152. wheel1.stopAction(2)
  2153. wheel2.stopAction(2)
  2154. wheel3.stopAction(2)
  2155. wheel4.stopAction(2)
  2156. cont.deactivate(own.actuators["sroll"])
  2157. sact = own.actuators["sroll"]
  2158. sact.volume = .0001
  2159. own.actuators["sroll"].stopSound()
  2160. own['offboard_vel'] = own.linearVelocity
  2161. own['walk_timer'] = 0
  2162. def resetjumpstance():
  2163. if LAST_GRIND == True and grindHit == False:
  2164. own["lF_ground_frame"] = own['framenum']
  2165. lfg = own["lF_ground_frame"]
  2166. #print(lfg, "----- this?")
  2167. if own['jump_stance'] != 3:
  2168. own['jump_stance'] = 3
  2169. def grass():
  2170. try:
  2171. if 'grass' in r_ground.hitObject:
  2172. linVel = own.getLinearVelocity(True)
  2173. linvelx = linVel.x * .98
  2174. own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
  2175. except:
  2176. pass
  2177. def grindoutair():
  2178. skippy = 0
  2179. linVel = own.getLinearVelocity(True)
  2180. STANCE = own['stance']
  2181. if own['LAST_GRIND'] == True and grindHit == True:
  2182. own['lg_stance'] = STANCE
  2183. lg_stance = own['lg_stance']
  2184. own.actuators["grindoutair"].useLocalLinV = True
  2185. if own['grindjumpturn'] == True and own['grindCountdown'] > 12 and skippy == 0:
  2186. if 'fak' in own['l_actionState']:
  2187. STANCE = 1
  2188. own['lg_stance'] = 1
  2189. lg_stance = 1
  2190. #print('changing stance 1')
  2191. if 'reg' in own['l_actionState']:
  2192. STANCE = 0
  2193. own['lg_stance'] = 0
  2194. lg_stance = 0
  2195. #print('changing stance 0')
  2196. own['stance'] = STANCE
  2197. grindoutspeed = .1
  2198. grindoutspeed2 = 5.4
  2199. if lLR > turnsens:
  2200. if own['last_grindpos'] == 'reg_5050':
  2201. if STANCE == 0:
  2202. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2203. else:
  2204. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2205. cont.activate(own.actuators["grindoutair"])
  2206. if lLR < -turnsens:
  2207. if own['last_grindpos'] == 'reg_5050':
  2208. if STANCE == 0:
  2209. own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
  2210. else:
  2211. own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
  2212. cont.activate(own.actuators["grindoutair"])
  2213. if lUD > turnsens:
  2214. js = own['lg_stance']
  2215. linvelx = own.getLinearVelocity(True)
  2216. if own['last_grindpos'] == 'reg_board':
  2217. if js == 1:
  2218. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2219. cont.activate(own.actuators["grindoutair"])
  2220. else:
  2221. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2222. cont.activate(own.actuators["grindoutair"])
  2223. if lUD < -turnsens:
  2224. js = own['lg_stance']
  2225. if own['last_grindpos'] == 'reg_board':
  2226. if js == 0:
  2227. own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
  2228. cont.activate(own.actuators["grindoutair"])
  2229. else:
  2230. own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
  2231. cont.activate(own.actuators["grindoutair"])
  2232. if LAST_GRIND == False and r_ground.triggered and own['grindjumpturn'] == True and own['grindCountdown'] < 1:
  2233. own['grindjumpturn'] = False
  2234. if r_ground.triggered:
  2235. own['grind_jump'] = False
  2236. if own['grindjumpturn'] == False or own['grindCountdown'] < 19:
  2237. cont.deactivate(own.actuators["grindoutair"])
  2238. #print(STANCE)
  2239. def set_last_grindpos():
  2240. if own['grindpos'] != None:
  2241. own['last_grindpos'] = own['grindpos']
  2242. def air_pos():
  2243. grindpos = own['grindpos']
  2244. GRAB_ON = own["GRAB_ON"]
  2245. wr = own["wallride"]
  2246. jump_timer = own['jump_timer']
  2247. if rUD > .040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 30:
  2248. if STANCE == 0:
  2249. own['requestAction'] = 'reg_air_tail'
  2250. else:
  2251. own['requestAction'] = 'fak_air_tail'
  2252. elif rUD < -.040 and r_ground.triggered == False and GRAB_ON == False and wr == None and jump_timer < 30:
  2253. if STANCE == 0:
  2254. own['requestAction'] = 'reg_air_nose'
  2255. else:
  2256. own['requestAction'] = 'fak_air_nose'
  2257. def air_turn_boost():
  2258. pass
  2259. def revert():
  2260. own["Q3oncdl"] = 0
  2261. own["Q4oncdl"] = 0
  2262. own["Q5oncdl"] = 0
  2263. own["Q6oncdl"] = 0
  2264. own["Q7oncdl"] = 0
  2265. local = True
  2266. rot = [ 0.0, 0.0, 3.14]
  2267. own.applyRotation(rot,local)
  2268. framenum = own['framenum']
  2269. last_ground_frame = own['lF_ground_frame']
  2270. lF_air_frame = own['lF_air_frame']
  2271. frames_since_ground = framenum - lF_air_frame
  2272. if own['manual_v2_type'] == 'reg manual':
  2273. own['requestAction'] = 'reg_manual_revert_ccw'
  2274. elif own['manual_v2_type'] == 'reg nose manual':
  2275. own['requestAction'] = 'reg_nmanual_revert_ccw'
  2276. elif own['manual_v2_type'] == 'fak manual':
  2277. own['requestAction'] = 'fak_manual_revert_ccw'
  2278. elif own['manual_v2_type'] == 'fak nose manual':
  2279. own['requestAction'] = 'fak_nmanual_revert_ccw'
  2280. else:
  2281. if STANCE == 0:
  2282. own['requestAction'] = 'revert1'
  2283. else:
  2284. own['requestAction'] = 'fak_revert1'
  2285. own['revert_timer'] = 20
  2286. cont.activate(own.actuators["revertSound"])
  2287. own['revert_sound'] = 1
  2288. dict['trick_string'] = 'Revert'
  2289. def revert2():
  2290. own["Q3oncdl"] = 0
  2291. own["Q4oncdl"] = 0
  2292. own["Q5oncdl"] = 0
  2293. own["Q6oncdl"] = 0
  2294. own["Q7oncdl"] = 0
  2295. local = True
  2296. rot = [ 0.0, 0.0, -3.14]
  2297. own.applyRotation(rot,local)
  2298. if own['manual_v2_type'] == 'reg manual':
  2299. own['requestAction'] = 'reg_manual_revert_cw'
  2300. elif own['manual_v2_type'] == 'reg nose manual':
  2301. own['requestAction'] = 'reg_nmanual_revert_cw'
  2302. elif own['manual_v2_type'] == 'fak manual':
  2303. own['requestAction'] = 'fak_manual_revert_cw'
  2304. elif own['manual_v2_type'] == 'fak nose manual':
  2305. own['requestAction'] = 'fak_nmanual_revert_cw'
  2306. else:
  2307. if STANCE == 0:
  2308. own['requestAction'] = 'revert2'
  2309. else:
  2310. own['requestAction'] = 'fak_revert2'
  2311. own['revert_timer'] = 20
  2312. cont.activate(own.actuators["revertSound"])
  2313. own['revert_sound'] = 1
  2314. dict['trick_string'] = 'Revert'
  2315. def revert3():
  2316. own["Q7oncdl"] = 0
  2317. own["Q8oncdl"] = 0
  2318. own["Q1oncdl"] = 0
  2319. own["Q2oncdl"] = 0
  2320. own["Q3oncdl"] = 0
  2321. local = True
  2322. rot = [ 0.0, 0.0, 3.14]
  2323. own.applyRotation(rot,local)
  2324. if own['manual_v2_type'] == 'reg manual':
  2325. own['requestAction'] = 'reg_manual_revert_ccw'
  2326. elif own['manual_v2_type'] == 'reg nose manual':
  2327. own['requestAction'] = 'reg_nmanual_revert_ccw'
  2328. elif own['manual_v2_type'] == 'fak manual':
  2329. own['requestAction'] = 'fak_manual_revert_ccw'
  2330. elif own['manual_v2_type'] == 'fak nose manual':
  2331. own['requestAction'] = 'fak_nmanual_revert_ccw'
  2332. else:
  2333. if STANCE == 0:
  2334. own['requestAction'] = 'revert3'
  2335. else:
  2336. own['requestAction'] = 'fak_revert1'
  2337. own['revert_timer'] = 20
  2338. cont.activate(own.actuators["revertSound"])
  2339. own['revert_sound'] = 1
  2340. dict['trick_string'] = 'Revert'
  2341. def revert4():
  2342. own["Q7oncdl"] = 0
  2343. own["Q8oncdl"] = 0
  2344. own["Q1oncdl"] = 0
  2345. own["Q2oncdl"] = 0
  2346. own["Q3oncdl"] = 0
  2347. local = True
  2348. rot = [ 0.0, 0.0, 3.14]
  2349. own.applyRotation(rot,local)
  2350. if own['manual_v2_type'] == 'reg manual':
  2351. own['requestAction'] = 'reg_manual_revert_cw'
  2352. elif own['manual_v2_type'] == 'reg nose manual':
  2353. own['requestAction'] = 'reg_nmanual_revert_cw'
  2354. elif own['manual_v2_type'] == 'fak manual':
  2355. own['requestAction'] = 'fak_manual_revert_cw'
  2356. elif own['manual_v2_type'] == 'fak nose manual':
  2357. own['requestAction'] = 'fak_nmanual_revert_cw'
  2358. else:
  2359. if STANCE == 0:
  2360. own['requestAction'] = 'revert4'
  2361. else:
  2362. own['requestAction'] = 'fak_revert2'
  2363. own['revert_timer'] = 20
  2364. cont.activate(own.actuators["revertSound"])
  2365. own['revert_sound'] = 1
  2366. dict['trick_string'] = 'Revert'
  2367. def powerslide():
  2368. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2369. since_walk = own['framenum'] - own['last_walk_frame']
  2370. since_grind = own['framenum'] - own['last_grind_frame']
  2371. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 40:
  2372. own['powerslide_on'] = 1
  2373. if STANCE == 0:
  2374. own['powerslide'] = "reg2"
  2375. if STANCE == 1:
  2376. own['powerslide'] = "fak1"
  2377. linVelocity4 = own.getLinearVelocity(True)
  2378. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2379. newx = linVelocity4.x * .9
  2380. else:
  2381. newx = linVelocity4.x * .98
  2382. force = [newx, linVelocity4.y, linVelocity4.z]
  2383. own.setLinearVelocity(force, True)
  2384. def powerslide2():
  2385. own['powerslide_counter'] = own['powerslide_counter'] + 1
  2386. since_walk = own['framenum'] - own['last_walk_frame']
  2387. since_grind = own['framenum'] - own['last_grind_frame']
  2388. if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 100:
  2389. own['powerslide_on'] = 1
  2390. if STANCE == 0:
  2391. own['powerslide'] = "reg1"
  2392. if STANCE == 1:
  2393. own['powerslide'] = "fak2"
  2394. linVelocity4 = own.getLinearVelocity(True)
  2395. if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
  2396. newx = linVelocity4.x * .9
  2397. else:
  2398. newx = linVelocity4.x * .98
  2399. force = [newx, linVelocity4.y, linVelocity4.z]
  2400. own.setLinearVelocity(force, True)
  2401. def powerslide_state():
  2402. if own['powerslide_on'] == 1:
  2403. if own['powerslide'] == "reg2":
  2404. own['requestAction'] = 'reg_fs_powerslide'
  2405. if own['powerslide'] == "fak1":
  2406. own['requestAction'] = 'fak_fs_powerslide'
  2407. if own['powerslide'] == "reg1":
  2408. own['requestAction'] = 'reg_powerslide'
  2409. if own['powerslide'] == "fak2":
  2410. own['requestAction'] = 'fak_powerslide'
  2411. def powerslide_sound():
  2412. sact = own.actuators["powerslide_sound"]
  2413. if own['powerslide_on'] == 1:
  2414. sact = own.actuators["powerslide_sound"]
  2415. sact.volume = .2
  2416. new_pitch = (abs(linVelocity.x) / 3)
  2417. if new_pitch < 1.1 and new_pitch > .5:
  2418. sact.pitch = new_pitch
  2419. elif new_pitch <= .5:
  2420. sact.pitch = .5
  2421. else:
  2422. sact.pitch = 1.1
  2423. cont.activate(own.actuators["powerslide_sound"])
  2424. else:
  2425. sact.volume = .0
  2426. cont.deactivate(own.actuators["powerslide_sound"])
  2427. def check_powerslide():
  2428. try:
  2429. own['last_powerslide_on'] = own['powerslide_on']
  2430. except:
  2431. pass
  2432. psxvel = abs(linVelocity.x)
  2433. if (lUD > .08 or lUD < -.08) and own['manual_v2'] == False and r_ground.triggered == True and psxvel > .1 and own["Pump"] == False:
  2434. if lUD > .08:
  2435. powerslide()
  2436. else:
  2437. powerslide2()
  2438. else:
  2439. own['powerslide_on'] = 0
  2440. own['powerslide_counter'] = 0
  2441. if own['last_powerslide_on'] == 0:
  2442. own['powerslide'] = None
  2443. def killopos():
  2444. pass
  2445. stopAnims()
  2446. #nextframe()
  2447. air()
  2448. stance()
  2449. turn()
  2450. rotmult()
  2451. airup()
  2452. onramp()
  2453. speedmult()
  2454. coping()
  2455. resetjumpstance()
  2456. grass()
  2457. grindoutair()
  2458. set_last_grindpos()
  2459. air_pos()
  2460. air_turn_boost()
  2461. record_grindsound()
  2462. check_powerslide()
  2463. powerslide_state()
  2464. powerslide_sound()
  2465. killopos()
  2466. grind()
  2467. #onboard()
  2468. ##################
  2469. ###realcontrols###
  2470. ##################
  2471. # q1
  2472. # q8 q2
  2473. # q7 q3
  2474. # q6 q4
  2475. # q5
  2476. ##################
  2477. #lq6
  2478. if lUD > .04 and lLR < -0.04 :
  2479. lq6on = 1
  2480. q6oncdl = countdown
  2481. own["Q6oncdl"] = q6oncdl
  2482. elif q6oncdl > 0:
  2483. lq6on = 0
  2484. q6oncdl = q6oncdl - 1
  2485. own["Q6oncdl"] = q6oncdl
  2486. #lq8
  2487. if lUD < -.04 and lLR < -0.04 :
  2488. lq8on = 1
  2489. q8oncdl = countdown
  2490. own["Q8oncdl"] = q8oncdl
  2491. elif q8oncdl > 0:
  2492. lq8on = 0
  2493. q8oncdl = q8oncdl - 1
  2494. own["Q8oncdl"] = q8oncdl
  2495. #lq2
  2496. if lUD < -.04 and lLR > 0.04 :
  2497. lq2on = 1
  2498. q2oncdl = countdown
  2499. own["Q2oncdl"] = q2oncdl
  2500. elif q2oncdl > 0:
  2501. lq2on = 0
  2502. q2oncdl = q2oncdl - 1
  2503. own["Q2oncdl"] = q2oncdl
  2504. #q4
  2505. if lUD > 0.04 and lLR > 0.04 :
  2506. lq4on = 1
  2507. q4oncdl = countdown
  2508. own["Q4oncdl"] = q4oncdl
  2509. elif q4oncdl > 0:
  2510. lq4on = 0
  2511. q4oncdl = q4oncdl - 1
  2512. own["Q4oncdl"] = q4oncdl
  2513. #q5
  2514. if lUD > .070 and lq4on == 0 and lq6on == 0:
  2515. lq5on = 1
  2516. q5oncdl = countdown
  2517. own["Q5oncdl"] = q5oncdl
  2518. elif q5oncdl > 0:
  2519. lq5on = 0
  2520. q5oncdl = q5oncdl - 1
  2521. own["Q5oncdl"] = q5oncdl
  2522. #q1
  2523. if lUD < -0.070 and lq8on !=1 and lq2on != 1:
  2524. lq1on = 1
  2525. q1oncdl = countdown
  2526. own["Q1oncdl"] = q1oncdl
  2527. elif q1oncdl > 0:
  2528. lq1on = 0
  2529. q1oncdl = q1oncdl - 1
  2530. own["Q1oncdl"] = q1oncdl
  2531. #q7
  2532. if lLR < -0.070 and lq8on != 1 and lq6on != 1:
  2533. lq7on = 1
  2534. q7oncdl = countdown
  2535. own["Q7oncdl"] = q7oncdl
  2536. elif q7oncdl > 0:
  2537. lq7on = 0
  2538. q7oncdl = q7oncdl - 1
  2539. own["Q7oncdl"] = q7oncdl
  2540. #q3
  2541. if lLR > 0.070 and lq2on !=1 and lq4on != 1:
  2542. lq3on = 1
  2543. q3oncdl = countdown
  2544. own["Q3oncdl"] = q3oncdl
  2545. elif q3oncdl > 0:
  2546. lq3on = 0
  2547. q3oncdl = q3oncdl - 1
  2548. own["Q3oncdl"] = q3oncdl
  2549. own['set_revert_timer'] = 0
  2550. ground_since = own["framenum"] - own['lF_air_frame']
  2551. if ground_since > 80 and frames_since_grinding > 40:
  2552. if q3oncdl < q4oncdl < q5oncdl < q6oncdl < q7oncdl:
  2553. if r_ground.triggered == True:
  2554. revert()
  2555. own['set_revert_timer'] = 1
  2556. if q3oncdl > q4oncdl > q5oncdl > q6oncdl > q7oncdl:
  2557. if r_ground.triggered == True:
  2558. revert2()
  2559. own['set_revert_timer'] = 1
  2560. if q7oncdl < q8oncdl < q1oncdl < q2oncdl < q3oncdl:
  2561. if r_ground.triggered == True:
  2562. revert3()
  2563. own['set_revert_timer'] = 1
  2564. if q7oncdl > q8oncdl > q1oncdl > q2oncdl > q3oncdl:
  2565. if r_ground.triggered == True:
  2566. revert4()
  2567. own['set_revert_timer'] = 1
  2568. ################
  2569. #q6
  2570. if rUD > .04 and rLR < -0.04 :
  2571. q6on = 1
  2572. q6oncd = countdown
  2573. own["Q6oncd"] = q6oncd
  2574. #print("q6on")
  2575. elif q6oncd > 0:
  2576. q6on = 0
  2577. q6oncd = q6oncd - 1
  2578. own["Q6oncd"] = q6oncd
  2579. #q8
  2580. if rUD < -.04 and rLR < -0.04 :
  2581. q8on = 1
  2582. q8oncd = countdown
  2583. own["Q8oncd"] = q8oncd
  2584. #print("q8on")
  2585. elif q8oncd > 0:
  2586. q8on = 0
  2587. q8oncd = q8oncd - 1
  2588. own["Q8oncd"] = q8oncd
  2589. #q2
  2590. if rUD < -.04 and rLR > 0.04 :
  2591. q2on = 1
  2592. q2oncd = countdown
  2593. own["Q2oncd"] = q2oncd
  2594. #print("q2on")
  2595. elif q2oncd > 0:
  2596. q2on = 0
  2597. q2oncd = q2oncd - 1
  2598. own["Q2oncd"] = q2oncd
  2599. #q4
  2600. if rUD > 0.04 and rLR > 0.04 :
  2601. q4on = 1
  2602. q4oncd = countdown
  2603. own["Q4oncd"] = q4oncd
  2604. #print("q4on")
  2605. elif q4oncd > 0:
  2606. q4on = 0
  2607. q4oncd = q4oncd - 1
  2608. own["Q4oncd"] = q4oncd
  2609. #q5
  2610. if rUD > .070 or dict['kb_space'] == 2:
  2611. if q4on == 0 and q6on == 0:
  2612. #print("q5on")
  2613. q5on = 1
  2614. q5oncd = countdown
  2615. own["Q5oncd"] = q5oncd
  2616. oposin()
  2617. #print('oposin')
  2618. ground_since = own["framenum"] - own['lF_air_frame']
  2619. if ((rTrig > 0.02 or dict['kb_lsh'] == 2) and GRAB_ON == False and r_ground.triggered == 1) or (lTrig > 0.02 and GRAB_ON == False and r_ground.triggered == 1) and ground_since > 10:
  2620. pump()
  2621. else:
  2622. own["lastPump"] = False
  2623. own["Pump"] = False
  2624. own['jump_stance'] = STANCE
  2625. if rUD > .02 and grindHit == True:
  2626. grindpos = own['grindpos']
  2627. jumpstance = own["jump_stance"]
  2628. if LAST_GRIND == False:
  2629. if grindpos == "reg_stall":
  2630. grindtype("nose_stall") #change
  2631. elif grindpos == "fak_stall":
  2632. grindtype("nose_stall")
  2633. elif grindpos == "reg_5050":
  2634. if jumpstance != 3:
  2635. if jumpstance == 0:
  2636. if rLR > .03:
  2637. grindtype("reg_tailgR")
  2638. elif rLR < -.03:
  2639. grindtype("reg_tailgL")
  2640. else:
  2641. grindtype("reg_tailg")
  2642. if jumpstance == 1:
  2643. if rLR > .03:
  2644. grindtype("fak_tailgR")
  2645. elif rLR < -.03:
  2646. grindtype("fak_tailgL")
  2647. else:
  2648. grindtype("fak_tailg")
  2649. else:
  2650. if STANCE == 0:
  2651. if rLR > .03:
  2652. grindtype("reg_tailgR")
  2653. elif rLR < -.03:
  2654. grindtype("reg_tailgL")
  2655. else:
  2656. grindtype("reg_tailg")
  2657. if STANCE == 1:
  2658. grindtype("fak_tailg")
  2659. elif grindpos == "reg_board":
  2660. if jumpstance != 3:
  2661. if jumpstance == 0:
  2662. grindtype("reg_tailslide")
  2663. if jumpstance == 1:
  2664. grindtype("fak_tailslide")
  2665. STANCE = jumpstance
  2666. own['stance'] = STANCE
  2667. else:
  2668. if STANCE == 0:
  2669. grindtype("reg_tailslide")
  2670. if STANCE == 1:
  2671. grindtype("fak_tailslide")
  2672. else:
  2673. if jumpstance == 0:
  2674. grindtype("reg_tailg")
  2675. if jumpstance == 1:
  2676. grindtype("fak_tailg")
  2677. if q5oncd > 0:
  2678. q5on = 0
  2679. q5oncd = q5oncd - 1
  2680. own["Q5oncd"] = q5oncd
  2681. own["last_Opos"] = False
  2682. #q1
  2683. if rUD < -0.070:
  2684. if q2on == 0 and q8on == 0:
  2685. #print("q1on")
  2686. q1on = 1
  2687. q1oncd = countdown
  2688. own["Q1oncd"] = q1oncd
  2689. noposin()
  2690. if rUD < -0.020 and grindHit == True:
  2691. grindpos = own['grindpos']
  2692. jumpstance = own["jump_stance"]
  2693. if LAST_GRIND == False:
  2694. if grindpos == "reg_5050":
  2695. #print("nose something")
  2696. if jumpstance != 3:
  2697. if jumpstance == 0:
  2698. if rLR > .02:
  2699. grindtype("reg_nosegR")
  2700. elif rLR < -.02:
  2701. grindtype("reg_nosegL")
  2702. else:
  2703. grindtype("reg_noseg")
  2704. if jumpstance == 1:
  2705. if rLR > .02:
  2706. grindtype("fak_nosegR")
  2707. elif rLR < -.02:
  2708. grindtype("fak_nosegL")
  2709. else:
  2710. grindtype("fak_noseg")
  2711. else:
  2712. if STANCE == 0:
  2713. if rLR > .02:
  2714. grindtype("reg_nosegR")
  2715. elif rLR < -.02:
  2716. grindtype("reg_nosegL")
  2717. else:
  2718. grindtype("reg_noseg")
  2719. if STANCE == 1:
  2720. if rLR > .02:
  2721. grindtype("fak_nosegR")
  2722. elif rLR < -.02:
  2723. grindtype("fak_nosegL")
  2724. else:
  2725. grindtype("fak_noseg")
  2726. elif grindpos == "reg_board":
  2727. if jumpstance != 3:
  2728. if jumpstance == 0:
  2729. grindtype("reg_noseslide")
  2730. if jumpstance == 1:
  2731. grindtype("fak_noseslide")
  2732. STANCE = jumpstance
  2733. own['stance'] = STANCE
  2734. else:
  2735. if STANCE == 0:
  2736. grindtype("reg_noseslide")
  2737. if STANCE == 1:
  2738. grindtype("fak_noseslide")
  2739. if rUD > -0.020 and rUD <= .020 and LAST_GRIND == False:
  2740. if own['grindpos'] == 'reg_5050':
  2741. grindtype("reg_5050")
  2742. if own['grindpos'] == 'fak_5050':
  2743. grindtype("fak_5050")
  2744. if q1oncd > 0:
  2745. q1on = 0
  2746. q1oncd = q1oncd - 1
  2747. own["Q1oncd"] = q1oncd
  2748. own["last_nOpos"] = False
  2749. #q7
  2750. if rLR < -0.070:
  2751. if q8on == 0 and q6on == 0:
  2752. q7on = 1
  2753. q7oncd = countdown
  2754. own["Q7oncd"] = q7oncd
  2755. elif q7oncd > 0:
  2756. q7on = 0
  2757. q7oncd = q7oncd - 1
  2758. own["Q7oncd"] = q7oncd
  2759. #q3
  2760. if rLR > 0.070:
  2761. if q4on == 0 and q2on == 0:
  2762. q3on = 1
  2763. q3oncd = countdown
  2764. own["Q3oncd"] = q3oncd
  2765. #print("q3on")
  2766. elif q3oncd > 0:
  2767. q3on = 0
  2768. q3oncd = q3oncd - 1
  2769. own["Q3oncd"] = q3oncd
  2770. ###keyboard fliptricks
  2771. if dict['kb_space'] == 3:
  2772. if dict['kb_a'] == 2:
  2773. kickflip()
  2774. elif dict['kb_d'] == 2:
  2775. heelflip()
  2776. elif dict['kb_w'] == 2:
  2777. fsshuvit()
  2778. elif dict['kb_s'] == 2:
  2779. shuvit()
  2780. else:
  2781. aollie()
  2782. ##########################################
  2783. #trick calls
  2784. ##########################################
  2785. # hard flip
  2786. # 6 > 5 > 8
  2787. if q6oncd > 0 and q5oncd > 0 and q8oncd > 0 and q6oncd <= q5oncd <= q8oncd:
  2788. print ("Hardflip")
  2789. dict['trick_string'] = 'Hardflip'
  2790. hardflip()
  2791. reset_rtimers()
  2792. q1oncd = 0
  2793. q2oncd = 0
  2794. q3oncd = 0
  2795. q4oncd = 0
  2796. q5oncd = 0
  2797. q6oncd = 0
  2798. q7oncd = 0
  2799. q8oncd = 0
  2800. # inward heelflip
  2801. # 4 > 5 > 2
  2802. if q4oncd > 0 and q5oncd > 0 and q2oncd > 0 and q4oncd <= q5oncd <= q2oncd:
  2803. print ("Inward Heelflip")
  2804. dict['trick_string'] = 'Inward Heelflip'
  2805. inward_heelflip()
  2806. reset_rtimers()
  2807. q1oncd = 0
  2808. q2oncd = 0
  2809. q3oncd = 0
  2810. q4oncd = 0
  2811. q5oncd = 0
  2812. q6oncd = 0
  2813. q7oncd = 0
  2814. q8oncd = 0
  2815. # nollie hard flip
  2816. # 8 > 1 > 6
  2817. if q8oncd > 0 and q1oncd > 0 and q6oncd > 0 and q8oncd <= q1oncd <= q6oncd:
  2818. print ("Nollie Hardflip")
  2819. dict['trick_string'] = 'Nollie Hardflip'
  2820. nollie_hardflip()
  2821. reset_rtimers()
  2822. q1oncd = 0
  2823. q2oncd = 0
  2824. q3oncd = 0
  2825. q4oncd = 0
  2826. q5oncd = 0
  2827. q6oncd = 0
  2828. q7oncd = 0
  2829. q8oncd = 0
  2830. # nollie inward heelflip
  2831. # 2 > 1 > 4
  2832. if q2oncd > 0 and q1oncd > 0 and q4oncd > 0 and q2oncd <= q1oncd <= q4oncd:
  2833. print ("Nollie Inward Heelflip")
  2834. dict['trick_string'] = 'Nollie Inward Heelflip'
  2835. nollie_inward_heelflip()
  2836. reset_rtimers()
  2837. q1oncd = 0
  2838. q2oncd = 0
  2839. q3oncd = 0
  2840. q4oncd = 0
  2841. q5oncd = 0
  2842. q6oncd = 0
  2843. q7oncd = 0
  2844. q8oncd = 0
  2845. #nollie 360 shuvit
  2846. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q7oncd <= q8oncd <= q1oncd <= q2oncd <= q3oncd:
  2847. print ("Nollie 360 shuvit")
  2848. dict['trick_string'] = 'Nollie 360 shuvit'
  2849. nollie_shuvit360()
  2850. reset_rtimers()
  2851. q1oncd = 0
  2852. q2oncd = 0
  2853. q3oncd = 0
  2854. q4oncd = 0
  2855. q5oncd = 0
  2856. q6oncd = 0
  2857. q7oncd = 0
  2858. q8oncd = 0
  2859. #nollie fs 360 shuvit
  2860. if q7oncd > 0 and q8oncd > 0 and q1oncd > 0 and q2oncd > 0 and q3oncd > 0 and q3oncd <= q2oncd <= q1oncd <= q8oncd <= q7oncd:
  2861. #print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2862. print ("Nollie Front Side 360 shuvit")
  2863. dict['trick_string'] = 'Nollie FS 360 shuvit'
  2864. nollie_fsshuvit360()
  2865. reset_rtimers()
  2866. q1oncd = 0
  2867. q2oncd = 0
  2868. q3oncd = 0
  2869. q4oncd = 0
  2870. q5oncd = 0
  2871. q6oncd = 0
  2872. q7oncd = 0
  2873. q8oncd = 0
  2874. # varial heelflip
  2875. # 7 < 6 < 2
  2876. if q7oncd > 0 and q6oncd > 0 and q2oncd > 0 and q7oncd < q6oncd < q2oncd:
  2877. dict['trick_string'] = 'Varial Heelflip'
  2878. varial_heelflip()
  2879. reset_rtimers()
  2880. q1oncd = 0
  2881. q2oncd = 0
  2882. q3oncd = 0
  2883. q4oncd = 0
  2884. q5oncd = 0
  2885. q6oncd = 0
  2886. q7oncd = 0
  2887. q8oncd = 0
  2888. # varial kickflip
  2889. # 3 < 4 < 8
  2890. if q3oncd > 0 and q4oncd > 0 and q8oncd > 0 and q3oncd < q4oncd < q8oncd:
  2891. dict['trick_string'] = 'Varial Kickflip'
  2892. varial_kickflip()
  2893. reset_rtimers()
  2894. q1oncd = 0
  2895. q2oncd = 0
  2896. q3oncd = 0
  2897. q4oncd = 0
  2898. q5oncd = 0
  2899. q6oncd = 0
  2900. q7oncd = 0
  2901. q8oncd = 0
  2902. # nollie varial kickflip
  2903. # 3 < 2 < 6
  2904. if q3oncd > 0 and q2oncd > 0 and q6oncd > 0 and q3oncd <= q2oncd <= q6oncd:
  2905. dict['trick_string'] = 'Nollie Varial Kickflip'
  2906. print('Nollie Varial Kickflip')
  2907. nollie_varial_kickflip()
  2908. reset_rtimers()
  2909. q1oncd = 0
  2910. q2oncd = 0
  2911. q3oncd = 0
  2912. q4oncd = 0
  2913. q5oncd = 0
  2914. q6oncd = 0
  2915. q7oncd = 0
  2916. q8oncd = 0
  2917. # nollie varial heelflip
  2918. # 7 < 8 < 4
  2919. if q7oncd > 0 and q8oncd > 0 and q4oncd > 0 and q7oncd <= q8oncd <= q4oncd:
  2920. dict['trick_string'] = 'Nollie Varial Heelflip'
  2921. print('Nollie Varial Heelflip')
  2922. nollie_varial_heelflip()
  2923. reset_rtimers()
  2924. q1oncd = 0
  2925. q2oncd = 0
  2926. q3oncd = 0
  2927. q4oncd = 0
  2928. q5oncd = 0
  2929. q6oncd = 0
  2930. q7oncd = 0
  2931. q8oncd = 0
  2932. #360 shuvit
  2933. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd > 0 and q7oncd > 0 and q7oncd >= q6oncd >= q5oncd >= q4oncd >= q3oncd:
  2934. # print("q4oncd: ", q4oncd, " q5oncd: ", q5oncd, " q6oncd: ", q6oncd)
  2935. #print ("______-------360 shuvit")
  2936. dict['trick_string'] = '360 shuvit'
  2937. shuvit360()
  2938. reset_rtimers()
  2939. q1oncd = 0
  2940. q2oncd = 0
  2941. q3oncd = 0
  2942. q4oncd = 0
  2943. q5oncd = 0
  2944. q6oncd = 0
  2945. q7oncd = 0
  2946. q8oncd = 0
  2947. #360 fs shuvit
  2948. if q3oncd > 0 and q4oncd > 0 and q5oncd > 0 and q6oncd >= 0 and q7oncd > 0 and q7oncd <= q6oncd <= q5oncd <= q4oncd <= q3oncd:
  2949. dict['trick_string'] = '360 Frontside shuvit'
  2950. fsshuvit360()
  2951. reset_rtimers()
  2952. q1oncd = 0
  2953. q2oncd = 0
  2954. q3oncd = 0
  2955. q4oncd = 0
  2956. q5oncd = 0
  2957. q6oncd = 0
  2958. q7oncd = 0
  2959. q8oncd = 0
  2960. #ollie
  2961. if q5oncd > 0 and q1oncd > 0 and q5oncd < q1oncd:
  2962. JUMPSTRENGTH = q1oncd - q5oncd
  2963. #4,7
  2964. if JUMPSTRENGTH <= 4:
  2965. JUMPSTRENGTH = 1.1
  2966. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2967. JUMPSTRENGTH = 1
  2968. if JUMPSTRENGTH >= 7:
  2969. JUMPSTRENGTH = .9
  2970. aollie()
  2971. reset_rtimers()
  2972. q1oncd = 0
  2973. q2oncd = 0
  2974. q3oncd = 0
  2975. q4oncd = 0
  2976. q5oncd = 0
  2977. q6oncd = 0
  2978. q7oncd = 0
  2979. q8oncd = 0
  2980. #nollie
  2981. if q5oncd > 0 and q1oncd > 0 and q5oncd > q1oncd:
  2982. JUMPSTRENGTH = q5oncd - q1oncd
  2983. #4,7
  2984. if JUMPSTRENGTH <= 4:
  2985. JUMPSTRENGTH = 1.1
  2986. if JUMPSTRENGTH > 4 and JUMPSTRENGTH < 7:
  2987. JUMPSTRENGTH = 1
  2988. if JUMPSTRENGTH >= 7:
  2989. JUMPSTRENGTH = .9
  2990. nollie()
  2991. reset_rtimers()
  2992. print("nollie")
  2993. q1oncd = 0
  2994. q2oncd = 0
  2995. q3oncd = 0
  2996. q4oncd = 0
  2997. q5oncd = 0
  2998. q6oncd = 0
  2999. q7oncd = 0
  3000. q8oncd = 0
  3001. #kickflip
  3002. if q5oncd > 0 and q8oncd > 0 and q5oncd < q8oncd and q3oncd < 1:
  3003. kickflip()
  3004. reset_rtimers()
  3005. q1oncd = 0
  3006. q2oncd = 0
  3007. q3oncd = 0
  3008. q4oncd = 0
  3009. q5oncd = 0
  3010. q6oncd = 0
  3011. q7oncd = 0
  3012. q8oncd = 0
  3013. #nollie kickflip
  3014. if q1oncd > 0 and q6oncd > 0 and q1oncd < q6oncd:
  3015. nollie_kickflip()
  3016. reset_rtimers()
  3017. q1oncd = 0
  3018. q2oncd = 0
  3019. q3oncd = 0
  3020. q4oncd = 0
  3021. q5oncd = 0
  3022. q6oncd = 0
  3023. q7oncd = 0
  3024. q8oncd = 0
  3025. #heelflip
  3026. if q5oncd > 0 and q2oncd > 0 and q5oncd < q2oncd:
  3027. heelflip()
  3028. reset_rtimers()
  3029. q1oncd = 0
  3030. q2oncd = 0
  3031. q3oncd = 0
  3032. q4oncd = 0
  3033. q5oncd = 0
  3034. q6oncd = 0
  3035. q7oncd = 0
  3036. q8oncd = 0
  3037. #nollie_heelflip
  3038. if q1oncd > 0 and q4oncd > 0 and q1oncd < q4oncd:
  3039. nollie_heelflip()
  3040. reset_rtimers()
  3041. q1oncd = 0
  3042. q2oncd = 0
  3043. q3oncd = 0
  3044. q4oncd = 0
  3045. q5oncd = 0
  3046. q6oncd = 0
  3047. q7oncd = 0
  3048. q8oncd = 0
  3049. #shuvit
  3050. if q7oncd > 0 and q5oncd > 0 and q6oncd > 0 and q5oncd <= q6oncd <= q7oncd:# and q3oncd < 1:
  3051. shuvit()
  3052. reset_rtimers()
  3053. q1oncd = 0
  3054. q2oncd = 0
  3055. q3oncd = 0
  3056. q4oncd = 0
  3057. q5oncd = 0
  3058. q6oncd = 0
  3059. q7oncd = 0
  3060. q8oncd = 0
  3061. #nollie_shuvit
  3062. if q7oncd > 0 and q1oncd > 0 and q8oncd > 0 and q1oncd <= q8oncd <= q7oncd:# and q3oncd == 0:
  3063. nollie_shuvit()
  3064. print('nollie shuvit')
  3065. reset_rtimers()
  3066. q1oncd = 0
  3067. q2oncd = 0
  3068. q3oncd = 0
  3069. q4oncd = 0
  3070. q5oncd = 0
  3071. q6oncd = 0
  3072. q7oncd = 0
  3073. q8oncd = 0
  3074. #fsshuvit
  3075. if q4oncd > 0 and q5oncd > 0 and q3oncd > 0 and q5oncd <= q4oncd <= q3oncd:# and q7oncd < 1:
  3076. fsshuvit()
  3077. reset_rtimers()
  3078. q1oncd = 0
  3079. q2oncd = 0
  3080. q3oncd = 0
  3081. q4oncd = 0
  3082. q5oncd = 0
  3083. q6oncd = 0
  3084. q7oncd = 0
  3085. q8oncd = 0
  3086. #nollie_fsshuvit
  3087. if q3oncd > 0 and q1oncd > 0 and q2oncd > 0 and q1oncd <= q2oncd <= q3oncd:# and q7oncd == 0:
  3088. print ("nollie fsshuvit")
  3089. nollie_fsshuvit()
  3090. reset_rtimers()
  3091. q1oncd = 0
  3092. q2oncd = 0
  3093. q3oncd = 0
  3094. q4oncd = 0
  3095. q5oncd = 0
  3096. q6oncd = 0
  3097. q7oncd = 0
  3098. q8oncd = 0
  3099. def hippy_jump():
  3100. STANCE = own["stance"]
  3101. if own['hippy'] == 1 and own['last_hippy'] == 0:
  3102. if STANCE == 0:
  3103. own['requestAction'] = 'reg_hippy_in'
  3104. if STANCE == 1:
  3105. own['requestAction'] = 'fak_hippy_in'
  3106. if own['hippy'] == 1 and own['last_hippy'] == 1:
  3107. if STANCE == 0:
  3108. own['requestAction'] = 'reg_hippy_in'
  3109. if STANCE == 1:
  3110. own['requestAction'] = 'fak_hippy_in'
  3111. if own['hippy'] == 0 and own['last_hippy'] == 1:
  3112. if rLR > turnsens:
  3113. local = True
  3114. rot = [ 0.0, 0.0, 3.14]
  3115. own.applyRotation(rot,local)
  3116. if STANCE == 0:
  3117. own['requestAction'] = 'reg_hippy_ncw'
  3118. if STANCE == 1:
  3119. own['requestAction'] = 'fak_hippy_ncw'
  3120. elif rLR < -turnsens:
  3121. local = True
  3122. rot = [ 0.0, 0.0, -3.14]
  3123. own.applyRotation(rot,local)
  3124. if STANCE == 0:
  3125. own['requestAction'] = 'fak_hippy_nccw'
  3126. if STANCE == 1:
  3127. own['requestAction'] = 'reg_hippy_nccw'
  3128. ##straight
  3129. else:
  3130. if STANCE == 0:
  3131. own['requestAction'] = 'reg_hippy'
  3132. if STANCE == 1:
  3133. own['requestAction'] = 'fak_hippy'
  3134. #pushing and hippy jumps
  3135. since_a = frame - lastaf
  3136. since_x = frame - lastxf
  3137. cush = 10
  3138. hippy = 0
  3139. own['hippy'] = 0
  3140. if xBut == 1 and aBut == 1 and (lTrig < 0.02 and rTrig < 0.02) and r_ground.triggered == True:
  3141. #F"hippy")
  3142. hippy = 1
  3143. own['hippy'] = 1
  3144. hippy_jump()
  3145. if ((since_a > cush and aBut == 1 and lasta == 1) or dict['kb_ua'] == 2) and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3146. if xBut == 0 and hippy == 0 and (lastaBut_ground == True or dict['kb_ua'] == 2):
  3147. push()
  3148. if since_x > cush and xBut == 1 and lastx == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
  3149. if aBut == 0 and hippy == 0 and lastxBut_ground == True:
  3150. push_goof()
  3151. #cavemans
  3152. if LAST_GRIND == False and grindHit == False and r_ground.triggered:
  3153. if (aBut ==0 and own['lastaBut_ground'] == 1) and lTrig > 0.02:
  3154. brfoot()
  3155. if (aBut ==0 and own['lastaBut_ground'] == 1) and rTrig > 0.02:
  3156. frfoot()
  3157. if (xBut ==0 and own['lastxBut_ground'] == 1) and lTrig > 0.02:
  3158. blfoot()
  3159. if (xBut ==0 and own['lastxBut_ground'] == 1) and rTrig > 0.02:
  3160. flfoot()
  3161. #push b button
  3162. if bBut == 1:
  3163. if linVelocity.x > .05 or linVelocity.x < -.05:
  3164. stop()
  3165. elif linVelocity.x < .05 or linVelocity.x > -.05:
  3166. if own["lastStop"] == True:
  3167. own["lastStop"] = False
  3168. elif bBut ==0:
  3169. own["lastStop"] = False
  3170. ##### falls
  3171. if own['fall'] == 1:
  3172. offboard()
  3173. own['getoffboard'] = True
  3174. ####
  3175. #y button
  3176. if (own['lasty'] == 1 and yBut ==0) or dict['kb_q'] == 3:
  3177. offboard()
  3178. if own["GRAB_ON"] == True:
  3179. playing = skater.isPlayingAction(fliplay)
  3180. if playing == 1:
  3181. frame = skater.getActionFrame(fliplay)
  3182. if frame > 16:
  3183. skater.stopAction(fliplay)
  3184. flipping = skater.isPlayingAction(fliplay)
  3185. #reg_ollie_north
  3186. if rTrig < .02 and lTrig <.02 and r_ground.triggered == 0 and flipping == False and aBut == True:
  3187. if STANCE == 0:
  3188. own['requestAction'] = 'reg_ollie_south'
  3189. else:
  3190. own['requestAction'] = 'fak_ollie_north'
  3191. if rTrig < .02 and lTrig <.02 and r_ground.triggered == 0 and flipping == False and xBut == True:
  3192. if STANCE == 0:
  3193. own['requestAction'] = 'reg_ollie_north'
  3194. else:
  3195. own['requestAction'] = 'fak_ollie_south'
  3196. #frontside grab
  3197. if rTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3198. GRAB_ON = True
  3199. own["GRAB_ON"] = GRAB_ON
  3200. #print(rTrig, GRAB_ON)
  3201. if aBut == False and xBut == False:
  3202. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3203. frontside_grab_on()
  3204. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3205. fakbackside_grab_on()
  3206. #front_nose
  3207. if STANCE == True and rUD < -0.070:
  3208. fak_backside_nose_grab_on()
  3209. #front_tail
  3210. elif STANCE == True and rUD > 0.07:
  3211. fak_backside_tail_grab_on()
  3212. #
  3213. if STANCE == False and rUD < -0.070:
  3214. if bBut == True:
  3215. reg_airwalk()
  3216. else:
  3217. frontside_nose_grab_on()
  3218. #front_tail
  3219. elif STANCE == False and rUD > 0.07:
  3220. frontside_tail_grab_on()
  3221. elif aBut == True and xBut == False:
  3222. if STANCE == False:
  3223. reg_fsonefoot_grab_on()
  3224. else:
  3225. fak_onefoot_grab_on()
  3226. elif aBut == False and xBut == True:
  3227. if STANCE == False:
  3228. reg_frigid_grab_on()
  3229. else:
  3230. fak_judo_grab_on()
  3231. #backside grab
  3232. if lTrig > 0.02 and r_ground.triggered == 0 and flipping == False:
  3233. GRAB_ON = True
  3234. own["GRAB_ON"] = GRAB_ON
  3235. #print(rTrig)
  3236. if aBut == False and xBut == False:
  3237. if STANCE == False and rUD >= -.07 and rUD <= .07:
  3238. backside_grab_on()
  3239. elif STANCE == True and rUD >= -.07 and rUD <= .07:
  3240. fakfrontside_grab_on()
  3241. #front_nose
  3242. if STANCE == True and rUD < -0.070:
  3243. fak_frontside_nose_grab_on()
  3244. #front_tail
  3245. elif STANCE == True and rUD > 0.07:
  3246. fak_frontside_tail_grab_on()
  3247. #front_nose
  3248. if STANCE == False and rUD < -0.070:
  3249. if bBut == True:
  3250. reg_airwalk()
  3251. else:
  3252. backside_nose_grab_on()
  3253. #front_tail
  3254. elif STANCE == False and rUD > 0.07:
  3255. backside_tail_grab_on()
  3256. elif aBut == True and xBut == False:
  3257. if STANCE == False:
  3258. reg_judo_grab_on()
  3259. else:
  3260. fak_frigid_grab_on()
  3261. elif aBut == False and xBut == True:
  3262. if STANCE == False:
  3263. reg_onefoot_grab_on()
  3264. else:
  3265. fak_frigid_grab_on()
  3266. #kill grabs
  3267. if lTrig <= 0.02 and GRAB_ON == True and lTrig >= -.02 and rTrig <= .02 and rTrig >= -.2:
  3268. GRAB_ON = False
  3269. own["GRAB_ON"] = GRAB_ON
  3270. GRAB_PLAYED = False
  3271. own["GRAB_PLAYED"] = GRAB_PLAYED
  3272. #frontside pump #backside pump
  3273. def footplant():
  3274. framenum = own['framenum']
  3275. last_ground_frame = own['lF_ground_frame']
  3276. lF_air_frame = own['lF_air_frame']
  3277. frames_since_ground = framenum - lF_air_frame
  3278. frames_since_grind = framenum - own['last_grind_frame']
  3279. if grindHit == True and aBut == True and ground_since < 10:
  3280. own.linearVelocity.x = 0
  3281. own.linearVelocity.y = 0
  3282. own['footplant_on'] = 1
  3283. if grindHit == False:
  3284. own['footplant_on'] = 0
  3285. if own['footplant_on'] == True and rUD < turnsens and rUD > -turnsens:
  3286. own.linearVelocity.x = 0
  3287. own.linearVelocity.y = 0
  3288. if own['footplant_on'] == 1 and own['last_footplant'] == True and own['jump_timer'] < 50:
  3289. if skater.isPlayingAction(2925) == False:
  3290. if STANCE == 0:
  3291. own['requestAction'] = 'reg_fp_rback'
  3292. if STANCE == 1:
  3293. own['requestAction'] = 'fak_fp_rback'
  3294. def invert():
  3295. if grindHit == True and own['grindpos'] == 'reg_board' and gsf < 10:
  3296. if lBump == 1:
  3297. own['invert_on'] = 1
  3298. own.linearVelocity.x = 0
  3299. own.linearVelocity.y = 0
  3300. if own["coping"] == 1 and own['invert_on'] == 1:
  3301. if own['invert_on'] == 1 and own['last_invert'] == False:
  3302. cont.activate(own.actuators['invertOn_sound'])
  3303. if STANCE == False:
  3304. own['invert_type'] = "reg_back_invert_in"
  3305. if STANCE == True:
  3306. own['invert_type'] = "fak_fr_invert"
  3307. if own['invert_on'] == 0 and own['last_invert'] == True:
  3308. own['last_invert_frame'] = frame
  3309. cont.activate(own.actuators['invertOff_Sound'])
  3310. if own['invert_on'] == 1 and own['invert_type'] != None:
  3311. if own['invert_type'] == "reg_back_invert_in":
  3312. own['requestAction'] = 'reg_back_invert'
  3313. if own['invert_type'] == "fak_fr_invert":
  3314. own['requestAction'] = 'fak_fr_invert'
  3315. lif = own['last_invert_frame']
  3316. if frame - lif > 3 and own['invert_on'] == 0:
  3317. own['invert_type'] = None
  3318. invert()
  3319. footplant()
  3320. def reset_pos():
  3321. #reset
  3322. if ddPad == 1:
  3323. spawn_pos = own['spawn_pos']
  3324. spawn_rot = own['spawn_rot']
  3325. spawn_cam_pos = own['spawn_cam_pos']
  3326. spawn_cam_rot = own['spawn_cam_rot']
  3327. try:
  3328. own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
  3329. own.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
  3330. cam.worldPosition = (spawn_cam_pos[0], spawn_cam_pos[1], (spawn_cam_pos[2]))
  3331. cam.worldOrientation = [[spawn_cam_rot[0][0],spawn_cam_rot[0][1],spawn_cam_rot[0][2]], [spawn_cam_rot[1][0],spawn_cam_rot[1][1],spawn_cam_rot[1][2]], [0.0, 0.0, 1.0]]
  3332. except:
  3333. own.worldPosition = (0, 0, .1)
  3334. own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
  3335. if own["spawn_stance"] == 1:
  3336. own.setLinearVelocity([.1,0,0], 1)
  3337. else:
  3338. own.setLinearVelocity([-.1,0,0], 1)
  3339. if udPad == 1:
  3340. own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
  3341. own['spawn_rot'] = [[own.worldOrientation[0][0],own.worldOrientation[0][1],own.worldOrientation[0][2]], [own.worldOrientation[1][0],own.worldOrientation[1][1],own.worldOrientation[1][2]], own.worldOrientation[2][2]]
  3342. own['spawn_cam_pos'] = [cam.worldPosition[0], cam.worldPosition[1], cam.worldPosition[2]]
  3343. own['spawn_cam_rot'] = [[cam.worldOrientation[0][0],cam.worldOrientation[0][1],cam.worldOrientation[0][2]], [cam.worldOrientation[1][0],cam.worldOrientation[1][1],cam.worldOrientation[1][2]], cam.worldOrientation[2][2]]
  3344. stance = own["stance"]
  3345. own["spawn_stance"] = stance
  3346. #start button
  3347. if stBut == True:
  3348. own.actuators["sroll"].volume = .0001
  3349. cont.deactivate(own.actuators["sroll"])
  3350. own.actuators["sroll"].stopSound()
  3351. if (stBut == False and dict['last_stBut'] == True) or dict['kb_en'] == 1:
  3352. if own['pause_on'] == True:
  3353. own['pause_on'] = False
  3354. else:
  3355. own['pause_on'] = True
  3356. def ylimit():
  3357. lgf = own['last_grind_frame']
  3358. frame = own['framenum']
  3359. frames_since_grinding = frame - lgf
  3360. ylimit = .84
  3361. #print(ground_since, 'ground_since')
  3362. if ground_since < 20 and ground_since > 1 and grindHit == 0 and own['jump_timer'] < 40:
  3363. ylimit = ylimit + ((ground_since - 15) * -.005)
  3364. yvel = own.linearVelocity.y
  3365. yvel = yvel *.03
  3366. if STANCE == 0:
  3367. yvel *= -1
  3368. try:
  3369. dist = r_ground.hitObject.worldPosition - own.worldPosition
  3370. #print('ground dist', dist)
  3371. if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01:
  3372. own.applyRotation([0,0,yvel], True)
  3373. if ylimit > .99999:
  3374. ylimit = .9999
  3375. except:
  3376. pass
  3377. else:
  3378. if r_ground.triggered and touched == False and grindHit == 0 and frames_since_grinding > 20:
  3379. linVelocity4 = own.getLinearVelocity(True)
  3380. newy = linVelocity4.y * ylimit
  3381. force = [linVelocity4.x, newy, linVelocity4.z]
  3382. own.setLinearVelocity(force, True)
  3383. #print(ylimit, 'ylimit')
  3384. def getoffboard():
  3385. lasty = own['lasty']
  3386. getoffboard = own['getoffboard']
  3387. if getoffboard == 1 and own['fall'] == False:
  3388. own['getoffboard'] = 0
  3389. if (yBut == False and lasty == True) or dict['kb_q'] == 3:
  3390. own['getoffboard'] = 1
  3391. def switchcam():
  3392. pass
  3393. # if ltsBut == False and own['lastlts'] == True and rtsBut == False:
  3394. # if own['camera'] == 1:
  3395. # own['camera'] = 0
  3396. # else:
  3397. # own['camera'] = 1
  3398. # if rtsBut == False and own['lastrts'] == True and ltsBut == False:
  3399. # if own['camera'] == 2:
  3400. # own['camera'] = 0
  3401. # else:
  3402. # own['camera'] = 2
  3403. #followcam
  3404. def move_followcam():
  3405. if own['camera'] == 2:
  3406. #if rtsBut == False and own['lastrts'] == True:
  3407. if dict['last_bkBut'] == True and bkBut == False:
  3408. #print("activate move followcam")
  3409. if own['move_followcam'] == False:
  3410. own['move_followcam'] = True
  3411. else:
  3412. own['move_followcam'] = False
  3413. if own['move_followcam'] == True:
  3414. #act = followcam.actuators[
  3415. camspeed1 = .015
  3416. camspeed2 = .055
  3417. camrot1 = .005
  3418. camrot2 = .02
  3419. #up
  3420. if lUD < -0.080:
  3421. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3422. cont.activate(followcam.actuators["up"])
  3423. else:
  3424. cont.deactivate(followcam.actuators["up"])
  3425. # #down
  3426. if lUD > .080:
  3427. followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3428. cont.activate(followcam.actuators["down"])
  3429. else:
  3430. cont.deactivate(followcam.actuators["down"])
  3431. # #left
  3432. if lLR < -0.080:
  3433. followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3434. cont.activate(followcam.actuators["left"])
  3435. else:
  3436. cont.deactivate(followcam.actuators["left"])
  3437. # #right
  3438. if lLR > 0.080:
  3439. followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3440. cont.activate(followcam.actuators["right"])
  3441. else:
  3442. cont.deactivate(followcam.actuators["right"])
  3443. #up
  3444. if rUD < -0.080:
  3445. followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
  3446. cont.activate(followcam.actuators["rotup"])
  3447. else:
  3448. cont.deactivate(followcam.actuators["rotup"])
  3449. # #down
  3450. if rUD > .080:
  3451. followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
  3452. cont.activate(followcam.actuators["rotdown"])
  3453. else:
  3454. cont.deactivate(followcam.actuators["rotdown"])
  3455. # #left
  3456. if rLR < -0.080:
  3457. followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3458. cont.activate(followcam.actuators["rotleft"])
  3459. else:
  3460. cont.deactivate(followcam.actuators["rotleft"])
  3461. # #right
  3462. if rLR > 0.080:
  3463. followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3464. cont.activate(followcam.actuators["rotright"])
  3465. else:
  3466. cont.deactivate(followcam.actuators["rotright"])
  3467. #*********************************************
  3468. if lUD > -0.080 and lUD < -0.030:
  3469. followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3470. cont.activate(followcam.actuators["up"])
  3471. else:
  3472. cont.deactivate(followcam.actuators["up"])
  3473. # #down
  3474. if lUD < .080 and lUD > .03:
  3475. followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3476. cont.activate(followcam.actuators["down"])
  3477. else:
  3478. cont.deactivate(followcam.actuators["down"])
  3479. # #left
  3480. if lLR > -0.080 and lLR < -0.030:
  3481. followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3482. cont.activate(followcam.actuators["left"])
  3483. else:
  3484. cont.deactivate(followcam.actuators["left"])
  3485. # #right
  3486. if lLR < .080 and lLR > .03:
  3487. followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3488. cont.activate(followcam.actuators["right"])
  3489. else:
  3490. cont.deactivate(followcam.actuators["right"])
  3491. #up
  3492. if rUD > -0.080 and rUD < -0.030:
  3493. followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3494. cont.activate(followcam.actuators["rotup"])
  3495. else:
  3496. cont.deactivate(followcam.actuators["rotup"])
  3497. # #down
  3498. if rUD < .080 and rUD > .03:
  3499. followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3500. cont.activate(followcam.actuators["rotdown"])
  3501. else:
  3502. cont.deactivate(followcam.actuators["rotdown"])
  3503. # #left
  3504. if rLR > -0.080 and rLR < -0.030:
  3505. followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3506. cont.activate(followcam.actuators["rotleft"])
  3507. else:
  3508. cont.deactivate(followcam.actuators["rotleft"])
  3509. # #right
  3510. if rLR < .080 and rLR > .03:
  3511. followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3512. cont.activate(followcam.actuators["rotright"])
  3513. else:
  3514. cont.deactivate(followcam.actuators["rotright"])
  3515. def move_flycam():
  3516. if own['camera'] == 1:
  3517. if dict['last_bkBut'] == True and bkBut == False:
  3518. if own['move_freecam'] == False:
  3519. own['move_freecam'] = True
  3520. else:
  3521. own['move_freecam'] = False
  3522. if own['move_freecam'] == True:
  3523. camspeed1 = .015
  3524. camspeed2 = .055
  3525. camrot1 = .005
  3526. camrot2 = .02
  3527. #up
  3528. if lUD < -0.080:
  3529. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
  3530. cont.activate(freecam.actuators["up"])
  3531. else:
  3532. cont.deactivate(freecam.actuators["up"])
  3533. # #down
  3534. if lUD > .080:
  3535. freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
  3536. cont.activate(freecam.actuators["down"])
  3537. else:
  3538. cont.deactivate(freecam.actuators["down"])
  3539. # #left
  3540. if lLR < -0.080:
  3541. freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
  3542. cont.activate(freecam.actuators["left"])
  3543. else:
  3544. cont.deactivate(freecam.actuators["left"])
  3545. # #right
  3546. if lLR > 0.080:
  3547. freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
  3548. cont.activate(freecam.actuators["right"])
  3549. else:
  3550. cont.deactivate(freecam.actuators["right"])
  3551. #up
  3552. if rUD < -0.080:
  3553. freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
  3554. cont.activate(freecam.actuators["rotup"])
  3555. else:
  3556. cont.deactivate(freecam.actuators["rotup"])
  3557. # #down
  3558. if rUD > .080:
  3559. freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
  3560. cont.activate(freecam.actuators["rotdown"])
  3561. else:
  3562. cont.deactivate(freecam.actuators["rotdown"])
  3563. # #left
  3564. if rLR < -0.080:
  3565. freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
  3566. cont.activate(freecam.actuators["rotleft"])
  3567. else:
  3568. cont.deactivate(freecam.actuators["rotleft"])
  3569. # #right
  3570. if rLR > 0.080:
  3571. freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
  3572. cont.activate(freecam.actuators["rotright"])
  3573. else:
  3574. cont.deactivate(freecam.actuators["rotright"])
  3575. #*********************************************
  3576. if lUD > -0.080 and lUD < -0.030:
  3577. freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
  3578. cont.activate(freecam.actuators["up"])
  3579. else:
  3580. cont.deactivate(freecam.actuators["up"])
  3581. # #down
  3582. if lUD < .080 and lUD > .03:
  3583. freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
  3584. cont.activate(freecam.actuators["down"])
  3585. else:
  3586. cont.deactivate(freecam.actuators["down"])
  3587. # #left
  3588. if lLR > -0.080 and lLR < -0.030:
  3589. freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
  3590. cont.activate(freecam.actuators["left"])
  3591. else:
  3592. cont.deactivate(freecam.actuators["left"])
  3593. # #right
  3594. if lLR < .080 and lLR > .03:
  3595. freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
  3596. cont.activate(freecam.actuators["right"])
  3597. else:
  3598. cont.deactivate(freecam.actuators["right"])
  3599. #up
  3600. if rUD > -0.080 and rUD < -0.030:
  3601. freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
  3602. cont.activate(freecam.actuators["rotup"])
  3603. else:
  3604. cont.deactivate(freecam.actuators["rotup"])
  3605. # #down
  3606. if rUD < .080 and rUD > .03:
  3607. freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
  3608. cont.activate(freecam.actuators["rotdown"])
  3609. else:
  3610. cont.deactivate(freecam.actuators["rotdown"])
  3611. # #left
  3612. if rLR > -0.080 and rLR < -0.030:
  3613. freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
  3614. cont.activate(freecam.actuators["rotleft"])
  3615. else:
  3616. cont.deactivate(freecam.actuators["rotleft"])
  3617. # #right
  3618. if rLR < .080 and rLR > .03:
  3619. freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
  3620. cont.activate(freecam.actuators["rotright"])
  3621. else:
  3622. cont.deactivate(freecam.actuators["rotright"])
  3623. if r_ground.triggered == False:
  3624. own["lF_air_frame"] = own["framenum"]
  3625. if r_ground.triggered == True:
  3626. own["lF_ground_frame"] = own["framenum"]
  3627. if own['LAST_GRIND'] == True:
  3628. own['last_grind_frame'] = own['framenum']
  3629. if own['LAST_GRIND'] == False and r_ground.triggered and own['jump_timer'] == 0:
  3630. if own['jump_stance'] != 3:
  3631. own['jump_stance'] = 3
  3632. def control_calib():
  3633. #controller calibration test
  3634. scenes = bge.logic.getSceneList()
  3635. controller_calib = [scene for scene in scenes if scene.name=="controller_calib"][0]
  3636. cq1 = controller_calib.objects['q1']
  3637. cq2 = controller_calib.objects['q2']
  3638. cq3 = controller_calib.objects['q3']
  3639. cq4 = controller_calib.objects['q4']
  3640. cq5 = controller_calib.objects['q5']
  3641. cq6 = controller_calib.objects['q6']
  3642. cq7 = controller_calib.objects['q7']
  3643. cq8 = controller_calib.objects['q8']
  3644. if lq1on == 1:
  3645. cq1["q1"] = 1
  3646. else:
  3647. cq1["q1"] = 0
  3648. if lq2on == 1:
  3649. cq2["q2"] = 1
  3650. else:
  3651. cq2["q2"] = 0
  3652. if lq3on == 1:
  3653. cq3["q3"] = 1
  3654. else:
  3655. cq3["q3"] = 0
  3656. if lq4on == 1:
  3657. cq4["q4"] = 1
  3658. else:
  3659. cq4["q4"] = 0
  3660. if lq5on == 1:
  3661. cq5["q5"] = 1
  3662. else:
  3663. cq5["q5"] = 0
  3664. if lq6on == 1:
  3665. cq6["q6"] = 1
  3666. else:
  3667. cq6["q6"] = 0
  3668. if lq7on == 1:
  3669. cq7["q7"] = 1
  3670. else:
  3671. cq7["q7"] = 0
  3672. if lq8on == 1:
  3673. cq8["q8"] = 1
  3674. else:
  3675. cq8["q8"] = 0
  3676. def grind_turn():
  3677. jumping = None
  3678. gotcd = 25
  3679. force = [0,0,0]
  3680. grindHit = own['grindTouch']
  3681. sincegrinding = own['framenum'] - own['grindstartFrame']
  3682. STANCE = own['stance']
  3683. if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
  3684. jumping = True
  3685. if grindHit == False:
  3686. cont.deactivate(own.actuators['grindoutRight'])
  3687. cont.deactivate(own.actuators['grindoutLeft'])
  3688. if (grindHit == True and jumping == None and sincegrinding > 20 and ground_since > 20)or own['invert_on'] == True and own['last_grind'] == 1:
  3689. outloc = 0.022
  3690. bsoutloc = .07
  3691. bsoutvel = .1
  3692. outrot = .06#2 #0.012
  3693. outrot2 = .24
  3694. outact = own.actuators["grindoutRight"]
  3695. STANCE = own['grind_stance']
  3696. if 'fak' in own['l_actionState']:
  3697. STANCE = 1
  3698. if 'reg' in own['l_actionState']:
  3699. STANCE = 0
  3700. if own['grindpos'] == 'reg_5050':
  3701. if lq3on == 1 or lq2on or dict['kb_ra'] == 2:
  3702. if own['gt_cd2'] == 0:
  3703. own['gt_cd2'] = 60
  3704. if STANCE == True:
  3705. if own['grind_out_type'] == None:
  3706. own['grind_out_type'] = 'fak right'
  3707. if STANCE == False:
  3708. if own['grind_out_type'] == None:
  3709. own['grind_out_type'] = 'reg right'
  3710. own["grindoutturn"] = gotcd
  3711. if lq7on == 1 or lq8on or dict['kb_la'] == 2:
  3712. if own['gt_cd2'] == 0:
  3713. own['gt_cd2'] = 60
  3714. if STANCE == True:
  3715. if own['grind_out_type'] == None:
  3716. own['grind_out_type'] = 'fak left'
  3717. if STANCE == False:
  3718. if own['grind_out_type'] == None:
  3719. own['grind_out_type'] = 'reg left'
  3720. own["grindoutturn"] = gotcd
  3721. if lq4on == 1:
  3722. if own['gt_cd2'] == 0:
  3723. own['gt_cd2'] = 60
  3724. if STANCE == True:
  3725. if own['grind_out_type'] == None:
  3726. own['grind_out_type'] = 'fak fak right'
  3727. if STANCE == False:
  3728. if own['grind_out_type'] == None:
  3729. own['grind_out_type'] = 'reg fak right'
  3730. own["grindoutturn"] = gotcd
  3731. if lq6on == 1:
  3732. if own['gt_cd2'] == 0:
  3733. own['gt_cd2'] = 60
  3734. if STANCE == True:
  3735. if own['grind_out_type'] == None:
  3736. own['grind_out_type'] = 'fak fak left'
  3737. if STANCE == False:
  3738. if own['grind_out_type'] == None:
  3739. own['grind_out_type'] = 'reg fak left'
  3740. own["grindoutturn"] = gotcd
  3741. #use stance for 5050 and grindstance for boards
  3742. if own['grindpos'] == 'reg_board':
  3743. outvel = own.getLinearVelocity(1)
  3744. outact.dLoc = [0, 0, 0]
  3745. outact.dRot = [0, 0, 0]
  3746. if lq5on == 1 or dict['kb_da'] == 2:
  3747. if own['gt_cd2'] == 0:
  3748. own['gt_cd2'] = 60
  3749. if STANCE == True:
  3750. if own['footplant_on'] == True:
  3751. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3752. cont.activate(own.actuators["grindoutRight"])
  3753. if own['grind_out_type'] == None:
  3754. own['grind_out_type'] = 'bs fak back'
  3755. if STANCE == False:
  3756. if own['footplant_on'] == True:
  3757. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3758. cont.activate(own.actuators["grindoutRight"])
  3759. if own['grind_out_type'] == None:
  3760. own['grind_out_type'] = 'bs reg back'
  3761. own["grindoutturn"] = gotcd
  3762. own['invert_on'] = 0
  3763. if lq1on == 1 or dict['kb_ua'] == 2:
  3764. if own['gt_cd2'] == 0:
  3765. own['gt_cd2'] = 60
  3766. if STANCE == True:
  3767. if own['footplant_on'] == True:
  3768. own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
  3769. cont.activate(own.actuators["grindoutRight"])
  3770. if own['grind_out_type'] == None:
  3771. own['grind_out_type'] = 'bs fak forward'
  3772. if STANCE == False:
  3773. if own['footplant_on'] == True:
  3774. own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
  3775. cont.activate(own.actuators["grindoutRight"])
  3776. if own['grind_out_type'] == None:
  3777. own['grind_out_type'] = 'bs reg forward'
  3778. own["grindoutturn"] = gotcd
  3779. own['invert_on'] = 0
  3780. if lq1on or lq2on or lq3on or lq4on or lq5on or lq6on or lq7on or lq8on:
  3781. gt_cd = own['gt_cd']
  3782. if gt_cd == 0:
  3783. gt_cd = 30
  3784. own['gt_cd'] = gt_cd
  3785. if own['grindoutturn'] == 0:
  3786. cont.deactivate(own.actuators["grindoutRight"])
  3787. own["grindoutturn"] = 0
  3788. gt_cd = own['gt_cd']
  3789. if gt_cd > 0:
  3790. own['gt_cd'] = gt_cd - 1
  3791. else:
  3792. own['gt_cd'] = 0
  3793. #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3794. reg_move = .05
  3795. reg_rot = 0.02#2
  3796. reg_rot2 = .26
  3797. reg_move2 = .13
  3798. bsforce = 50
  3799. bs_dloc = .04
  3800. outvel = own.linearVelocity
  3801. if own["coping"] == 1:
  3802. reg_rot = reg_rot *3
  3803. if own['gt_cd2'] > 50 and own['jump_timer'] < 20:
  3804. if own['grind_out_type'] == 'reg right':
  3805. own.applyMovement([0,reg_move,0], True)
  3806. own.applyRotation([0,0,-reg_rot],True)
  3807. if own['grind_out_type'] == 'fak right':
  3808. own.applyMovement([0,-reg_move,0], True)
  3809. own.applyRotation([0,0,-reg_rot],True)
  3810. if own['grind_out_type'] == 'reg left':
  3811. own.applyMovement([0,-reg_move,0], True)
  3812. own.applyRotation([0,0,reg_rot],True)
  3813. if own['grind_out_type'] == 'fak left':
  3814. own.applyMovement([0,reg_move,0], True)
  3815. own.applyRotation([0,0,reg_rot],True)
  3816. if own['grind_out_type'] == 'reg fak right':
  3817. if own['gt_cd2'] > 55:
  3818. own.applyMovement([0,reg_move2,0], True)
  3819. own.applyRotation([0,0,reg_rot2],True)
  3820. if own['grind_out_type'] == 'fak fak right':
  3821. if own['gt_cd2'] > 55:
  3822. own.applyMovement([0,-reg_move2,0], True)
  3823. own.applyRotation([0,0,reg_rot2],True)
  3824. if own['grind_out_type'] == 'reg fak left':
  3825. if own['gt_cd2'] > 55:
  3826. own.applyMovement([0,-reg_move2,0], True)
  3827. own.applyRotation([0,0,-reg_rot2],True)
  3828. if own['grind_out_type'] == 'fak fak left':
  3829. if own['gt_cd2'] > 55:
  3830. own.applyMovement([0,reg_move2,0], True)
  3831. own.applyRotation([0,0,-reg_rot2],True)
  3832. if own['grind_out_type'] == 'reg right' or own['grind_out_type'] == 'reg left' or own['grind_out_type'] == 'fak right' or own['grind_out_type'] == 'fak left':
  3833. own.setLinearVelocity([outvel.x * 1.01, outvel.y, outvel.z], True)
  3834. if own['grind_out_type'] == 'reg fak right' or own['grind_out_type'] == 'reg fak left' or own['grind_out_type'] == 'fak fak right' or own['grind_out_type'] == 'fak fak left':
  3835. if own['gt_cd2'] == 51:
  3836. if STANCE == False:
  3837. own.applyForce([-200, 0, 0], True)
  3838. own['stance'] = True
  3839. STANCE = True
  3840. if STANCE == True:
  3841. own.applyForce([200, 0, 0], True)
  3842. own['stance'] = False
  3843. STANCE = False
  3844. if own['grind_out_type'] == 'bs reg back' or own['grind_out_type'] == 'bs fak forward':
  3845. if own['gt_cd2'] > 50:
  3846. if STANCE == True:
  3847. own.applyForce([bsforce, 0, 0], True)
  3848. if STANCE == False:
  3849. own.applyForce([bsforce, 0, 0], True)
  3850. own.applyMovement([bs_dloc,0,0], True)
  3851. if own['grind_out_type'] == 'bs fak back' or own['grind_out_type'] == 'bs reg forward':
  3852. if own['gt_cd2'] > 50:
  3853. if STANCE == True:
  3854. own.applyForce([-bsforce, 0, 0], True)
  3855. if STANCE == False:
  3856. own.applyForce([-bsforce, 0, 0], True)
  3857. own.applyMovement([-bs_dloc,0,0], True)
  3858. if own['gt_cd2'] > 0:
  3859. own['gt_cd2'] -= 1
  3860. if own['gt_cd2'] == 0:
  3861. own['grind_out_type'] = None
  3862. if own["grindoutturn"] > 0:
  3863. own["grindoutturn"] = own["grindoutturn"] - 1
  3864. def air_height():
  3865. height = own["air_height"]
  3866. if lf_ground == True and r_ground.triggered == False:
  3867. height = 0
  3868. #wallride
  3869. def wallride():
  3870. wallride_off = own['wallride_off']
  3871. distance = own.getDistanceTo(gray.hitPosition)
  3872. upforce = 25
  3873. sideforce = 15
  3874. try:
  3875. obj = gray.hitObject
  3876. objpos = obj.worldPosition
  3877. ownpos = own.worldPosition
  3878. distance = ownpos.z - objpos.z
  3879. except:
  3880. pass
  3881. if wallrideL.triggered and wallride_off == 0 and r_ground.triggered == False:
  3882. own['jump_timer'] = 0
  3883. if r_ground.triggered == False:
  3884. own["wallride"] = "L"
  3885. cont.activate(wallrideconstL)
  3886. force = [0,sideforce,upforce]
  3887. own.applyForce(force,1)
  3888. #align
  3889. if STANCE == 0:
  3890. own['requestAction'] = 'reg_wall_r'
  3891. else:
  3892. own['requestAction'] = 'fak_wall_l'
  3893. else:
  3894. if own["wallride"] != "R":
  3895. own["wallride"] = None
  3896. cont.deactivate(wallrideconstL)
  3897. if wallrideR.triggered and wallride_off == 0:
  3898. own['jump_timer'] = 0
  3899. if r_ground.triggered == False:
  3900. own["wallride"] = "R"
  3901. cont.activate(wallrideconstR)
  3902. force = [0,-sideforce,upforce]
  3903. own.applyForce(force,1)
  3904. if STANCE == 0:
  3905. own['requestAction'] = 'reg_wall_l'
  3906. else:
  3907. own['requestAction'] = 'fak_wall_r'
  3908. else:
  3909. if own["wallride"] != "L":
  3910. own["wallride"] = None
  3911. cont.deactivate(wallrideconstR)
  3912. def wallride_sound():
  3913. sact = own.actuators["wallSound"]
  3914. if own["wallride"] != None and (own['actionState'] == 'reg_wall_r' or own['actionState'] == 'reg_wall_l' or own['actionState'] == 'fak_wall_r' or own['actionState'] == 'fak_wall_l'):
  3915. sact.volume = .2
  3916. cont.activate(own.actuators["wallSound"])
  3917. else:
  3918. sact.volume = .001
  3919. sact.stopSound()
  3920. if own['revert_timer'] > 0:
  3921. own['revert_timer'] = own['revert_timer'] - 1
  3922. def shutoff_timers():
  3923. if (LAST_GRIND == False and grindHit == True) or (jump_timer > 10 and own['wallride'] == None):
  3924. own["Q1oncd"] = 0
  3925. own["Q2oncd"] = 0
  3926. own["Q3oncd"] = 0
  3927. own["Q4oncd"] = 0
  3928. own["Q5oncd"] = 0
  3929. own["Q6oncd"] = 0
  3930. own["Q7oncd"] = 0
  3931. own["Q8oncd"] = 0
  3932. def grindout_cleanup():
  3933. lgf = own['last_grind_frame']
  3934. def trans_jump():
  3935. if own['jump_from_trans'] == 1:
  3936. ground_ray = cont.sensors['ground_look']
  3937. jump_obj = own['trans_jump_obj']
  3938. jump_obj = scene.objects[str(own['trans_jump_obj'])]
  3939. worldVect = [1, 0, 0]
  3940. vect = jump_obj.getAxisVect(worldVect)
  3941. go = jump_obj.worldOrientation
  3942. grinder_axis = [0,1,0]
  3943. player_pos = own.worldPosition
  3944. jump_obj = jump_obj.worldPosition
  3945. try:
  3946. delta = player_pos - jump_obj
  3947. except:
  3948. pass
  3949. delta = delta.cross(vect)
  3950. deltamove = delta[1] * .25
  3951. move = [deltamove, 0, 0]
  3952. if abs(deltamove) < 1 and delta[1] < 1:
  3953. own.applyMovement(move, True)
  3954. def air_mover():
  3955. if r_ground.triggered == False and jump_timer > 53 and frames_since_grinding > 50:
  3956. if lUD > 0.075:
  3957. if STANCE == 0:
  3958. force2 = [120, 0, 10]
  3959. if STANCE == 1:
  3960. force2 = [-120, 0, 10]
  3961. own.applyForce(force2, True)
  3962. own['no_grind_pull'] = 1
  3963. if r_ground.triggered == False and jump_timer > 53 and frames_since_grinding > 50:
  3964. if lUD < -0.075:
  3965. own['no_grind_pull'] = 1
  3966. if r_ground.triggered == False and jump_timer > 10 and lUD > 0.075 and frames_since_grinding > 50:
  3967. if STANCE == 0:
  3968. force2 = [7, 0, 10]
  3969. if STANCE == 1:
  3970. force2 = [-7, 0, 10]
  3971. own.applyForce(force2, True)
  3972. own.applyForce([0,0,5], False)
  3973. own['air_mover'] = True
  3974. own['no_grind_pull'] = 1
  3975. else:
  3976. own['air_mover'] = False
  3977. def dropinRotate():
  3978. if own['dropinTimer'] > 30 and own['dropinTimer'] < 40:
  3979. rot = [ 0.01, 0.0, 0]
  3980. vel = [linVelocity.x - .25, linVelocity.y, linVelocity.z - .01]
  3981. if STANCE == 1:
  3982. rot = [-0.01, 0.0, 0]
  3983. vel = [linVelocity.x + .25, linVelocity.y, linVelocity.z - .01]
  3984. local = True
  3985. own.applyRotation(rot,local)
  3986. own.setLinearVelocity(vel, local)
  3987. if own['dropinTimer'] == 50:
  3988. if STANCE == 1:
  3989. force = (linVelocity.x +1, linVelocity.y, linVelocity.z )
  3990. else:
  3991. force = (linVelocity.x -1, linVelocity.y, linVelocity.z )
  3992. own.setLinearVelocity(force, True)
  3993. framenum = own['framenum']
  3994. last_ground_frame = own['lF_ground_frame']
  3995. lF_air_frame = own['lF_air_frame']
  3996. frames_since_ground = framenum - lF_air_frame
  3997. if framenum - lF_air_frame > 30:
  3998. own['no_grind_pull'] = 0
  3999. def wallhit():
  4000. linvelx = linVelocity.x
  4001. lastx = own["linvelx"]
  4002. wallsens = cont.sensors['wall']
  4003. if frames_since_ground > 20 and (abs(lastx) - abs(linvelx)) > .5 and wallsens.positive:
  4004. velx = linVelocity.x * -1.5
  4005. if velx > 0 and velx < 1:
  4006. velx = 1
  4007. if velx < 0 and velx > -1:
  4008. velx = -1
  4009. force = (velx, linVelocity.y, linVelocity.z )
  4010. own.setLinearVelocity(force, True)
  4011. def land_boost():
  4012. linvelx = linVelocity.x
  4013. lastx = own["linvelx"]
  4014. if frames_since_ground < 10 and (abs(lastx) - abs(linvelx)) > .5:
  4015. #print('land boost')
  4016. force = (lastx, linVelocity.y, linVelocity.z )
  4017. own.setLinearVelocity(force, True)
  4018. jump_Timer()
  4019. check_landing()
  4020. nextframe()
  4021. wheelroll()
  4022. rollsound()
  4023. reset_pos()
  4024. ylimit()
  4025. getoffboard()
  4026. #switchcam()
  4027. move_flycam()
  4028. move_followcam()
  4029. grind_turn()
  4030. air_height()
  4031. wallride()
  4032. wallride_sound()
  4033. shutoff_timers()
  4034. grindout_cleanup()
  4035. air_mover()
  4036. dropinRotate()
  4037. onboard()
  4038. #wallhit()
  4039. linvelx = own.getLinearVelocity(True)
  4040. land_boost()
  4041. own["linvelx"] = linvelx.x
  4042. LAST_STANCE = STANCE
  4043. LAST_STANCE = own["stance"]
  4044. own["last_stance"] = STANCE
  4045. own["lastGrab"] = GRAB_ON
  4046. own['ground'] = r_ground.triggered
  4047. own['last_ground'] = r_ground.triggered
  4048. own["LAST_GRIND"] = grindHit
  4049. own["rotz"] = rot.z
  4050. own['walk'] = 0
  4051. own['lasty'] = yBut
  4052. own['lastlts'] = ltsBut
  4053. own['lastrts'] = rtsBut
  4054. own["lF_ground2"] = own["lF_ground"]
  4055. own['last_invert'] = invert_on
  4056. own['grab_type'] = grab_type
  4057. own['last_last_manual'] = own['last_manual']
  4058. own['last_manual'] = own['manual']
  4059. own['last_reg_manual'] = own['reg_manual']
  4060. own['last_fak_manual'] = own['fak_manual']
  4061. own['last_fak_nmanual'] = own['fak_nmanual']
  4062. own['last_reg_nmanual'] = own['reg_nmanual']
  4063. if own['manual'] == 1:
  4064. own['last_manual_frame'] = frame
  4065. own['last_hippy'] = own['hippy']
  4066. if aBut == 1 and own["lasta"] == 0:
  4067. own["lastaf"] = frame
  4068. if xBut == 1 and own["lastx"] == 0:
  4069. own["lastxf"] = frame
  4070. own["lasta"] = aBut
  4071. own["lastx"] = xBut
  4072. own['lastaBut_ground'] = aBut_ground
  4073. own['lastxBut_ground'] = xBut_ground
  4074. own["last_sel"] = own["sel"]
  4075. own["sel"] = bkBut
  4076. if r_ground.triggered and own["jump_timer"] < 20:
  4077. force2 = [0.0, 0, -10]
  4078. own.applyForce(force2, True)
  4079. if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
  4080. own['grindType'] = ''
  4081. dict['walk'] = 0