Shuvit game master repo. http://shuvit.org
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

controller2.py 174KB

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