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

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