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

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