Shuvit game release repo.
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 161KB

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