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

controller2.py 161KB

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