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

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