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

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