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

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