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

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