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

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