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

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