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

controller2.py 178KB

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