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

controller2.py 171KB

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