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

controller2.py 171KB

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