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

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