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

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