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

controller2.py 171KB

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