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

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