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 182KB

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