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

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