Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

controller2.py 178KB

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