Shuvit game release repo.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

controller2.py 161KB

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