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

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