Shuvit game release repo.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

controller2.py 174KB

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