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

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