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

controller2.py 167KB

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