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

controller2.py 171KB

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