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

controller2.py 176KB

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