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

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