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

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