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

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