Shuvit game release repo.
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 171KB

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