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

controller2.py 171KB

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