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 - Copy.py 175KB

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