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

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