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

controller2.py 167KB

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