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

controller2.py 166KB

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