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 176KB

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