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

controller2.py 171KB

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