123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431 |
- #shuvit.org
-
- # control script
-
- import bge
- import GameLogic
- import ctypes
- import math
- from sys import platform
- from mathutils import Vector
- import mathutils
- import joytimers
- import sound_man
-
- def main():
- scene = bge.logic.getCurrentScene()
-
- #number of frames / length of the location timers
- countdown = 20
-
- cont = GameLogic.getCurrentController()
- char = bge.constraints.getCharacter
- own = cont.owner
- dict = bge.logic.globalDict #Get the global dictionary
-
- #last frame stuff
- lGRAB_ON = own["lGRAB_ON"]
- lastgrab = own["lastGrab"]
- lastpump = own["lastPump"]
- lf_ground = own["lF_ground"]
- lastopos = own["last_Opos"]
- lastnopos = own["last_nOpos"]
- LAST_STANCE = own["last_stance"]
- LAST_GROUND = own["last_ground"]
- lastStop = own["lastStop"]
- LAST_LEFT = own["LAST_LEFT"]
- last_trick_string = dict.get('last_trick_sting')
- lasta = own["lasta"]
- lastx = own["lastx"]
- lastaf = own["lastaf"]
- lastxf = own["lastxf"]
- lgf = own['last_grind_frame']
- frame = own['framenum']
- frames_since_grinding = frame - lgf
- ground_since = own["framenum"] - own['lF_air_frame']
- gsf = frame - own['grind_start_frame']
- own['last_footplant'] = own['footplant_on']
- lastaBut_ground = own['lastaBut_ground']
- lastxBut_ground = own['lastxBut_ground']
- aBut_ground = own['aBut_ground']
- xBut_ground = own['xBut_ground']
- own['last_manual_v2'] = own['manual_v2']
- lRequest = own['requestAction']
- lAs = own['actionState']
-
-
- #current frame stuff
- GRAB_ON = own["GRAB_ON"]
- pumpon = own["Pump"]
- vib_countdown = own["vib_Countdown"]
- grindold = own['grindOld']
- LAST_GRIND = own["LAST_GRIND"]
- grindTouch = cont.sensors['grindCol_bottom']
- touched = grindTouch.triggered
- leftgrabon = own["Leftgrabon"]
- rightgrabon = own["Rightgrabon"]
- linvel = own.getLinearVelocity
- zvel = own.worldLinearVelocity.z
- own["Zvel"] = zvel
- r_ground = cont.sensors["r_Ground"]
- trigger = r_ground.triggered
- STANCE = own["stance"]
- motion = cont.actuators['MotionPump']
- linVelocity = own.getLinearVelocity(True)
- countdown = own['countdown']
- jump_timer = own['jump_timer']
- pos = own.localPosition
- rot = own.getAxisVect([0.0, 0.0, 1.0])
- gray = cont.sensors["gRay"]
- #pop = cont.actuators["pop"]
- grindHit = own["grindHit"]
- #grindCement = cont.actuators["grind_cement"]
- #grindRail = cont.actuators["grind_rail"]
- grindSound = own["grindSound"]
- skater = scene.objects["Char4"]
- deck = scene.objects["b_deck"]
- trucks = scene.objects["b_trucks"]
- wheel1 = scene.objects["wheel1"]
- wheel2 = scene.objects["wheel2"]
- wheel3 = scene.objects["wheel3"]
- wheel4 = scene.objects["wheel4"]
- turnsens = .04
- turnsens2 = .06 #air_turn_boost
- grindDar = own["grindDar_hit"]
- grindEmpty = scene.objects["grindEmpty"]
- grindDar2 = grindEmpty.sensors["grindDar2"]
- #invertCol = cont.sensors["invertCol"]
- cam = scene.objects["Camera.003"]
- freecam = scene.objects["freecam"]
- followcam = scene.objects["followcam"]
- coping_on = own["coping"]
- invert_on = own['invert_on']
- grab_type = own['grab_type']
- c_ground = cont.sensors['c_ground']
- #
- control_bottom = scene.objects['control_bottom']
- invertTouch = control_bottom.sensors['grindCol_bottom']
- wallride = own["wallride"]
- wallride_col = cont.sensors['wallride']
- wallrideL = cont.sensors['wallrideL']
- wallrideR = cont.sensors['wallrideR']
- wallrideconstL = cont.actuators['wallrideconstL']
- wallrideconstR = cont.actuators['wallrideconstR']
-
- own['pop_sound'] = 0
- own['land_sound'] = 0
- own['revert_sound'] = 0
- own['grinding'] = False
- #own['fall'] = 0
-
- fliplay = 3
-
- #setable
- MAX_VEL = dict['MAX_VEL']
- SPEEDUP = dict['SPEEDUP']
- SPEEDPUMP = dict['SPEEDPUMP']
- SPEEDPUMPFAST = dict['SPEEDPUMPFAST']
- PUMP_SPEED_SENS = dict['PUMP_SPEED_SENS']
- PUMP_SENS = dict['PUMP_SENS']
- ACCEL = dict['ACCEL']
- CRUISE = dict['CRUISE']
- COUNTDOWN = dict['COUNTDOWN'] #pump and speed stuff
- JUMPHEIGHT = dict['JUMPHEIGHT'] #775#750
- JUMPSTRENGTH = 0
- own['flip_manual_stance'] = 0
- LAND_LAYER = 100
- LAND_END = 20
-
- lLR = dict['lLR']
- lUD = dict['lUD']
- rLR = dict['rLR']
- rUD = dict['rUD']
- lTrig = dict['lTrig']
- rTrig = dict['rTrig']
- aBut = dict['aBut']
- bBut = dict['bBut']
- xBut = dict['xBut']
- yBut = dict['yBut']
- lBump = dict['lBump']
- rBump = dict['rBump']
- bkBut = dict['bkBut']
- stBut = dict['stBut']
- xbBut = dict['xbBut']
- ltsBut = dict['ltsBut']
- rtsBut = dict['rtsBut']
- ldPad = dict['ldPad']
- rdPad = dict['rdPad']
- udPad = dict['udPad']
- ddPad = dict['ddPad']
-
-
- #land balance
- land_overRideL = False
- land_overRideR = False
- land_overRideLb = False
- land_overRideRb = False
-
- joytimers.main(own)
- sr = own['jsr']
- sl = own['jsl']
-
- #2019 ground ray detection
- Axis = 2
- Distance = -10
- End = own.worldPosition + (own.worldOrientation.col[Axis]*Distance)
- Start = own.worldPosition.copy()
- if own['LAST_GRIND']:
- groundRay = own.rayCast(End, Start, 10,'ground', 1, 0, 0, 53247)
- else:
- groundRay = own.rayCast(End, Start, 10,'ground', 1, 0, 0, 61439)
- grindRay = own.rayCast(End, Start, 1,'grind', 1, 1, 0, 61439)
-
- if groundRay[0]:
-
- localHitDist = (own.worldPosition - groundRay[1]).length
- if localHitDist < .4 and own['jump_timer'] < 32:
- onGround = True
- else:
- onGround = False
-
- else:
- #if own['LAST_GRIND'] == True:
- onGround = False
- #print('not on ground', grindRay[0], own['LAST_GRIND'])
- if grindRay[0] and own['LAST_GRIND'] == True:
-
- onGround = True
- if onGround:
- own['wallride_off'] = 0
- #print(linVelocity.y / linVelocity.x, 'linvels')
- #print(r_ground.triggered)
- try:
- balance = linVelocity.y / linVelocity.x
- except:
- balance = 0
- #print(balance)
- #if ground_since > 0 and ground_since < 5 and jump_timer < 30:
- min_speed = .8
- if ground_since > -1 and ground_since < 60 and (abs(linVelocity.x) > min_speed or abs(linVelocity.y) > min_speed):
- #print(balance, 'balance')
- sens = 2
- sens2 = .8
- sens3 = 1.5
- if balance > sens or balance < - sens:
- #fall
- #if ground_since > -1 and ground_since < 10:
- #print(own['l_actionState'], touched)
- if own['l_actionState'] != None:
- if 'land' in own['l_actionState'] and touched == False:
- own['fall'] = 1
- own['last_fall_frame'] = frame
- #pass
- if balance > sens3:
- #print('land2!!!!!!')
- land_overRideR = True
- elif balance < -sens3:
- #print('land3!!!!!!')
- land_overRideL = True
- elif balance > sens2:
- #print('land2!!!!!!')
- land_overRideRb = True
- elif balance < -sens2:
- #print('land3!!!!!!')
- land_overRideLb = True
- #print(linVelocity.y, '********linvel')
-
- #fliptricks after manuals
- if (frame - own['last_manual_frame']) < 25:
- flip_start_lay = 8
- flipspeed = .4
- own['flipspeed'] = .4
- own['flip_start_lay'] = 8
- #print("chopping flip start")
- else:
- flip_start_lay = 1
- own['flip_start_lay'] = 1
- flipspeed = .6
- own['flipspeed'] = .6
- def printplaying():
- splaying_layers = "S: "
- playing_layers = "D: "
- tplaying_layers = "T: "
- for x in range(9900):
- if skater.isPlayingAction(x):
- #if trucks.isPlayingAction(x):
- #if skater.isPlayingAction(x):
- splaying_layers += str(x)
- splaying_layers += " "
- if deck.isPlayingAction(x):
- #if trucks.isPlayingAction(x):
- #if skater.isPlayingAction(x):
- playing_layers += str(x)
- playing_layers += " "
- if trucks.isPlayingAction(x):
- #if trucks.isPlayingAction(x):
- #if skater.isPlayingAction(x):
- tplaying_layers += str(x)
- tplaying_layers += " "
- print(splaying_layers, playing_layers, tplaying_layers)
-
- if aBut == True and lasta == False and onGround:
- aBut_ground = True
- own['aBut_ground'] = True
- #else:
- if aBut == False:
- aBut_ground = False
- own['aBut_ground'] = False
- if xBut == True and lastx == False and onGround:
- xBut_ground = True
- own['xBut_ground'] = True
- #else:
- if xBut == False:
- xBut_ground = False
- own['xBut_ground'] = False
-
- def killact(layer):
- if skater.isPlayingAction(layer):
- skater.stopAction(layer)
- if deck.isPlayingAction(layer):
- deck.stopAction(layer)
- if trucks.isPlayingAction(layer):
- trucks.stopAction(layer)
-
- def killall():
- for x in range(9000):
- skater.stopAction(x)
- deck.stopAction(x)
- trucks.stopAction(x)
-
- def check_fall():
- playing_frame = 20
- #hitDistance = own.worldPosition.z - r_ground.hitPosition.z
- if skater.isPlayingAction(fliplay):
- playing_frame = skater.getActionFrame(fliplay)
- #if onGround and skater.isPlayingAction(fliplay) and own['jump_timer'] < 40 and playing_frame < 14 and playing_frame > 3:
- if onGround and skater.isPlayingAction(fliplay) and own['jump_timer'] < 45 and playing_frame < 16 and playing_frame > 3:
- hitDistance = own.worldPosition[2] - r_ground.hitPosition[2]
- if hitDistance < dict['fall_height']:
- own['fall'] = 1
- own['last_fall_frame'] = frame
- if STANCE == 0:
- own['requestAction'] = 'reg_air-walk_air'
- if STANCE == 1:
- own['requestAction'] = 'fak_air-walk_air'
- if dict['aBut'] == 1 and dict['bBut'] == 1:
- own['fall'] = 1
- own['last_fall_frame'] = frame
- check_fall()
-
- def check_landing():
- lf_ground = own["lF_ground"]
- STANCE = own["stance"]
- playing_action_frame = skater.getActionFrame(LAND_LAYER)
-
- if ground_since == 4:
- own['no_grind'] = False
- own['jump_from_trans'] = 0
- nearestObject = None
- minDist = None
- detectedObjects = grindDar2.hitObjectList
- if grindDar == 0:
- lastheight = own["air_height"]
- pos = own.worldPosition.z
- dist = lastheight - pos
- dist = dist * 2
- if dist > 1:
- dist = 1
- #own.actuators["land"].volume = dist
- #sact = own.actuators["land"]
- #sact.stopSound()
- #cont.activate(own.actuators["land"])
- cam['sndmgr'].queue_sound(['land', own, cam])
- own['land_sound'] = 1
- if grindDar == 1:
- pass
- own["vib_Countdown"] = 14
- cont.activate(own.actuators["Vibration"])
- if own['manual_v2'] == 0 and grindDar == 0:
- print('landing')
- if STANCE == 0:
- own['requestAction'] = 'reg_land'
- elif STANCE == 1:
- own['requestAction'] = 'fak_land'
-
- vib_countdown = own["vib_Countdown"]
- if vib_countdown > 0:
- vib_countdown = vib_countdown - 1
- own["vib_Countdown"] = vib_countdown
- if vib_countdown == 1:
- #stopAnims()
- stance()
-
- #if lf_ground == False and r_ground.triggered == True and own['jump_timer'] < 40 and grindHit == False and touched == False and LAST_GRIND == False:
- #print(touched, LAST_GRIND)
- #if lf_ground == False and r_ground.triggered == True and own['jump_timer'] < 40 and LAST_GRIND == False and jump_timer != 0:
- #if lf_ground == False and r_ground.triggered == True:
- if ground_since == 3 and own['jump_timer'] < 40:
- print('---landing-b')
- if STANCE == 0:
- own['requestAction'] = 'reg_land'
- elif STANCE == 1:
- own['requestAction'] = 'fak_land'
- lf_ground = onGround
- own["lF_ground"] = lf_ground
-
- #air anim
- if not onGround:
- #pass
- if STANCE == 0:
- own['requestAction'] = 'reg_air'
- own['manual_v2_timer'] = 50
- if STANCE == 1:
- own['requestAction'] = 'fak_air'
- own['manual_v2_timer'] = 50
- else:
- if STANCE == 0:
- own['requestAction'] = 'reg_roll'
- if STANCE == 1:
- own['requestAction'] = 'fak_roll'
-
- #check manual_v2
- if (rUD > dict['man_sens_l'] and rUD < dict['man_sens_r']) or (rUD < -dict['man_sens_l'] and rUD > -dict['man_sens_r']):
- #if (rUD > .04 and rUD < .07):
- #print("zoned")
- timer = own['manual_v2_timer']
- timer = timer + 1
- if timer > 20:
- own['manual_v2'] = 1
- own['manual_v2_timer'] = timer
- if rUD < .04 and rUD > -.04:
- own['manual_v2_timer'] = 0
- own['manual_v2'] = 0
- own['manual_v2_type'] = None
- if own['manual_v2'] == 1:
- if own['last_manual_v2'] == 0:
- if STANCE == 0:
- if rUD > .04 and rUD < .07:
- #print("reg manual")
- own['manual_v2_type'] = 'reg manual'
- if rUD < -.04 and rUD > -.07:
- own['manual_v2_type'] = 'reg nose manual'
-
- if STANCE == 1:
- if rUD > .04 and rUD < .07:
- own['manual_v2_type'] = 'fak manual'
- if lRequest == 'reg_air_tail to manual':
- #print('chaaaaange init')
- own['manual_v2_type'] = 'fak nose manual'
- if rUD < -.04 and rUD > -.07:
- own['manual_v2_type'] = 'fak nose manual'
-
- else:
- #print("flip stance")
- if own['jump_stance'] == 0:
- #print('flipstance 0')
- if own['manual_v2_type'] == 'fak manual':
- own['manual_v2_type'] = 'reg nose manual'
- if own['manual_v2_type'] == 'fak nose manual':
- own['manual_v2_type'] = 'reg manual'
- if lAs == 'fak_air_tail to manual' and own['manual_v2_type'] == 'reg manual':
- #print('---requesting reg nose manual')
- own['manual_v2_type'] = 'reg nose manual'
- if lAs == 'fak_air_nose to nmanual' and own['manual_v2_type'] == 'reg nose manual':
- #print('---requesting reg nose manual')
- own['manual_v2_type'] = 'reg manual'
- if own['jump_stance'] == 1:
- #print('flipstance 1')
- if own['manual_v2_type'] == 'reg manual':
- own['manual_v2_type'] = 'fak nose manual'
- if own['manual_v2_type'] == 'reg nose manual':
- #print("asdfasdfasdfsdfasdfasdf")
- own['manual_v2_type'] = 'fak manual'
- if lAs == 'reg_air_tail to manual' and own['manual_v2_type'] == 'fak manual':
- #print('---requesting fak nose manual')
- own['manual_v2_type'] = 'fak nose manual'
- if lAs == 'reg_air_nose to nmanual' and own['manual_v2_type'] == 'fak nose manual':
- #print('---requesting fak nose manual')
- own['manual_v2_type'] = 'fak manual'
-
- if STANCE == 0 and (own['manual_v2_type'] == 'fak manual' or own['actionState'] == 'fak-reg_nmanual'):
- own['manual_v2_type'] = 'reg nose manual'
- if STANCE == 1 and (own['manual_v2_type'] == 'reg manual' or own['actionState'] == 'reg-fak_nmanual'):
- own['manual_v2_type'] = 'fak nose manual'
- if STANCE == 0 and (own['manual_v2_type'] == 'fak nose manual' or own['actionState'] == 'fak-reg_manual'):
- own['manual_v2_type'] = 'reg manual'
- if STANCE == 1 and (own['manual_v2_type'] == 'reg nose manual' or own['actionState'] == 'reg-fak_manual'):
- own['manual_v2_type'] = 'fak manual'
-
- #check manual
- ####
- #reg
- 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']:
- timer = own["reg_manual_timer"]
- timer = timer + 1
- own["reg_manual_timer"] = timer
- if timer > 20 and rUD < .04:
- own["reg_manual"] = 0
- if rUD <= dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
- own["reg_manual_timer"] = 0
- own["reg_manual"] = 0
- #####
- if own["reg_manual_timer"] > 10 and own["fak_manual"] == 0 and own['reg_nmanual'] == 0:
- own["reg_manual"] = 1
- ######
- if own["reg_manual_timer"] == 0:
- own["reg_manual"] = 0
-
- ####
- #fak
- 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']:
- timer = own["fak_manual_timer"]
- timer = timer + 1
- own["fak_manual_timer"] = timer
- if timer > 20:
- own["fak_manual"] = 0
- if rUD <= dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD >= -.04:
- own["fak_manual_timer"] = 0
- own["fak_manual"] = 0
- if own["fak_manual_timer"] > 10 and own["reg_manual"] == 0:
- own["fak_manual"] = 1
- if own["fak_manual_timer"] == 0:
- own["fak_manual"] = 0
-
- #####
- #reg nmanual
- 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']:
- timer = own["reg_nmanual_timer"]
- timer = timer + 1
- own["reg_nmanual_timer"] = timer
- if timer > 20:
- own["reg_nmanual"] = 0
- if rUD >= -dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD <= .04:
- own["reg_nmanual_timer"] = 0
- own["reg_nmanual"] = 0
-
- if own["reg_nmanual_timer"] > 10 and own["fak_nmanual"] == 0 and own['reg_manual'] == 0 and own['fak_manual'] == 0:
- if own['last_fak_manual'] == False and own['last_reg_manual'] == False and own['last_fak_manual'] == False:
- own["reg_nmanual"] = 1
-
- if own["reg_nmanual_timer"] == 0:
- own["reg_nmanual"] = 0
-
- #####
- #fak nmanual
- #print (rUD)
- 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']:
- timer = own["fak_nmanual_timer"]
- timer = timer + 1
- own["fak_nmanual_timer"] = timer
- if timer > 20:
- own["fak_nmanual"] = 0
- if rUD >= -dict['man_sens_l'] and (STANCE == 1 or STANCE == 0) and rUD <= .04:
- own["fak_nmanual_timer"] = 0
- own["fak_nmanual"] = 0
- if own["fak_nmanual_timer"] > 10 and own["reg_nmanual"] == 0 and own['fak_manual'] == 0 and own['reg_manual'] == 0:
- own["fak_nmanual"] = 1
- if own["fak_nmanual_timer"] == 0 and own['reg_manual'] == 0:
- own["fak_nmanual"] = 0
- if own['last_fak_nmanual'] == 1 and own['fak_nmanual'] == 0:
- pass
-
- def reg_stance_left_off():
- LAST_LEFT = own["LAST_LEFT"]
- own["LAST_LEFT"] = 0
-
- def reg_stance_right_off():
- LAST_RIGHT = own["LAST_RIGHT"]
- own["LAST_RIGHT"] = 0
-
- def reg_stance_on(inc):
- if own["revert_timer"] < 1 and own['manual_v2'] == 0:
- own['requestAction'] = 'reg_roll'
-
- def reg_manual_on():
- if lLR > turnsens:
- own['requestAction'] = 'reg_manual_right'
- elif lLR < -turnsens:
- own['requestAction'] = 'reg_manual_left'
- else:
- own['requestAction'] = 'reg_manual'
-
- def fak_manual_on():
- if lLR > turnsens:
- own['requestAction'] = 'fak_manual_right'
- elif lLR < -turnsens:
- own['requestAction'] = 'fak_manual_left'
- else:
- own['requestAction'] = 'fak_manual'
-
- def reg_nmanual_on():
-
- if lLR > turnsens:
- own['requestAction'] = 'reg_nmanual_right'
- elif lLR < -turnsens:
- own['requestAction'] = 'reg_nmanual_left'
- else:
- own['requestAction'] = 'reg_nmanual'
-
-
- def fak_nmanual_on():
-
- #def fak_manual_on():
- if lLR > turnsens:
- own['requestAction'] = 'fak_nmanual_right'
- elif lLR < -turnsens:
- own['requestAction'] = 'fak_nmanual_left'
- else:
- own['requestAction'] = 'fak_nmanual'
-
- if own['l_actionState'] == 'reg_manual_revert_ccw':
- own['manual_v2_type'] = 'fak nose manual'
- fak_nmanual_on()
- if own['l_actionState'] == 'reg_manual_revert_cw':
- own['manual_v2_type'] = 'fak nose manual'
- fak_nmanual_on()
-
-
- ###########
-
- def reg_stanceinc_on():
- pass
-
- def reg_stanceinc_off():
- pass
-
- def reg_stance_left_on():
- if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
- if own["Pump"] == 1:
- own['requestAction'] = 'reg_pump_left'
- else:
- own['requestAction'] = 'reg_turnLeft'
- LAST_LEFT = own["LAST_LEFT"]
- playing_action_frame = skater.getActionFrame(LAND_LAYER)
- if LAST_LEFT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
- LAST_LEFT = 1
- own["LAST_LEFT"] = 1
-
- def reg_stance_right_on():
- if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
- if own["Pump"] == 1:
- own['requestAction'] = 'reg_pump_right'
- else:
- own['requestAction'] = 'reg_turnRight'
- LAST_RIGHT = own["LAST_RIGHT"]
- playing_action_frame = skater.getActionFrame(LAND_LAYER)
- if LAST_RIGHT == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
- LAST_RIGHT = 1
- own["LAST_RIGHT"] = 1
-
- def fak_stance_on(inc):
- if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1:
- own['requestAction'] = 'fak_roll'
-
- def fak_stance_left_on():
- if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
- if own["Pump"] == 1:
- own['requestAction'] = 'fak_pump_left'
- else:
- own['requestAction'] = 'fak_turnLeft'
- LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
- playing_action_frame = skater.getActionFrame(LAND_LAYER)
- if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
- LAST_LEFT_FAK = 1
- own["LAST_LEFT_FAK"] = 1
- def fak_stance_left_off():
- LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
- own["LAST_LEFT_FAK"] = 0
-
- def fak_stance_right_on():
- if own['manual_v2'] == 0 and own["revert_timer"] < 1 and own['gt_cd2'] < 1 and ground_since > 30:
- if own["Pump"] == 1:
- own['requestAction'] = 'fak_pump_right'
- else:
- own['requestAction'] = 'fak_turnRight'
- LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
- own["LAST_RIGHT_FAK"] = 1
- def fak_stance_right_off():
- LAST_RIGHT_FAK = own["LAST_RIGHT_FAK"]
- own["LAST_RIGHT_FAK"] = 0
-
- def reg_air_on():
- own['requestAction'] = 'reg_air'
-
- def reg_air_off():
- pass
- def fak_air_on():
- flipping = skater.isPlayingAction(fliplay)
- if flipping == False:
- own['requestAction'] = 'fak_air'
-
- def fak_air_off():
- pass
- def stance():
- rotation = .96
- turnsens = 0.06
- if rot.z < .995: inc = 1
- else: inc = 0
- #print(rot.z)
- own['inc'] = inc
- flipping = False
- #ground
- ground_since = own["framenum"] - own['lF_air_frame']
- inc = 0
- if rot.z < .98:
- inc = 1
-
- if onGround and grindHit == False and flipping == False and own["wallride"] == None and own['revert_timer'] < 2:
- if STANCE == 0:
- reg_manual = own['reg_manual']
- fak_manual = own["fak_manual"]
- reg_nmanual = own['reg_nmanual']
- fak_nmanual = own["fak_nmanual"]
- if LAST_STANCE != STANCE or LAST_GROUND != onGround:
- reg_air_off()
- fak_air_off()
- if reg_manual == 0 and fak_manual == 0:
- last_manual = own['last_reg_manual']
- reg_stance_on(inc)
- if own['manual_v2_type'] == 'reg manual':
- reg_manual_on()
- elif own['manual_v2_type'] == 'reg nose manual':
- reg_nmanual_on()
- elif own['manual_v2_type'] == 'fak manual':
- fak_manual_on()
- elif own['manual_v2_type'] == 'fak nose manual':
- fak_nmanual_on()
- if STANCE == 1:
- reg_manual = own['reg_manual']
- fak_manual = own["fak_manual"]
- reg_nmanual = own['reg_nmanual']
- fak_nmanual = own["fak_nmanual"]
- if LAST_STANCE != STANCE or LAST_GROUND != onGround:
- reg_air_off()
- fak_air_off
- if fak_manual == 0:
- last_manual = own['last_fak_manual']
- fak_stance_on(inc)
- if own['manual_v2_type'] == 'fak manual':
- fak_manual_on()
- elif own['manual_v2_type'] == 'fak nose manual':
- fak_nmanual_on()
- elif own['manual_v2_type'] == 'reg manual':
- reg_manual_on()
- elif own['manual_v2_type'] == 'reg nose manual':
- reg_nmanual_on()
- #if own["Pump"] == False:
- if (lLR < -turnsens or dict['kb_la'] == 2) and STANCE == 0:
- reg_stance_left_on()
- if lLR > -turnsens or LAST_GRIND != grindHit or dict['kb_la'] == 0:
- reg_stance_left_off()
- if (lLR > turnsens or dict['kb_ra'] == 2) and STANCE == 0:
- reg_stance_right_on()
- if lLR < turnsens or LAST_GRIND != grindHit or dict['kb_ra'] == 0:
- reg_stance_right_off()
- if (lLR < -turnsens or dict['kb_la'] == 2) and STANCE == 1:
- fak_stance_left_on()
- if lLR > -turnsens or LAST_GRIND != grindHit or dict['kb_la'] == 0:
- fak_stance_left_off()
- if (lLR > turnsens or dict['kb_ra'] == 2) and STANCE == 1:
- fak_stance_right_on()
- if lLR < turnsens or LAST_GRIND != grindHit or dict['kb_ra'] == 0:
- fak_stance_right_off()
- #air
-
- if not onGround and flipping == False:
- if STANCE == 0:
- if LAST_STANCE != STANCE or LAST_GROUND != onGround:
- fak_air_off()
- reg_stance_left_off()
- reg_stance_right_off()
- fak_stance_left_off()
- fak_stance_right_off()
- reg_air_on()
- if STANCE == 1:
- if LAST_STANCE != STANCE or LAST_GROUND != onGround:
- reg_air_off()
- reg_stance_left_off()
- reg_stance_right_off()
- fak_stance_left_off()
- fak_stance_right_off()
- fak_air_on()
-
-
- ###################
- #trick definitions#
- ###################
- def jump():
- #print("jump funct")
- jump_timer = own['jump_timer']
- cont.deactivate(wallrideconstL)
- cont.deactivate(wallrideconstR)
- own['last_jump_frame'] = frame
- own['no_grind_timer'] = 0
-
- if JUMPSTRENGTH != 0:
- height = JUMPSTRENGTH * JUMPHEIGHT
- else:
- height = JUMPHEIGHT
- #if jump_timer == 0:
- if jump_timer < 50:
- jump_timer = 60
- own['jump_timer'] = jump_timer
-
- if zvel < 7 and jump_timer == 60:
- cam['sndmgr'].queue_sound(['pop', own, cam])
- #cont.activate(own.actuators["pop"])
- own['pop_sound'] = 1
- #print("jump")
- #
- posx = own.worldPosition[0]
- posy = own.worldPosition[1]
- posz = own.worldPosition[2]
- jumppos = Vector((posx, posy, posz))
- own['jumpPos'] = jumppos
- force = [0.0, 0.0, height]
- # use local axis
- local = False
- # apply force
- try:
- if 'trans' in r_ground.hitObject:
- #print('jump from trans')
- own['jump_from_trans'] = 1
- own['trans_jump_obj'] = r_ground.hitObject
- except:
- #print('trans jump broke')
- pass
- if grindHit == False:
- if rot.z < .7:
- rotamt = rot.z * .5
- own.applyRotation([0, rotamt, 0], True)
- own['no_grind'] = True
- own['no_grind_pull'] = 1
-
- force2 = [0.0, 0, 150]
- #no jump if on ramp
- if rot.z < .93:
- force2 = [0,0,0]
-
- own.applyForce(force, local)
-
- own.applyForce(force2, True)
- #print("apply jump force1")
- if grindHit == True:
- linvelloc = own.getLinearVelocity(True)
- own.applyForce(force, True)
- force2 = [0.0, 0, 150]
- own.applyForce(force2, True)
- linvelloc2 = own.getLinearVelocity(True)
- force = (linvelloc.x, linvelloc.y, linvelloc2.z)
- own.setLinearVelocity(force, True)
- #print("apply jump force2 grindHit")
-
- own['jump_stance'] = STANCE
- if STANCE == True:
- own["jump_stance"] = 1
- if STANCE == False:
- own["jump_stance"] = 0
- own["jump_stance"] = own["stance"]
- if grindHit == True:
- own['grind_jump'] = 1
- if lLR > turnsens or lLR < -turnsens or lUD > turnsens or lUD < -turnsens:
- own['grindjumpturn'] = True
- num = 1
- if num == 1:
- rString = "R"
- lString = "L"
- cont.deactivate(wallrideconstL)
- cont.deactivate(wallrideconstR)
- if own["wallride"] == "R":
- force = [0, 170, 0]
- own.applyForce(force, True)
- #cont.activate(own.actuators["pop2"])
- cam['sndmgr'].queue_sound(['pop', own, cam])
- jump_timer = 60
- own['jump_timer'] = jump_timer
- if own["wallride"] == "L":
- force = [0, -170, 0] #325
- own.applyForce(force, True)
- #cont.activate(own.actuators["pop2"])
- cam['sndmgr'].queue_sound(['pop', own, cam])
- jump_timer = 60
- own['jump_timer'] = jump_timer
-
- if own['jump_timer'] == 60:
- own['jump_timer'] = 59
-
- def jump_Timer():
- jump_timer = own['jump_timer']
- if jump_timer > 0:
- jump_timer = jump_timer - 1
- own['jump_timer'] = jump_timer
- if own['grindjumpturn'] == True:
- jump_timer = 30
- own['jump_timer'] = jump_timer
-
- def pump():
- velocity = own['velocity']
- #switch
- local = True
- downforce = dict['pump_downforce']
- lF_air_frame = own['lF_air_frame']
- frames_since_ground = own['framenum'] - own['lF_air_frame']
- #if linVelocity.x < MAX_VEL and linVelocity.x >= -0 and STANCE == 1 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:
- if STANCE == 1 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:
- countdown = COUNTDOWN
- yvel = linVelocity.x + SPEEDPUMP
- yvel2 = linVelocity.x + SPEEDPUMPFAST
- own['countdown'] = countdown
- force = [(yvel), 0, linVelocity.z + downforce]
- force2 = [(yvel2), 0, linVelocity.z + downforce]
- if linVelocity.x < MAX_VEL and linVelocity.x >= 0:
- if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
- own.setLinearVelocity(force, local)
- if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
- own.setLinearVelocity(force2, local)
- if own['requestAction'] not in ['fak_pump_left', 'fak_pump_right'] and own['l_actionState'] not in ['fak_turnLeft', 'fak_turnRight']:
- own['requestAction'] = 'fak_pump'
- #reg
- #if linVelocity.x > -MAX_VEL and linVelocity.x <= 0 and STANCE == 0 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:
- if STANCE == 0 and grindHit == False and frames_since_ground > 30 and own['last_manual_v2'] == 0:
- countdown = COUNTDOWN
- yvel = linVelocity.x - SPEEDPUMP
- yvel2 = linVelocity.x - SPEEDPUMPFAST
- own['countdown'] = countdown
- force = [(yvel), 0, linVelocity.z + downforce]
- force2 = [(yvel2), 0, linVelocity.z + downforce]
- if linVelocity.x > -MAX_VEL and linVelocity.x <= 0:
- if rot.z < PUMP_SENS and rot.z > PUMP_SPEED_SENS:
- own.setLinearVelocity(force, local)
- if rot.z < PUMP_SENS and rot.z <= PUMP_SPEED_SENS:
- own.setLinearVelocity(force2, local)
- if own['requestAction'] not in ['reg_pump_left', 'reg_pump_right'] and own['l_actionState'] not in ['reg_turnLeft', 'reg_turnRight']:
- own['requestAction'] = 'reg_pump'
- own["Pump"] = True
- own["lastPump"] = True
-
- def roll():
- if onGround:
- pass
- def stop():
- if (linVelocity.x < .05 and linVelocity.x > -.05) or onGround == False:
- can_stop = 0
- own["lastStop"] = True
- else:
- can_stop = 1
- if can_stop == 1:
- if onGround and STANCE == False:
- own['requestAction'] = 'reg_stop'
- elif onGround and STANCE == True:
- own['requestAction'] = 'fak_stop'
- yvel = linVelocity.x * .985
- force = [(yvel), 0, linVelocity.z]
- own.setLinearVelocity(force, True)
-
- if linVelocity.x < .05 and linVelocity.x > -.05 and own["lastStop"] == True:
- own["lastStop"] == False
-
- def oposin():
- if ground_since > 30:
- if (onGround) and STANCE == False and (own['manual'] == 0 or own['requestAction'] == 'fak_roll'):
- if grindold == 0:
- #print('opos request', own['requestAction'])
-
- if own['requestAction'] == 'reg_turnRight':
- own['requestAction'] = 'reg_pump_right'
- elif own['requestAction'] == 'reg_turnLeft':
- own['requestAction'] = 'reg_pump_left'
- else:
- own['requestAction'] = 'reg_opos'
-
- elif (onGround) and STANCE == True and (own['manual'] == 0 or own['requestAction'] == 'fak_roll'):
- if grindold == 0:
- #print('opos request', own['requestAction'])
- if own['requestAction'] == 'fak_turnRight':
- own['requestAction'] = 'fak_pump_right'
- elif own['requestAction'] == 'fak_turnLeft':
- own['requestAction'] = 'fak_pump_left'
- else:
- own['requestAction'] = 'fak_opos'
- #print('result', own['requestAction'])
- own["last_Opos"] = True
-
- def noposin():
- if ground_since > 30:
- if (onGround) and STANCE == False and own['manual'] == 0:
- if grindold == 0:
- own['requestAction'] = 'reg_nopos'
- elif (onGround) and STANCE == True and own['manual'] == 0:
- if grindold == 0:
- own['requestAction'] = 'fak_nopos'
- own["last_nOpos"] = True
-
- def aollie():
- print("ollie")
- #dict['trick_string'] = 'Ollie'
-
- STANCE = own["stance"]
- wallride = own["wallride"]
- dict['trick_string'] = 'Ollie'
- if (onGround and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_ollie'
- jump()
- elif (onGround and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_ollie'
- jump()
-
- def nollie():
- print("nollie")
- dict['trick_string'] = 'Nollie'
-
- STANCE = own["stance"]
- if (onGround and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own['requestAction'] = 'fak_nollie'
- own["wallride_off"] = 1
- jump()
- elif (onGround and STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie'
- jump()
-
-
- def kickflip():
- print("kickflip")
-
- STANCE = own["stance"]
- print(flip_start_lay)
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_kickflip'
- if onGround:
- jump()
- dict['trick_string'] = 'Kickflip'
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_heelflip'
- if onGround:
- jump()
- if own["wallride"] != 1: jump()
- dict['trick_string'] = 'Heelflip'
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_kickflip'
- if own["wallride"] != None:
- jump()
- dict['trick_string'] = 'Kickflip'
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_heelflip'
- if own["wallride"] != None:
- jump()
- dict['trick_string'] = 'Heelflip'
-
- def inward_heelflip():
- print("inward heelflip")
- dict['trick_string'] = 'Inward Heelflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_inward_heelflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_inward_heelflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def hardflip():
- print("hardflip")
- dict['trick_string'] = 'Hardflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_hardflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_hardflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def nollie_inward_heelflip():
- print("nollie inward heelflip")
- dict['trick_string'] = 'Nollie Inward Heelflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_inward_heelflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_inward_heelflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def nollie_hardflip():
- print("nollie hardflip")
- dict['trick_string'] = 'Nollie Hardflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_hardflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_hardflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
-
- def varial_kickflip():
- print("varial kickflip")
- dict['trick_string'] = 'Varial Kickflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_varial_kickflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_varial_kickflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def nollie_varial_kickflip():
- print("nollie varial kickflip")
- dict['trick_string'] = 'Nollie Varial Kickflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_varial_kickflip'
- if onGround:
- jump()
- elif (onGround and STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_varial_kickflip'
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def nollie_varial_heelflip():
- print("nollie varial heelflip")
- dict['trick_string'] = 'Nollie Varial Heelflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_varial_heelflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_varial_heelflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def varial_heelflip():
- print("varial heelflip")
- dict['trick_string'] = 'Varial Heelflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_varial_heelflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_varial_heelflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def nollie_kickflip():
- print("kickflip")
- STANCE = own["stance"]
- dict['trick_string'] = 'Nollie Kickflip'
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_kickflip'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_kickflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
-
- def heelflip():
- print("heelflip")
-
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_heelflip'
- if onGround:
- jump()
- dict['trick_string'] = 'Heelflip'
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_kickflip'
- if onGround:
- jump()
- dict['trick_string'] = 'Kickflip'
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
-
- def nollie_heelflip():
- print("heelflip")
- dict['trick_string'] = 'Nollie Heelflip'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_heelflip'
- if onGround:
- jump()
- elif (STANCE == True) or (grindHit == True and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_heelflip'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def shuvit():
- print("shuvit")
- dict['trick_string'] = 'Shuvit'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_shuvit'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_shuvit'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def shuvit360():
- print("360shuvit")
- dict['trick_string'] = '360 Shuvit'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_shuvit360'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_shuvit360'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def fsshuvit360():
- print("360shuvit")
- dict['trick_string'] = 'FS 360 Shuvit'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_fsshuvit360'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_fsshuvit360'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def nollie_shuvit():
- print("shuvit")
- dict['trick_string'] = 'Nollie Shuvit'
- STANCE = own["stance"]
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_shuvit'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_shuvit'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def fsshuvit():
- dict['trick_string'] = 'FS Shuvit'
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_fsshuvit'
- if onGround:
- jump()
- elif (STANCE == True) or ((grindHit == True or wallride != None) and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_fsshuvit'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- def nollie_fsshuvit():
- dict['trick_string'] = 'Nollie FS Shuvit'
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_fsshuvit'
- if onGround:
- jump()
- elif (STANCE == True) or (grindHit == True and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_fsshuvit'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- #nollie_shuvit360()
- def nollie_shuvit360():
- dict['trick_string'] = 'Nollie FS Shuvit 360'
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_shuvit360'
- if onGround:
- jump()
- elif (STANCE == True) or (grindHit == True and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_shuvit360'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
-
- #nollie_fsshuvit360()
- def nollie_fsshuvit360():
- dict['trick_string'] = 'Nollie FS Shuvit 360'
- if (STANCE == False) or ((grindHit == True or wallride != None) and STANCE == False):
- own["wallride_off"] = 1
- own['requestAction'] = 'reg_nollie_fsshuvit_360'
- if onGround:
- jump()
- elif (STANCE == True) or (grindHit == True and STANCE == True):
- own["wallride_off"] = 1
- own['requestAction'] = 'fak_nollie_fsshuvit_360'
- if onGround:
- jump()
- if not onGround and STANCE == False:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- elif not onGround and STANCE == True:
- own["wallride_off"] = 1
- if own["wallride"] != None:
- jump()
- #-------
- def reg_frigid_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Frigid'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'reg_frigid'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
- def reg_fsonefoot_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'FS One Foot'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'reg_fsonefoot'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
- def reg_onefoot_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'One Foot'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'reg_onefoot'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def fak_frigid_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Frigid'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_frigid'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
- def fak_fsonefoot_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'FS One Foot'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_fsonefoot'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
- def fak_onefoot_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'One Foot'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_onefoot'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- #----
- def reg_judo_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Judo'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'reg_judo'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def fak_judo_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Judo'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_judo'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def frontside_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Mute'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'frontside_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def backside_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Backside'
- if GRAB_ON == True and not onGround and aBut == True:
- own['requestAction'] = 'reg_fp_rback'
- elif GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'backside_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def fakfrontside_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Mute'
- if GRAB_ON == True and not onGround and aBut == True:
- own['requestAction'] = 'fak_fp_rback'
-
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_frontside_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def fakbackside_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Backside'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_backside_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- #nose/tail grabs
- def frontside_nose_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'FS Nose'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'frontside_nose_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
- def frontside_tail_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'FS Tail'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'frontside_tail_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
- def backside_nose_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'BS Nose'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'backside_nose_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
- def backside_tail_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'BS Tail'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'backside_tail_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def reg_airwalk():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'Airwalk'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'reg_airwalk'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- #switch
- def fak_frontside_nose_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'FS Nose'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_frontside_nose_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def fak_frontside_tail_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'FS Tail'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_frontside_tail_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def fak_backside_nose_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'BS Nose'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_backside_nose_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- def fak_backside_tail_grab_on():
- GRAB_PLAYED = own["GRAB_PLAYED"]
- GRAB_ON = own["GRAB_ON"]
- dict['trick_string'] = 'BS Tail'
- if GRAB_ON == True and GRAB_PLAYED == False and not onGround:
- own['requestAction'] = 'fak_backside_tail_grab'
- GRAB_PLAYED = True
- own["GRAB_PLAYED)"] = GRAB_PLAYED
-
- #--------------------
-
- def SWAG():
- if onGround:
- SWAG = own["swag"]
- SWAG = own.getLinearVelocity(True)
- SWAG = SWAG[1]
- own["swag"] = SWAG
- if STANCE == True:
- if SWAG > 1 and SWAG < 2:
- rotation = [0.0, 0, (SWAG / 200)]
- own.applyRotation( rotation, True)
- elif SWAG > 2:
- rotation = [0.0, 0, (SWAG / 50)]
- own.applyRotation( rotation, True)
- elif SWAG < -1 and SWAG > -2:
- rotation = [0.0, 0, (SWAG / 200)]
- own.applyRotation( rotation, True)
- elif SWAG < -2:
- rotation = [0.0, 0, (SWAG / 50)]
- own.applyRotation( rotation, True)
- if STANCE == False:
- if SWAG > 1 and SWAG < 2:
- rotation = [0.0, 0, (-SWAG / 200)]
- own.applyRotation( rotation, True)
- elif SWAG > 2:
- rotation = [0.0, 0, (-SWAG / 50)]
- own.applyRotation( rotation, True)
- elif SWAG < -1 and SWAG > -2:
- rotation = [0.0, 0, (-SWAG / 200)]
- own.applyRotation( rotation, True)
- elif SWAG < -2:
- rotation = [0.0, 0, (-SWAG / 50)]
- own.applyRotation( rotation, True)
-
- def air():
- Axis = 2
- Distance = -2
- End = own.worldPosition + (own.worldOrientation.col[Axis]*Distance)
- Start = own.worldPosition
- localRay_v = own.rayCast(End, Start, 0, 'vert', 1, 1, 0)
-
- d2 = 10000
- if onGround:
- d2 = own.getDistanceTo(gray.hitPosition)
-
- if d2 > .3 and own['airup'] == 1 and localRay_v[0] == None:
- #pass
- own.alignAxisToVect(gray.hitNormal, 2, .03)
- if d2 > .3 and own['airup'] == 0 and localRay_v[0] == None:
-
- distance = own.getDistanceTo(gray.hitPosition)
- since_grind_buf = 3
- if gray.hitObject != None and grindDar2.triggered == False and (frame - lgf) > since_grind_buf:
- #add or colliding
- if distance < .5:
- own.alignAxisToVect(gray.hitNormal, 2, .1)
- elif distance >= .5 and distance < 1.75:
- own.alignAxisToVect(gray.hitNormal, 2, .05)
- elif distance >= 1.75:
- own.alignAxisToVect([0.0, 0.0, 1.0], 2, .03)
- else:
- own.alignAxisToVect([0.0, 0.0, 1.0], 2, .03)
- if grindDar2.triggered and (frame - lgf) > since_grind_buf:
- if distance < .5:
- own.alignAxisToVect(gray.hitNormal, 2, .1)
- elif distance >= .5 and distance < 1.75:
- own.alignAxisToVect(gray.hitNormal, 2, .03)
- elif distance >= 1.75:
- own.alignAxisToVect([0.0, 0.0, 1.0], 2, .03)
- elif onGround:
- #if d2 > .4:
- #own.alignAxisToVect([0.0, 0.0, 1.0], 2, .03)
- pass
- def stopAnims():
- pass
-
- def isplaying():
- # for x in range(9000):
- # l1 = deck.isPlayingAction(x)
- # if l1 == True:
- # print(x)
- pass
-
- def nextframe():
- framenumber = own["framenum"]
- framenumber = framenumber + 1
- if framenumber == 900000:
- framenumber = 0
- own["framenum"] = framenumber
- own['last_roll_frame'] = framenumber
-
- def push():
- local = True
- #print("push")
- linVelocity15 = own.linearVelocity
- if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and onGround and own['hippy'] == 0 and own['last_hippy'] == 0 and own['last_footplant'] == False:
- countdown = COUNTDOWN
- yvel = linVelocity15.x + SPEEDUP
- own['countdown'] = countdown
- force = [(yvel), 0, linVelocity15.z]
- own.setLinearVelocity(force, local)
- own['requestAction'] = 'fak_push_goof'
- #switch
- if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and onGround and own['hippy'] == 0 and own['last_hippy'] == 0:
- countdown = COUNTDOWN
- yvel = linVelocity15.x - SPEEDUP
- own['countdown'] = countdown
- force = [(yvel), 0, linVelocity15.z]
- own.setLinearVelocity(force, local)
- own['requestAction'] = 'reg_push'
-
- def push_goof():
- linVelocity15 = own.linearVelocity
- local = True
- #print("push goof")
- if linVelocity15.x < MAX_VEL and linVelocity15.x >= -0 and onGround and own['hippy'] == 0 and own['last_hippy'] == 0:
- countdown = COUNTDOWN
- yvel = linVelocity15.x + SPEEDUP
- own['countdown'] = countdown
- force = [(yvel), 0, linVelocity15.z]
- own.setLinearVelocity(force, local)
- own['requestAction'] = 'fak_push'
- #switch
- if linVelocity15.x > -MAX_VEL and linVelocity15.x < 0 and onGround and own['hippy'] == 0 and own['last_hippy'] == 0:
- countdown = COUNTDOWN
- yvel = linVelocity15.x - SPEEDUP
- own['countdown'] = countdown
- force = [(yvel), 0, linVelocity15.z]
- own.setLinearVelocity(force, local)
- own['requestAction'] = 'reg_push_goof'
-
- def brfoot():
- if STANCE == 0:
- own['requestAction'] = 'reg_brfoot'
- if STANCE == 1:
- own['requestAction'] = 'fak_brfoot'
- jump()
-
- def frfoot():
- if STANCE == 0:
- own['requestAction'] = 'reg_frfoot'
- if STANCE == 1:
- own['requestAction'] = 'fak_frfoot'
- jump()
-
- def blfoot():
- if STANCE == 0:
- own['requestAction'] = 'reg_blfoot'
- if STANCE == 1:
- own['requestAction'] = 'fak_blfoot'
- jump()
-
- def flfoot():
- if STANCE == 0:
- own['requestAction'] = 'reg_flfoot'
- if STANCE == 1:
- own['requestAction'] = 'fak_flfoot'
- jump()
-
- def rollsound():
- #onground
- if onGround and grindDar == 0 and own['invert_on'] == 0:
- num1 = .05
- num2 = .25
- v = .1
- p = 1
- if linVelocity.x <= -num1 and linVelocity.x >= num1:
- #own.actuators["sroll"].volume = .0001
- #cont.deactivate(own.actuators["sroll"])
- #own.actuators["sroll"].stopSound()
- cam['sndmgr'].stop_sound(['roll'])
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .02
- #own.actuators["sroll"].pitch = .65
- v = .02
- p = .65
- num1 = .25
- num2 = .5
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .03
- #own.actuators["sroll"].pitch = .7
- v = .03
- p = .7
- num1 = .5
- num2 = .75
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .04
- #own.actuators["sroll"].pitch = .75
- v = .04
- p = .75
- num1 = .75
- num2 = 1
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .05
- #own.actuators["sroll"].pitch = .8
- v = .05
- p = .8
- num1 = 1
- num2 = 1.5
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .06
- #own.actuators["sroll"].pitch = .85
- v = .06
- p = .85
- num1 = 1.5
- num2 = 2
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .07
- #own.actuators["sroll"].pitch = .9
- v = .07
- p = .9
- num1 = 2
- num2 = 3
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .08
- #own.actuators["sroll"].pitch = .95
- v = .08
- p = .95
- num1 = 3
- num2 = 4
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .09
- #own.actuators["sroll"].pitch = 1
- v = .09
- p = 1.0
- num1 = 4
- num2 = 5
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .11
- #own.actuators["sroll"].pitch = 1.05
- v = .11
- p = 1.05
- num1 = 5
- num2 = 6
- if (linVelocity.x > num1 and linVelocity.x < num2) or (linVelocity.x < -num1 and linVelocity.x > -num2):
- #own.actuators["sroll"].volume = .1
- #own.actuators["sroll"].pitch = 1.1
- v = .1
- p = 1.1
- #own.actuators['sroll'].mode = 2
- #cont.activate(own.actuators["sroll"])
- v = v * 2
- cam['sndmgr'].queue_sound(['roll', own, cam, v, p])
-
- if grindDar == 1 or own['invert_on'] == 1:
- #own.actuators["sroll"].volume = .0001
- #cont.deactivate(own.actuators["sroll"])
- #own.actuators["sroll"].stopSound()
- cam['sndmgr'].stop_sound(['roll'])
-
- #in air
- if not onGround:
- #own.actuators["sroll"].volume = .0001
- #cont.deactivate(own.actuators["sroll"])
- #own.actuators["sroll"].stopSound()
- cam['sndmgr'].stop_sound(['roll'])
-
- #act = cont.actuators["sroll"]
- #own['sroll_vol'] = act.volume
- #own['sroll_pitch'] = act.pitch
-
- def wheelroll():
- #still
- if linVelocity.x <= -0.05 and linVelocity.x >= 0.05:
- wheel1.stopAction(2)
- wheel2.stopAction(2)
- wheel3.stopAction(2)
- wheel4.stopAction(2)
- #regular
- # if linVelocity.x > 0.05 and linVelocity.x < .5:
- # wheel2.playAction("roll1.001", 1, 20, layer=2, play_mode=0, speed=.25)
- # wheel3.playAction("roll2.001", 1, 20, layer=2, play_mode=0, speed=.25)
- # wheel4.playAction("roll3.001", 1, 20, layer=2, play_mode=0, speed=.25)
- # wheel1.playAction("roll4.001", 1, 20, layer=2, play_mode=0, speed=.25)
- # if linVelocity.x > 0.5 and linVelocity.x < 1:
- # wheel2.playAction("roll1.001", 1, 20, layer=2, play_mode=1, speed=1)
- # wheel3.playAction("roll2.001", 1, 20, layer=2, play_mode=1, speed=1)
- # wheel4.playAction("roll3.001", 1, 20, layer=2, play_mode=1, speed=1)
- # wheel1.playAction("roll4.001", 1, 20, layer=2, play_mode=1, speed=1)
- # if linVelocity.x > 1 and linVelocity.x < 4:
- # wheel2.playAction("roll1.001", 1, 20, layer=2, play_mode=1, speed=1.5)
- # wheel3.playAction("roll2.001", 1, 20, layer=2, play_mode=1, speed=1.5)
- # wheel4.playAction("roll3.001", 1, 20, layer=2, play_mode=1, speed=1.5)
- # wheel1.playAction("roll4.001", 1, 20, layer=2, play_mode=1, speed=1.5)
- # if linVelocity.x > 4:
- # wheel2.playAction("roll1.001", 1, 20, layer=2, play_mode=1, speed=2)
- # wheel3.playAction("roll2.001", 1, 20, layer=2, play_mode=1, speed=2)
- # wheel4.playAction("roll3.001", 1, 20, layer=2, play_mode=1, speed=2)
- # wheel1.playAction("roll4.001", 1, 20, layer=2, play_mode=1, speed=2)
- # #switch
- # if linVelocity.x < -0.05 and linVelocity.x > -.5:
- # wheel2.playAction("roll1.001", 20, 1, layer=2, play_mode=0, speed=.25)
- # wheel3.playAction("roll2.001", 20, 1, layer=2, play_mode=0, speed=.25)
- # wheel4.playAction("roll3.001", 20, 1, layer=2, play_mode=0, speed=.25)
- # wheel1.playAction("roll4.001", 20, 1, layer=2, play_mode=0, speed=.25)
- # if linVelocity.x < -0.5 and linVelocity.x > -1:
- # wheel2.playAction("roll1.001", 20, 1, layer=2, play_mode=1, speed=1)
- # wheel3.playAction("roll2.001", 20, 1, layer=2, play_mode=1, speed=1)
- # wheel4.playAction("roll3.001", 20, 1, layer=2, play_mode=1, speed=1)
- # wheel1.playAction("roll4.001", 20, 1, layer=2, play_mode=1, speed=1)
- # if linVelocity.x < -1 and linVelocity > -4:
- # wheel2.playAction("roll1.001", 20, 1, layer=2, play_mode=1, speed=1.5)
- # wheel3.playAction("roll2.001", 20, 1, layer=2, play_mode=1, speed=1.5)
- # wheel4.playAction("roll3.001", 20, 1, layer=2, play_mode=1, speed=1.5)
- # wheel1.playAction("roll4.001", 20, 1, layer=2, play_mode=1, speed=1.5)
- # if linVelocity.x < -4:
- # wheel2.playAction("roll1.001", 20, 1, layer=2, play_mode=1, speed=2)
- # wheel3.playAction("roll2.001", 20, 1, layer=2, play_mode=1, speed=2)
- # wheel4.playAction("roll3.001", 20, 1, layer=2, play_mode=1, speed=2)
- # wheel1.playAction("roll4.001", 20, 1, layer=2, play_mode=1, speed=2)
-
- def turn():
- #rotamt = .02
- rotamt = dict['turn_rotation']
- linVelocity2 = own.getLinearVelocity(True)
- #speed = .004
- speed = dict['turn_addx']
- manual = 0
- multer = abs(round(((round(lLR, 2) * 100) / 8), 1))
- if dict['kb_ra'] == 2 or dict['kb_la'] == 2:
- multer = 1
- if own['manual_v2'] == 1:
- manual = 1
- if abs(linVelocity.x) < 2:
- speed = dict['turn_addx'] + .001
-
- jumpstance = own['jump_stance']
- if lLR > turnsens or lLR < -turnsens:
- own["turn"] = 1
- else:
- own["turn"] = 0
- if lUD > turnsens or lUD < -turnsens:
- own["turnud"] = 1
- else:
- own["turnud"] = 0
-
- turnVel = .01
- #light
- #if manual and grindhit = true
- # if lLR > turnsens and lLR < (turnsens * 1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
- # rotation = [0.0, 0.0, (-rotamt)]
- # local = False # use world axis
- # #own.applyRotation( rotation, local)
-
- # if onGround:
- # #print("light turn")
- # if STANCE == 0:
- # own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
- # if STANCE == 1:
- # own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
- # if lLR < -turnsens and lLR > (turnsens * -1.3) and (grindHit == False or (manual == 1 and grindHit == True)):
- # rotation = [0.0, 0.0, rotamt]
- # local = False # use world axis
- # #own.applyRotation( rotation, local)
-
- # if onGround:
- # #print("light turn")
- # if STANCE == 0:
- # own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
- # if STANCE == 1:
- # own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
- #medium
- max_amt = 3
- if (lLR > (turnsens * 1) or dict['kb_ra'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
- #turn left
- if rot.z < .4:
- rotation = [0.0, 0.0, ((-rotamt * 5) * multer)]
- if rot.z < .6 and rot.z > .4:
- rotation = [0.0, 0.0, ((-rotamt * 2) * multer)]
- else:
- rotation = [0.0, 0.0, ((-rotamt * 1.6) * multer)]
- local = True # use world axis
- own.applyRotation( rotation, local)
- print('rotation = ', rotation)
- if onGround:
- #print("med turn")
- if STANCE == 0:
- own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y - turnVel, linVelocity2.z], 1)
- if STANCE == 1:
- own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y - turnVel, linVelocity2.z], 1)
- elif (lLR < (-turnsens * 1) or dict['kb_la'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)):
- #turn right
- #vert
- if rot.z < .4:
- rotation = [0.0, 0.0, ((rotamt * 5) * multer)]
- #near vert
- if rot.z < .6 and rot.z > .4:
- rotation = [0.0, 0.0, ((rotamt * 2) * multer)]
-
- #normal
- else:
- rotation = [0.0, 0.0, ((rotamt * 1.6) * multer)]
-
- local = True # use world axis
- own.applyRotation( rotation, local)
- #print('rotation = ', rotation)
- if onGround:
- #print("med turn")
- if STANCE == 0:
- own.setLinearVelocity([linVelocity2.x - speed, linVelocity2.y, linVelocity2.z], 1)
- if STANCE == 1:
- own.setLinearVelocity([linVelocity2.x + speed, linVelocity2.y, linVelocity2.z], 1)
-
- #air
- if not onGround and (lLR > turnsens or dict['kb_ra'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
- if STANCE == 0:
- own.applyRotation([0, 0, -dict['turn_air_rotation']], 1)
- if STANCE == 1:
- own.applyRotation([0, 0, -dict['turn_air_rotation']], 1)
- if not onGround and (lLR < -turnsens or dict['kb_la'] == 2) and (grindHit == False or (manual == 1 and grindHit == True)) and own["wallride"] == None:
- if STANCE == 0:
- own.applyRotation([0, 0, dict['turn_air_rotation']], 1)
- if STANCE == 1:
- own.applyRotation([0, 0, dict['turn_air_rotation']], 1)
-
- ###########
- def grindsound():
- dropin = own['dropinTimer']
- lif = own['last_invert_frame']
- #if grindSound != None and grindHit == True and own['nogrindsound'] == 0:
- if own['LAST_GRIND'] and own['nogrindsound'] == 0:
- #if own['LAST_GRIND']:
- if abs(linVelocity.x) > abs(linVelocity.y):
- vel = linVelocity.x
- elif abs(linVelocity.x) < abs(linVelocity.y):
- vel = linVelocity.y
- else:
- vel = 0
- v = .0001
- p = 1.0
- #if grindSound == "rail":
- #cont.deactivate(own.actuators['grind_cement'])
- num1 = .000
- num2 = .05
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .0001
- #own.actuators["grind_rail"].pitch = .6
- v = .00001
- p = .6
- num1 = .05
- num2 = .25
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .05
- #own.actuators["grind_rail"].pitch = .7
- v = .05
- p = .7
- num1 = .25
- num2 = .5
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .1
- #own.actuators["grind_rail"].pitch = .75
- v = .1
- p = .75
- num1 = .5
- num2 = .75
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .14
- #own.actuators["grind_rail"].pitch = .8
- v = .14
- p = .8
- num1 = .75
- num2 = 1
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .17
- #own.actuators["grind_rail"].pitch = .85
- v = .17
- p = .85
- num1 = 1
- num2 = 1.25
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .18
- #own.actuators["grind_rail"].pitch = .9
- v = .18
- p = .9
- num1 = 1.25
- num2 = 2
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .19
- #own.actuators["grind_rail"].pitch = .95
- v = .19
- p = .95
- num1 = 2
- num2 = 40
- if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- #own.actuators["grind_rail"].volume = .19
- #own.actuators["grind_rail"].pitch = 1
- v = .19
- p = 1.0
- #cont.activate(own.actuators['grind_rail'])
-
- if grindSound == 'rail':
- cam['sndmgr'].queue_sound(['grind_rail', own, cam, v, p])
- elif grindSound == 'cement':
- cam['sndmgr'].queue_sound(['grind_cement', own, cam, v, p])
-
- # if grindSound == "concrete":
- # #play sound
- # cont.deactivate(own.actuators['grind_rail'])
- # num1 = .000
- # num2 = .05
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .01
- # own.actuators["grind_cement"].pitch = .6
- # num1 = .05
- # num2 = .25
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .05
- # own.actuators["grind_cement"].pitch = .7
-
- # num1 = .25
- # num2 = .5
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .1
- # own.actuators["grind_cement"].pitch = .75
- # num1 = .5
- # num2 = .75
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .14
- # own.actuators["grind_cement"].pitch = .8
- # num1 = .75
- # num2 = 1
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .17
- # own.actuators["grind_cement"].pitch = .85
- # num1 = 1
- # num2 = 1.25
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .18
- # own.actuators["grind_cement"].pitch = .9
- # num1 = 1.25
- # num2 = 2
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .19
- # own.actuators["grind_cement"].pitch = .95
- # num1 = 2
- # num2 = 40
- # if (vel > num1 and vel < num2) or (vel < -num1 and vel > -num2):
- # own.actuators["grind_cement"].volume = .19
- # own.actuators["grind_cement"].pitch = 1
- # cont.activate(own.actuators['grind_cement'])
- else:
- #cont.deactivate(own.actuators['grind_cement'])
- #cont.deactivate(own.actuators['grind_rail'])
- cam['sndmgr'].stop_sound(['grind_rail'])
- cam['sndmgr'].stop_sound(['grind_cement'])
-
- def record_grindsound():
- pass
- # dropin = own['dropinTimer']
- # lif = own['last_invert_frame']
- # if grindHit == True and dropin == 0 and own['invert_on'] == 0 and own["LAST_GRIND"] == True and own["nogrindsound"] == 0 and (frame - lif > 13):
- # if grindSound == "concrete":
- # act = own.actuators["grind_cement"]
- # own['grindcement_vol'] = act.volume
- # own['grindcement_pitch'] = act.pitch
- # elif grindSound == "rail":
- # act = own.actuators["grind_rail"]
- # own['grindrail_vol'] = act.volume
- # own['grindrail_pitch'] = act.pitch
- # if own["LAST_GRIND"] == False:
- # own['grindcement_vol'] = 0
- # own['grindcement_pitch'] = 0
- # own['grindrail_vol'] = 0
- # own['grindrail_pitch'] = 0
-
- def grind():
- grindsound()
- STANCE = own["stance"]
- jumpstance = own["jump_stance"]
- lif = frame - own['last_invert_frame']
- giniter = 0
- if own['LAST_GRIND'] == False and grindHit == True:
- own['grindstartFrame'] = own['framenum']
- giniter = 1
- 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:
- own['grinding'] = True
- control_bottom = scene.objects['control_bottom']
- grindTouch = control_bottom.sensors['grindCol_bottom']
- edge = 0
- try:
- if 'edge' in grindTouch.hitObject:
- #print('Edge')
- edge = 1
- except:
- pass
-
- gblend = 1
- if LAST_GRIND == 0:
- gt = own['grindType']
- tempstance = 3
- if jumpstance != 3:
- tempstance = jumpstance
- else:
- tempstance = STANCE
- #print(own['grindpos'], own['grindType'], 'pos n type111')
- grindpos = own['grindpos']
- if grindpos == "reg_5050" and own['grindType'] == "empty":
- own['grindType'] = grindpos
- if own['grindType'] == "empty" and grindpos == 'reg_board':
- if STANCE == 0:
- own['grindType'] = "reg_bsboard"
- else:
- own['grindType'] = "fak_bsboard"
-
-
- # if own['grindType'] == '' and grindpos == 'reg_board':
- # if STANCE == 0:
- # own['grindType'] = "reg_bsboard"
- # else:
- # own['grindType'] = "fak_bsboard"
-
- # if own['grindType'] == '' and grindpos == 'reg_board':
- # own['grindType'] = 'reg_bsboard'
-
- #print(own['grindpos'], own['grindType'], 'pos n type')
-
- if STANCE == True:
- if own['grindType'] == "reg_bsboard":
- own['grind_stance'] = 0
- own['requestAction'] = 'reg_bsboard'
- elif own['grindType'] == "fak_bsboard":
- own['grind_stance'] = 1
- own['requestAction'] = 'fak_bsboard'
- elif own['grindType'] == "reg_fsboard":
- own['grind_stance'] = 0
- own['requestAction'] = 'reg_fsboard'
-
- elif own['grindType'] == "fak_noseg":
- own['requestAction'] = 'fak_noseg'
- elif own['grindType'] == "fak_nosegR":
- own['requestAction'] = 'fak_nosegr'
- elif own['grindType'] == "fak_nosegL":
- own['requestAction'] = 'fak_nosegl'
- elif own['grindType'] == "fak_tailg":
- own['requestAction'] = 'fak_tailg'
- elif own['grindType'] == "fak_tailgR":
- own['requestAction'] = 'fak_tailgr'
- elif own['grindType'] == "fak_tailgL":
- own['requestAction'] = 'fak_tailgl'
-
- elif own['grindType'] == "reg_tailg":
- own['requestAction'] = 'fak_noseg'
- elif own['grindType'] == "reg_tailgR":
- own['requestAction'] = 'fak_nosegr'
- elif own['grindType'] == "reg_tailgL":
- own['requestAction'] = 'fak_nosegl'
- elif own['grindType'] == "reg_noseg":
- own['requestAction'] = 'fak_tailg'
- elif own['grindType'] == "reg_nosegR":
- own['requestAction'] = 'fak_tailgr'
- elif own['grindType'] == "reg_nosegL":
- own['requestAction'] = 'fak_tailgl'
-
- elif own['grindType'] == "reg_tailslide":
- own['requestAction'] = 'reg_tailslide'
- if edge == 1:
- own['requestAction'] = 'fak_noseslide'
- print('s = true')
- elif own['grindType'] == "reg_noseslide":
- own['requestAction'] = 'reg_noseslide'
- if edge == 1:
- own['requestAction'] = 'fak_tailslide'
- print('s = true')
- print('reg_noseslide---', STANCE)
- elif own['grindType'] == "fak_tailslide":
- own['requestAction'] = 'fak_tailslide'
- elif own['grindType'] == "fak_noseslide":
- own['requestAction'] = 'fak_noseslide'
- print('fak_noseslide', STANCE)
-
- elif own['grindType'] == "reg_tailslide" and edge == 1:
- own['requestAction'] = 'fak_noseslide'
- print('-----flip stance')
- STANCE = 0
- own['grind_stance'] = 1
- elif own['grindType'] == "fak_tailslide":
- own['requestAction'] = 'fak_tailslide'
- print('-----flip stance')
- own['grind_stance'] = 1
- own['grind_stance'] = 0
- elif own['grindType'] == "reg_noseslide" and edge == 1:
- own['requestAction'] = 'fak_tailslide'
- own['grind_stance'] = 0
- print('-----flip stance')
- own['grind_stance'] = 1
- print('reg_noseslide', STANCE)
- elif own['grindType'] == "fak_noseslide":
- own['requestAction'] = 'fak_noseslide'
- print('-----flip stance')
- own['grind_stance'] = 1
- own['grind_stance'] = 0
- else:
- if STANCE == 0:
- own['requestAction'] = 'reg_5050'
- dict['trick_string'] = '5050'
- #print('5050 a')
- if STANCE == 1:
- own['requestAction'] = 'fak_5050'
- dict['trick_string'] = '5050'
- #print('5050 b')
-
- elif STANCE == False:
- if own['grindType'] == "reg_bsboard":
- own['grind_stance'] = 0
- own['requestAction'] = 'reg_bsboard'
- elif own['grindType'] == "fak_bsboard":
- own['grind_stance'] = 1
- own['requestAction'] = 'fak_bsboard'
- elif own['grindType'] == "reg_tailg":
- own['grind_stance'] = 0
- own['requestAction'] = 'reg_tailg'
- elif own['grindType'] == "reg_tailgR":
- own['requestAction'] = 'reg_tailgr'
- elif own['grindType'] == "reg_tailgL":
- own['requestAction'] = 'reg_tailgl'
- elif own['grindType'] == "reg_noseg":
- own['requestAction'] = 'reg_noseg'
- elif own['grindType'] == "reg_nosegR":
- own['requestAction'] = 'reg_nosegr'
- elif own['grindType'] == "reg_nosegL":
- own['requestAction'] = 'reg_nosegl'
- elif own['grindType'] == "reg_tailslide":
- own['requestAction'] = 'reg_tailslide'
- #if edge == 1:
- #own['requestAction'] = 'fak_noseslide'
- # print('s = false')
- elif own['grindType'] == "reg_noseslide":
- own['requestAction'] = 'reg_noseslide'
- #if edge == 1:
- #own['requestAction'] = 'fak_tailslide'
- #print('s = false')
- elif own['grindType'] == "fak_tailslide":
- own['requestAction'] = 'fak_tailslide'
- if edge == 1:
- own['requestAction'] = 'reg_noseslide'
- print('s = false')
- elif own['grindType'] == "fak_noseslide":
- own['requestAction'] = 'fak_noseslide'
- if edge == 1:
- own['requestAction'] = 'reg_tailslide'
- print('s = false')
- elif own['grindType'] == "fak_noseg":
- own['requestAction'] = 'reg_tailg'
- elif own['grindType'] == "fak_nosegR":
- own['requestAction'] = 'reg_tailgr'
- elif own['grindType'] == "fak_nosegL":
- own['requestAction'] = 'reg_tailgl'
- elif own['grindType'] == "fak_tailg":
- own['requestAction'] = 'reg_noseg'
- elif own['grindType'] == "fak_tailgR":
- own['requestAction'] = 'reg_nosegr'
- elif own['grindType'] == "fak_tailgL":
- own['requestAction'] = 'reg_nosegl'
-
- # elif own['grindType'] == "fak_tailslide" and edge == 1:
- # own['grind_stance'] = 1
- # own['requestAction'] = 'reg_noseslide'
- # elif own['grindType'] == "reg_noseslide" and edge == 1:
- # own['grind_stance'] = 0
- # own['requestAction'] = 'reg_noseslide'
- # print('reg_noseslide', STANCE)
- elif own['grindType'] == "fak_noseslide" and edge == 1:
- own['grind_stance'] = 1
- own['requestAction'] = 'reg_tailslide'
- else:
- if STANCE == 0:
- own['requestAction'] = 'reg_5050'
- #print('5050 c')
- if STANCE == 1:
- own['requestAction'] = 'fak_5050'
- #print('5050 d')
-
- #print(own['requestAction'], 'end ra', own['grindType'])
- if 'fak' in own['l_actionState']:
- STANCE = 1
- own['lg_stance'] = 1
- lg_stance = 1
- if 'reg' in own['l_actionState']:
- STANCE = 0
- own['lg_stance'] = 0
- lg_stance = 0
- own['stance'] = STANCE
-
- if own['requestAction'] == 'reg_5050' and own['grindpos'] == 'reg_board':
- own['requestAction'] = 'reg_bsboard'
- if own['requestAction'] == 'fak_5050' and own['grindpos'] == 'reg_board':
- own['requestAction'] = 'fak_bsboard'
-
-
- def rotmult():
- if onGround:
- num = ((rot.z * -1) +1)
- num = num * 100
-
- def airup():
- if not onGround:
- pos = own.worldPosition
- pos = own.worldPosition.z
- last_pos = own['last_posz']
- if last_pos - pos > 0:
- own['airup'] = 0
- if last_pos - pos < 0:
- own['airup'] = 1
- if pos > own['last_posz']:
- own["air_height"] = pos
- own['last_posz'] = pos
- else:
- own['airup'] = 0
-
- def onramp():
- if r_ground.positive:
- if 'ramp' in r_ground.hitObject:
- own['onramp'] = 60
- own['last_ramp'] = frame
- own['no_grind_timer'] = 60
- #print('on ramp')
- else:
- own['onramp'] = 0
-
- else:
-
- if own['onramp'] > 0:
- own['onramp'] -= 1
-
- def grindtype(gtype):
- own['grindType'] = gtype
-
- def coping():
- if invertTouch.positive:
- own["coping"] = 1
- else:
- own["coping"] = 0
-
- def onboard():
- if own['walk'] == 1 and own['lasty'] == False and own['requestAction'] not in ['reg_dropin', 'fak_dropin']:
- cont.deactivate(cam.actuators['replayCam'])
- cont.activate(cam.actuators['Camera'])
- killall()
- walklay = 40
- ob_speed = .5
- if STANCE == 0:
- killall()
- if own['dropinCol'] == True:
- own['requestAction'] = 'reg_dropin'
- own['dropinTimer'] = 60
- else:
- own['requestAction'] = 'reg_onboard'
- force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
- if own['dropinTimer'] == 0:
- own.setLinearVelocity(force, True)
- if STANCE == 1:
- killall()
- if own['dropinCol'] == True:
- own['requestAction'] = 'fak_dropin'
- own['dropinTimer'] = 60
- else:
- own['requestAction'] = 'fak_onboard'
- force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
- if own['dropinTimer'] == 0:
- own.setLinearVelocity(force, True)
-
- else:
- num = own['dropinTimer']
- if num > 0:
- num = num - 1
- own['dropinTimer'] = num
-
- def offboard():
- wheel1.stopAction(2)
- wheel2.stopAction(2)
- wheel3.stopAction(2)
- wheel4.stopAction(2)
- #cont.deactivate(own.actuators["sroll"])
- #sact = own.actuators["sroll"]
- #sact.volume = .0001
- #own.actuators["sroll"].stopSound()
- cam['sndmgr'].stop_sound(['roll'])
- own['offboard_vel'] = own.linearVelocity
- own['walk_timer'] = 0
-
- def resetjumpstance():
- if LAST_GRIND == True and grindHit == False:
- own["lF_ground_frame"] = own['framenum']
- lfg = own["lF_ground_frame"]
- #print(lfg, "----- this?")
- if own['jump_stance'] != 3:
- own['jump_stance'] = 3
-
- def grass():
- try:
- if 'grass' in r_ground.hitObject:
- linVel = own.getLinearVelocity(True)
- linvelx = linVel.x * dict['grass_mult']
- own.setLinearVelocity((linvelx, linVel.y, linVel.z), 1)
- except:
- pass
-
- def grindoutair():
- skippy = 0
- linVel = own.getLinearVelocity(True)
- STANCE = own['stance']
- if own['LAST_GRIND'] == True and grindHit == True:
- own['lg_stance'] = STANCE
- lg_stance = own['lg_stance']
- own.actuators["grindoutair"].useLocalLinV = True
- if own['grindjumpturn'] == True and own['grindCountdown'] > 12 and skippy == 0:
- if 'fak' in own['l_actionState']:
- STANCE = 1
- own['lg_stance'] = 1
- lg_stance = 1
- #print('changing stance 1')
- if 'reg' in own['l_actionState']:
- STANCE = 0
- own['lg_stance'] = 0
- lg_stance = 0
- #print('changing stance 0')
- own['stance'] = STANCE
- grindoutspeed = .1
- grindoutspeed2 = 5.4
- if lLR > turnsens:
- if own['last_grindpos'] == 'reg_5050':
- if STANCE == 0:
- own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
- else:
- own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
- cont.activate(own.actuators["grindoutair"])
-
- if lLR < -turnsens:
- if own['last_grindpos'] == 'reg_5050':
- if STANCE == 0:
- own.actuators["grindoutair"].linV = [0, -grindoutspeed, 0]
- else:
- own.actuators["grindoutair"].linV = [0, grindoutspeed, 0]
- cont.activate(own.actuators["grindoutair"])
- if lUD > turnsens:
- js = own['lg_stance']
- linvelx = own.getLinearVelocity(True)
- if own['last_grindpos'] == 'reg_board':
- if js == 1:
- own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
- cont.activate(own.actuators["grindoutair"])
- else:
- own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
- cont.activate(own.actuators["grindoutair"])
- if lUD < -turnsens:
- js = own['lg_stance']
- if own['last_grindpos'] == 'reg_board':
- if js == 0:
- own.actuators["grindoutair"].linV = [-grindoutspeed, 0, 0]
- cont.activate(own.actuators["grindoutair"])
- else:
- own.actuators["grindoutair"].linV = [grindoutspeed, 0, 0]
- cont.activate(own.actuators["grindoutair"])
-
- if LAST_GRIND == False and onGround and own['grindjumpturn'] == True and own['grindCountdown'] < 1:
- own['grindjumpturn'] = False
- if onGround:
- own['grind_jump'] = False
-
- if own['grindjumpturn'] == False or own['grindCountdown'] < 19:
- cont.deactivate(own.actuators["grindoutair"])
- #print(STANCE)
- def set_last_grindpos():
- if own['grindpos'] != None:
- own['last_grindpos'] = own['grindpos']
- def air_pos():
- grindpos = own['grindpos']
- GRAB_ON = own["GRAB_ON"]
- wr = own["wallride"]
- jump_timer = own['jump_timer']
- if rUD > .040 and not onGround and GRAB_ON == False and wr == None and jump_timer < 30:
- if STANCE == 0:
- own['requestAction'] = 'reg_air_tail'
- else:
- own['requestAction'] = 'fak_air_tail'
- elif rUD < -.040 and not onGround and GRAB_ON == False and wr == None and jump_timer < 30:
- if STANCE == 0:
- own['requestAction'] = 'reg_air_nose'
- else:
- own['requestAction'] = 'fak_air_nose'
-
- def air_turn_boost():
- pass
-
- def revert():
- local = True
- rot = [0.0, 0.0, 3.14]
- own.applyRotation(rot, local)
- framenum = own['framenum']
- last_ground_frame = own['lF_ground_frame']
- lF_air_frame = own['lF_air_frame']
- frames_since_ground = framenum - lF_air_frame
- if own['manual_v2_type'] == 'reg manual':
- own['requestAction'] = 'reg_manual_revert_ccw'
- elif own['manual_v2_type'] == 'reg nose manual':
- own['requestAction'] = 'reg_nmanual_revert_ccw'
- elif own['manual_v2_type'] == 'fak manual':
- own['requestAction'] = 'fak_manual_revert_ccw'
- elif own['manual_v2_type'] == 'fak nose manual':
- own['requestAction'] = 'fak_nmanual_revert_ccw'
- else:
- if STANCE == 0:
- own['requestAction'] = 'revert1'
- else:
- own['requestAction'] = 'fak_revert1'
- own['revert_timer'] = 20
- #cont.activate(own.actuators["revertSound"])
- cam['sndmgr'].queue_sound(['revert', own, cam])
- own['revert_sound'] = 1
- dict['trick_string'] = 'Revert'
-
- def revert2():
- local = True
- rot = [0.0, 0.0, -3.14]
- own.applyRotation(rot, local)
- if own['manual_v2_type'] == 'reg manual':
- own['requestAction'] = 'reg_manual_revert_cw'
- elif own['manual_v2_type'] == 'reg nose manual':
- own['requestAction'] = 'reg_nmanual_revert_cw'
- elif own['manual_v2_type'] == 'fak manual':
- own['requestAction'] = 'fak_manual_revert_cw'
- elif own['manual_v2_type'] == 'fak nose manual':
- own['requestAction'] = 'fak_nmanual_revert_cw'
- else:
- if STANCE == 0:
- own['requestAction'] = 'revert2'
- else:
- own['requestAction'] = 'fak_revert2'
- own['revert_timer'] = 20
- #cont.activate(own.actuators["revertSound"])
- cam['sndmgr'].queue_sound(['revert', own, cam])
- own['revert_sound'] = 1
- dict['trick_string'] = 'Revert'
-
- def revert3():
- local = True
- rot = [0.0, 0.0, 3.14]
- own.applyRotation(rot, local)
- if own['manual_v2_type'] == 'reg manual':
- own['requestAction'] = 'reg_manual_revert_ccw'
- elif own['manual_v2_type'] == 'reg nose manual':
- own['requestAction'] = 'reg_nmanual_revert_ccw'
- elif own['manual_v2_type'] == 'fak manual':
- own['requestAction'] = 'fak_manual_revert_ccw'
- elif own['manual_v2_type'] == 'fak nose manual':
- own['requestAction'] = 'fak_nmanual_revert_ccw'
- else:
- if STANCE == 0:
- own['requestAction'] = 'revert3'
- else:
- own['requestAction'] = 'fak_revert1'
- own['revert_timer'] = 20
- #cont.activate(own.actuators["revertSound"])
- cam['sndmgr'].queue_sound(['revert', own, cam])
- own['revert_sound'] = 1
- dict['trick_string'] = 'Revert'
-
- def revert4():
- local = True
- rot = [0.0, 0.0, 3.14]
- own.applyRotation(rot, local)
- if own['manual_v2_type'] == 'reg manual':
- own['requestAction'] = 'reg_manual_revert_cw'
- elif own['manual_v2_type'] == 'reg nose manual':
- own['requestAction'] = 'reg_nmanual_revert_cw'
- elif own['manual_v2_type'] == 'fak manual':
- own['requestAction'] = 'fak_manual_revert_cw'
- elif own['manual_v2_type'] == 'fak nose manual':
- own['requestAction'] = 'fak_nmanual_revert_cw'
- else:
- if STANCE == 0:
- own['requestAction'] = 'revert4'
- else:
- own['requestAction'] = 'fak_revert2'
- own['revert_timer'] = 20
- #cont.activate(own.actuators["revertSound"])
- cam['sndmgr'].queue_sound(['revert', own, cam])
- own['revert_sound'] = 1
- dict['trick_string'] = 'Revert'
-
- def powerslide():
- own['powerslide_counter'] = own['powerslide_counter'] + 1
- since_walk = own['framenum'] - own['last_walk_frame']
- since_grind = own['framenum'] - own['last_grind_frame']
- if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 40:
- own['powerslide_on'] = 1
- if STANCE == 0:
- own['powerslide'] = "reg2"
- if STANCE == 1:
- own['powerslide'] = "fak1"
- linVelocity4 = own.getLinearVelocity(True)
- if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
- newx = linVelocity4.x * .9
- else:
- newx = linVelocity4.x * .98
- force = [newx, linVelocity4.y, linVelocity4.z]
- own.setLinearVelocity(force, True)
- def powerslide2():
- own['powerslide_counter'] = own['powerslide_counter'] + 1
- since_walk = own['framenum'] - own['last_walk_frame']
- since_grind = own['framenum'] - own['last_grind_frame']
- if own['powerslide_counter'] > 15 and since_walk > 100 and since_grind > 100:
- own['powerslide_on'] = 1
- if STANCE == 0:
- own['powerslide'] = "reg1"
- if STANCE == 1:
- own['powerslide'] = "fak2"
- linVelocity4 = own.getLinearVelocity(True)
- if own['powerslide_counter'] > 15 and own['powerslide_counter'] < 18:
- newx = linVelocity4.x * .9
- else:
- newx = linVelocity4.x * .98
- force = [newx, linVelocity4.y, linVelocity4.z]
- own.setLinearVelocity(force, True)
-
- def powerslide_state():
- if own['powerslide_on'] == 1:
- if own['powerslide'] == "reg2":
- own['requestAction'] = 'reg_fs_powerslide'
- if own['powerslide'] == "fak1":
- own['requestAction'] = 'fak_fs_powerslide'
- if own['powerslide'] == "reg1":
- own['requestAction'] = 'reg_powerslide'
- if own['powerslide'] == "fak2":
- own['requestAction'] = 'fak_powerslide'
-
- def powerslide_sound():
- sact = own.actuators["powerslide_sound"]
- if own['powerslide_on'] == 1:
- sact = own.actuators["powerslide_sound"]
- sact.volume = .2
- new_pitch = (abs(linVelocity.x) / 3)
- if new_pitch < 1.1 and new_pitch > .5:
- sact.pitch = new_pitch
- elif new_pitch <= .5:
- sact.pitch = .5
- else:
- sact.pitch = 1.1
- cont.activate(own.actuators["powerslide_sound"])
- else:
- sact.volume = .0
- cont.deactivate(own.actuators["powerslide_sound"])
-
- def check_powerslide():
- try:
- own['last_powerslide_on'] = own['powerslide_on']
- except:
- pass
- psxvel = abs(linVelocity.x)
- 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:
- if lUD > .08:
- powerslide()
- else:
- powerslide2()
- else:
- own['powerslide_on'] = 0
- own['powerslide_counter'] = 0
- if own['last_powerslide_on'] == 0:
- own['powerslide'] = None
-
- def killopos():
- pass
-
-
-
- stopAnims()
- #nextframe()
- air()
- stance()
- turn()
- #rotmult()
- airup()
- onramp()
- #speedmult()
- coping()
- resetjumpstance()
- grass()
- grindoutair()
- set_last_grindpos()
- air_pos()
- air_turn_boost()
- record_grindsound()
- check_powerslide()
- powerslide_state()
- powerslide_sound()
- killopos()
- grind()
- #onboard()
-
-
-
-
- ##################
- ###realcontrols###
- ##################
- # q1
- # q8 q2
- # q7 q3
- # q6 q4
- # q5
- ##################
-
- own['set_revert_timer'] = 0
- ground_since = own["framenum"] - own['lF_air_frame']
- 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):
-
- if sl.q3 < sl.q4 < sl.q5 < sl.q6 < sl.q7:
- if onGround:
- revert()
- sl.reset()
- own['set_revert_timer'] = 1
- if sl.q3 > sl.q4 > sl.q5 > sl.q6 > sl.q7:
- if onGround:
- revert2()
- sl.reset()
- own['set_revert_timer'] = 1
- if sl.q7 < sl.q8 < sl.q1 < sl.q2 < sl.q3:
- if onGround:
- revert3()
- own['set_revert_timer'] = 1
- sl.reset()
- if sl.q7 > sl.q8 > sl.q1 > sl.q2 > sl.q3:
- if onGround:
- revert4()
- own['set_revert_timer'] = 1
- sl.reset()
-
- if rUD > .070 or dict['kb_space'] == 2:
- oposin()
- ground_since = own["framenum"] - own['lF_air_frame']
- 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:
- pump()
- else:
- own["lastPump"] = False
- own["Pump"] = False
- own['jump_stance'] = STANCE
- if rUD > .02 and grindHit == True:
- grindpos = own['grindpos']
- jumpstance = own["jump_stance"]
- if LAST_GRIND == False:
- if grindpos == "reg_stall":
- grindtype("nose_stall") #change
- elif grindpos == "fak_stall":
- grindtype("nose_stall")
- elif grindpos == "reg_5050":
- if jumpstance != 3:
- if jumpstance == 0:
- if rLR > .03:
- grindtype("reg_tailgR")
- elif rLR < -.03:
- grindtype("reg_tailgL")
- else:
- grindtype("reg_tailg")
- if jumpstance == 1:
- if rLR > .03:
- grindtype("fak_tailgR")
- elif rLR < -.03:
- grindtype("fak_tailgL")
- else:
- grindtype("fak_tailg")
- else:
- if STANCE == 0:
- if rLR > .03:
- grindtype("reg_tailgR")
- elif rLR < -.03:
- grindtype("reg_tailgL")
- else:
- grindtype("reg_tailg")
- if STANCE == 1:
- grindtype("fak_tailg")
- elif grindpos == "reg_board":
- if jumpstance != 3:
- if jumpstance == 0:
- grindtype("reg_tailslide")
- if jumpstance == 1:
- grindtype("fak_tailslide")
- STANCE = jumpstance
- own['stance'] = STANCE
- else:
- if STANCE == 0:
- grindtype("reg_tailslide")
- if STANCE == 1:
- grindtype("fak_tailslide")
- else:
- if jumpstance == 0:
- grindtype("reg_tailg")
- if jumpstance == 1:
- grindtype("fak_tailg")
-
- #if q5oncd > 0:
- if sl.q5 > 0:
- own["last_Opos"] = False
- #q1
- if rUD < -0.070:
- noposin()
- if rUD < -0.020 and grindHit == True:
- grindpos = own['grindpos']
- jumpstance = own["jump_stance"]
- if LAST_GRIND == False:
- if grindpos == "reg_5050":
- if jumpstance != 3:
- if jumpstance == 0:
- if rLR > .02:
- grindtype("reg_nosegR")
- elif rLR < -.02:
- grindtype("reg_nosegL")
- else:
- grindtype("reg_noseg")
- if jumpstance == 1:
- if rLR > .02:
- grindtype("fak_nosegR")
- elif rLR < -.02:
- grindtype("fak_nosegL")
- else:
- grindtype("fak_noseg")
- else:
- if STANCE == 0:
- if rLR > .02:
- grindtype("reg_nosegR")
- elif rLR < -.02:
- grindtype("reg_nosegL")
- else:
- grindtype("reg_noseg")
- if STANCE == 1:
- if rLR > .02:
- grindtype("fak_nosegR")
- elif rLR < -.02:
- grindtype("fak_nosegL")
- else:
- grindtype("fak_noseg")
- elif grindpos == "reg_board":
- if jumpstance != 3:
- if jumpstance == 0:
- grindtype("reg_noseslide")
- if jumpstance == 1:
- grindtype("fak_noseslide")
- STANCE = jumpstance
- own['stance'] = STANCE
- else:
- if STANCE == 0:
- grindtype("reg_noseslide")
- if STANCE == 1:
- grindtype("fak_noseslide")
-
- if rUD > -0.020 and rUD <= .020 and LAST_GRIND == False:
- if own['grindpos'] == 'reg_5050':
- grindtype("reg_5050")
- if own['grindpos'] == 'fak_5050':
- grindtype("fak_5050")
-
- if sl.q1 > 0:
- own["last_nOpos"] = False
-
- ###keyboard fliptricks
- if dict['kb_space'] == 3:
- if dict['kb_a'] == 2:
- kickflip()
- elif dict['kb_d'] == 2:
- heelflip()
- elif dict['kb_w'] == 2:
- fsshuvit()
- elif dict['kb_s'] == 2:
- shuvit()
- else:
- aollie()
-
-
- ##########################################
- #trick calls
- ##########################################
-
- # hard flip
- # 6 > 5 > 8
- if sr.q6 > 0 and sr.q5 > 0 and sr.q8 > 0 and sr.q6 <= sr.q5 <= sr.q8:
- print ("Hardflip --- 2")
- dict['trick_string'] = 'Hardflip'
- hardflip()
- sr.reset()
-
- # inward heelflip
- # 4 > 5 > 2
- if sr.q4 > 0 and sr.q5 > 0 and sr.q2 > 0 and sr.q4 <= sr.q5 <= sr.q2:
- inward_heelflip()
- sr.reset()
-
- # nollie hard flip
- # 8 > 1 > 6
- if sr.q8 > 0 and sr.q1 > 0 and sr.q6 > 0 and sr.q8 <= sr.q1 <= sr.q6:
- nollie_hardflip()
- sr.reset()
-
- # nollie inward heelflip
- # 2 > 1 > 4
- if sr.q2 > 0 and sr.q1 > 0 and sr.q4 > 0 and sr.q2 <= sr.q1 <= sr.q4:
- nollie_inward_heelflip()
- sr.reset()
-
- #nollie 360 shuvit
- 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:
- nollie_shuvit360()
- sr.reset()
- print('*nollie 360 shuvit')
-
- #nollie fs 360 shuvit
- 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:
- nollie_fsshuvit360()
- sr.reset()
- print('*nollie fs 360 shuvit')
-
- # varial heelflip
- # 7 < 6 < 2
- if sr.q7 > 0 and sr.q6 > 0 and sr.q2 > 0 and sr.q7 <= sr.q6 <= sr.q2:
- varial_heelflip()
- sr.reset()
-
- # varial kickflip
- # 3 < 4 < 8
- if sr.q3 > 0 and sr.q4 > 0 and sr.q8 > 0 and sr.q3 <= sr.q4 <= sr.q8:
- varial_kickflip()
- sr.reset()
-
- # nollie varial kickflip
- # 3 < 2 < 6
- if sr.q3 > 0 and sr.q2 > 0 and sr.q6 > 0 and sr.q3 <= sr.q2 <= sr.q6:
- nollie_varial_kickflip()
- sr.reset()
-
- # nollie varial heelflip
- # 7 < 8 < 4
- if sr.q7 > 0 and sr.q8 > 0 and sr.q4 > 0 and sr.q7 <= sr.q8 <= sr.q4:
- nollie_varial_heelflip()
- sr.reset()
-
- #360 shuvit
- 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:
- shuvit360()
- sr.reset()
-
- #360 fs shuvit
- 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:
- fsshuvit360()
- sr.reset()
-
- #ollie
- if sr.q5 > 0 and sr.q1 > 0 and sr.q5 < sr.q1:
- aollie()
- sr.reset()
-
- #nollie
- if sr.q5 > 0 and sr.q1 > 0 and sr.q5 < sr.q1:
- nollie()
- sr.reset()
-
- #kickflip
- if sr.q5 > 0 and sr.q8 > 0 and sr.q5 < sr.q8:
- kickflip()
- sr.reset()
-
- #nollie kickflip
- if sr.q1 > 0 and sr.q6 > 0 and sr.q2 < sr.q6:
- nollie_kickflip()
- sr.reset()
-
- #heelflip
- if sr.q5 > 0 and sr.q2 > 0 and sr.q5 < sr.q2:
- heelflip()
- sr.reset()
-
- #nollie_heelflip
- if sr.q1 > 0 and sr.q4 > 0 and sr.q1 < sr.q4:
- nollie_heelflip()
- sr.reset()
-
- #shuvit
- if sr.q7 > 0 and sr.q5 > 0 and sr.q6 > 0 and sr.q5 <= sr.q6 <= sr.q7:
- shuvit()
- sr.reset()
-
- #nollie_shuvit
- if sr.q7 > 0 and sr.q1 > 0 and sr.q8 > 0 and sr.q1 <= sr.q8 <= sr.q7:
- nollie_shuvit()
- sr.reset()
- print('*nollie shuvit')
-
- #fsshuvit
- if sr.q4 > 0 and sr.q5 > 0 and sr.q3 > 0 and sr.q5 <= sr.q4 <= sr.q3:
- fsshuvit()
- sr.reset()
-
- #nollie_fsshuvit
- if sr.q3 > 0 and sr.q1 > 0 and sr.q2 > 0 and sr.q1 <= sr.q2 <= sr.q3:
- nollie_fsshuvit()
- sr.reset()
- print('*nollie fs shuvit')
-
- def hippy_jump():
- STANCE = own["stance"]
- if own['hippy'] == 1 and own['last_hippy'] == 0:
- if STANCE == 0:
- own['requestAction'] = 'reg_hippy_in'
- if STANCE == 1:
- own['requestAction'] = 'fak_hippy_in'
- if own['hippy'] == 1 and own['last_hippy'] == 1:
- if STANCE == 0:
- own['requestAction'] = 'reg_hippy_in'
- if STANCE == 1:
- own['requestAction'] = 'fak_hippy_in'
- if own['hippy'] == 0 and own['last_hippy'] == 1:
- if rLR > turnsens:
- local = True
- rot = [0.0, 0.0, 3.14]
- own.applyRotation(rot, local)
- if STANCE == 0:
- own['requestAction'] = 'reg_hippy_ncw'
- if STANCE == 1:
- own['requestAction'] = 'fak_hippy_ncw'
- elif rLR < -turnsens:
- local = True
- rot = [0.0, 0.0, -3.14]
- own.applyRotation(rot, local)
- if STANCE == 0:
- own['requestAction'] = 'fak_hippy_nccw'
- if STANCE == 1:
- own['requestAction'] = 'reg_hippy_nccw'
- ##straight
- else:
- if STANCE == 0:
- own['requestAction'] = 'reg_hippy'
- if STANCE == 1:
- own['requestAction'] = 'fak_hippy'
-
- #pushing and hippy jumps
- since_a = frame - lastaf
- since_x = frame - lastxf
- cush = 10
- hippy = 0
- own['hippy'] = 0
-
- if xBut == 1 and aBut == 1 and (lTrig < 0.02 and rTrig < 0.02) and onGround:
- #F"hippy")
- hippy = 1
- own['hippy'] = 1
-
- hippy_jump()
- 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:
- if xBut == 0 and hippy == 0 and (lastaBut_ground == True or dict['kb_ua'] == 2):
- push()
- if since_x > cush and xBut == 1 and lastx == 1 and (lTrig < 0.02 and rTrig < 0.02) and own['last_hippy'] == 0:
- if aBut == 0 and hippy == 0 and lastxBut_ground == True:
- push_goof()
- #cavemans
- if LAST_GRIND == False and grindHit == False and onGround:
- if (aBut == 0 and own['lastaBut_ground'] == 1) and lTrig > 0.02:
- brfoot()
- if (aBut == 0 and own['lastaBut_ground'] == 1) and rTrig > 0.02:
- frfoot()
- if (xBut == 0 and own['lastxBut_ground'] == 1) and lTrig > 0.02:
- blfoot()
- if (xBut == 0 and own['lastxBut_ground'] == 1) and rTrig > 0.02:
- flfoot()
-
- #push b button
- if bBut == 1:
- if linVelocity.x > .05 or linVelocity.x < -.05:
- stop()
- elif linVelocity.x < .05 or linVelocity.x > -.05:
- if own["lastStop"] == True:
- own["lastStop"] = False
- elif bBut == 0:
- own["lastStop"] = False
- ##### falls
- if own['fall'] == 1:
- offboard()
- own['getoffboard'] = True
- ####
-
- #y button
- if (own['lasty'] == 1 and yBut == 0) or dict['kb_q'] == 3:
- offboard()
-
- if own["GRAB_ON"] == True:
- playing = skater.isPlayingAction(fliplay)
- if playing == 1:
- frame = skater.getActionFrame(fliplay)
- if frame > 16:
- skater.stopAction(fliplay)
-
- flipping = skater.isPlayingAction(fliplay)
-
- #reg_ollie_north
- if rTrig < .02 and lTrig < .02 and not onGround and flipping == False and aBut == True:
- if STANCE == 0:
- own['requestAction'] = 'reg_ollie_south'
- else:
- own['requestAction'] = 'fak_ollie_north'
- if rTrig < .02 and lTrig < .02 and not onGround and flipping == False and xBut == True:
- if STANCE == 0:
- own['requestAction'] = 'reg_ollie_north'
- else:
- own['requestAction'] = 'fak_ollie_south'
-
- #frontside grab
- if rTrig > 0.02 and not onGround and flipping == False:
- GRAB_ON = True
- own["GRAB_ON"] = GRAB_ON
- #print(rTrig, GRAB_ON)
- if aBut == False and xBut == False:
- if STANCE == False and rUD >= -.07 and rUD <= .07:
- frontside_grab_on()
- elif STANCE == True and rUD >= -.07 and rUD <= .07:
- fakbackside_grab_on()
- #front_nose
- if STANCE == True and rUD < -0.070:
- fak_backside_nose_grab_on()
- #front_tail
- elif STANCE == True and rUD > 0.07:
- fak_backside_tail_grab_on()
- #
- if STANCE == False and rUD < -0.070:
- if bBut == True:
- reg_airwalk()
- else:
- frontside_nose_grab_on()
- #front_tail
- elif STANCE == False and rUD > 0.07:
- frontside_tail_grab_on()
- elif aBut == True and xBut == False:
- if STANCE == False:
- reg_fsonefoot_grab_on()
- else:
- fak_onefoot_grab_on()
- elif aBut == False and xBut == True:
- if STANCE == False:
- reg_frigid_grab_on()
- else:
- fak_judo_grab_on()
-
- #backside grab
- if lTrig > 0.02 and not onGround and flipping == False:
- GRAB_ON = True
- own["GRAB_ON"] = GRAB_ON
- #print(rTrig)
- if aBut == False and xBut == False:
- if STANCE == False and rUD >= -.07 and rUD <= .07:
- backside_grab_on()
- elif STANCE == True and rUD >= -.07 and rUD <= .07:
- fakfrontside_grab_on()
- #front_nose
- if STANCE == True and rUD < -0.070:
- fak_frontside_nose_grab_on()
- #front_tail
- elif STANCE == True and rUD > 0.07:
- fak_frontside_tail_grab_on()
- #front_nose
- if STANCE == False and rUD < -0.070:
- if bBut == True:
- reg_airwalk()
- else:
- backside_nose_grab_on()
- #front_tail
- elif STANCE == False and rUD > 0.07:
- backside_tail_grab_on()
-
- elif aBut == True and xBut == False:
- if STANCE == False:
- reg_judo_grab_on()
- else:
- fak_frigid_grab_on()
- elif aBut == False and xBut == True:
- if STANCE == False:
- reg_onefoot_grab_on()
- else:
- fak_frigid_grab_on()
-
- #kill grabs
- if lTrig <= 0.02 and GRAB_ON == True and lTrig >= -.02 and rTrig <= .02 and rTrig >= -.2:
- GRAB_ON = False
- own["GRAB_ON"] = GRAB_ON
- GRAB_PLAYED = False
- own["GRAB_PLAYED"] = GRAB_PLAYED
-
- #frontside pump #backside pump
- def footplant():
- framenum = own['framenum']
- last_ground_frame = own['lF_ground_frame']
- lF_air_frame = own['lF_air_frame']
- frames_since_ground = framenum - lF_air_frame
- frames_since_grind = framenum - own['last_grind_frame']
- if grindHit == True and aBut == True and ground_since < 10:
- own.linearVelocity.x = 0
- own.linearVelocity.y = 0
- own['footplant_on'] = 1
- if grindHit == False:
- own['footplant_on'] = 0
- if own['footplant_on'] == True and rUD < turnsens and rUD > -turnsens:
- own.linearVelocity.x = 0
- own.linearVelocity.y = 0
- if own['footplant_on'] == 1 and own['last_footplant'] == True and own['jump_timer'] < 50:
- if skater.isPlayingAction(2925) == False:
- if STANCE == 0:
- own['requestAction'] = 'reg_fp_rback'
- if STANCE == 1:
- own['requestAction'] = 'fak_fp_rback'
-
- def invert():
- if grindHit == True and own['grindpos'] == 'reg_board' and gsf < 10 and lBump == 1 and rBump == 0:
-
- own['invert_on'] = 1
- own.linearVelocity.x = 0
- own.linearVelocity.y = 0
- else:
- if lBump == 0:
- own['invert_on'] = 0
- if own["coping"] == 1 and own['invert_on'] == 1:
- if own['invert_on'] == 1 and own['last_invert'] == False:
- cont.activate(own.actuators['invertOn_sound'])
- if STANCE == False:
- own['invert_type'] = "reg_back_invert_in"
- if STANCE == True:
- own['invert_type'] = "fak_fr_invert"
- if own['invert_on'] == 0 and own['last_invert'] == True:
- own['last_invert_frame'] = frame
- cont.activate(own.actuators['invertOff_Sound'])
-
- if own['invert_on'] == 1 and own['invert_type'] != None:
- if own['invert_type'] == "reg_back_invert_in":
- own['requestAction'] = 'reg_back_invert'
-
- if own['invert_type'] == "fak_fr_invert":
- own['requestAction'] = 'fak_fr_invert'
- lif = own['last_invert_frame']
- if frame - lif > 3 and own['invert_on'] == 0:
- own['invert_type'] = None
-
- #print(own['requestAction'])
-
- invert()
- footplant()
- #print(own['invert_on'], 'invert_on')
- def reset_pos():
- #reset
- if ddPad == 1:
- spawn_pos = own['spawn_pos']
- spawn_rot = own['spawn_rot']
- spawn_cam_pos = own['spawn_cam_pos']
- spawn_cam_rot = own['spawn_cam_rot']
- try:
- own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
- 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]]
- cam.worldPosition = (spawn_cam_pos[0], spawn_cam_pos[1], (spawn_cam_pos[2]))
- 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]]
- except:
- own.worldPosition = (0, 0, .1)
- own.worldOrientation = [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
-
- if own["spawn_stance"] == 1:
- own.setLinearVelocity([.1,0,0], 1)
-
- else:
- own.setLinearVelocity([-.1,0,0], 1)
-
- if udPad == 1:
-
- own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
- 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]]
- own['spawn_cam_pos'] = [cam.worldPosition[0], cam.worldPosition[1], cam.worldPosition[2]]
- 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]]
- stance = own["stance"]
- own["spawn_stance"] = stance
-
- #start button
- if stBut == True:
- #own.actuators["sroll"].volume = .0001
- #cont.deactivate(own.actuators["sroll"])
- #own.actuators["sroll"].stopSound()
- cam['sndmgr'].stop_sound(['roll'])
- if (stBut == False and dict['last_stBut'] == True) or dict['kb_en'] == 1:
- if own['pause_on'] == True:
- own['pause_on'] = False
- else:
- own['pause_on'] = True
-
- def ylimit():
- lgf = own['last_grind_frame']
- frame = own['framenum']
- frames_since_grinding = frame - lgf
- ylimit = dict['ylimit']
- if ground_since < 20 and ground_since > 1 and grindHit == 0 and own['jump_timer'] < 40:
- ylimit = ylimit + ((ground_since - 15) * -.005)
-
- yvel = own.linearVelocity.y
- yvel = yvel *.03
- if STANCE == 0:
- yvel *= -1
- try:
- if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01:
- own.applyRotation([0, 0, yvel], True)
-
- if ylimit > .99999:
- ylimit = .9999
- except:
- pass
- else:
- if onGround and touched == False and grindHit == 0 and frames_since_grinding > 20:
- yvel = own.linearVelocity.y
- yvel = yvel *.03
- if STANCE == 0:
- yvel *= -1
- try:
- if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01:
- own.applyRotation([0, 0, yvel], True)
-
- except:
- pass
-
- def getoffboard():
- lasty = own['lasty']
- getoffboard = own['getoffboard']
- if getoffboard == 1 and own['fall'] == False:
- own['getoffboard'] = 0
- if (yBut == False and lasty == True) or dict['kb_q'] == 3:
- own['getoffboard'] = 1
-
- def switchcam():
- pass
- # if ltsBut == False and own['lastlts'] == True and rtsBut == False:
- # if own['camera'] == 1:
- # own['camera'] = 0
- # else:
- # own['camera'] = 1
- # if rtsBut == False and own['lastrts'] == True and ltsBut == False:
- # if own['camera'] == 2:
- # own['camera'] = 0
- # else:
- # own['camera'] = 2
- #followcam
- def move_followcam():
- if own['camera'] == 2:
- #if rtsBut == False and own['lastrts'] == True:
- if dict['last_bkBut'] == True and bkBut == False:
- #print("activate move followcam")
- if own['move_followcam'] == False:
- own['move_followcam'] = True
- else:
- own['move_followcam'] = False
- if own['move_followcam'] == True:
- #act = followcam.actuators[
- camspeed1 = .015
- camspeed2 = .055
- camrot1 = .005
- camrot2 = .02
- #up
- if lUD < -0.080:
- followcam.actuators["up"].dLoc = [0, 0, -camspeed2]
- cont.activate(followcam.actuators["up"])
- else:
- cont.deactivate(followcam.actuators["up"])
- # #down
- if lUD > .080:
- followcam.actuators["down"].dLoc = [0, 0, camspeed2]
- cont.activate(followcam.actuators["down"])
- else:
- cont.deactivate(followcam.actuators["down"])
- # #left
- if lLR < -0.080:
- followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
- cont.activate(followcam.actuators["left"])
- else:
- cont.deactivate(followcam.actuators["left"])
- # #right
- if lLR > 0.080:
- followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
- cont.activate(followcam.actuators["right"])
- else:
- cont.deactivate(followcam.actuators["right"])
- #up
- if rUD < -0.080:
- followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
- cont.activate(followcam.actuators["rotup"])
- else:
- cont.deactivate(followcam.actuators["rotup"])
- # #down
- if rUD > .080:
- followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
- cont.activate(followcam.actuators["rotdown"])
- else:
- cont.deactivate(followcam.actuators["rotdown"])
- # #left
- if rLR < -0.080:
- followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
- cont.activate(followcam.actuators["rotleft"])
- else:
- cont.deactivate(followcam.actuators["rotleft"])
- # #right
- if rLR > 0.080:
- followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
- cont.activate(followcam.actuators["rotright"])
- else:
- cont.deactivate(followcam.actuators["rotright"])
-
- #*********************************************
-
- if lUD > -0.080 and lUD < -0.030:
- followcam.actuators["up"].dLoc = [0, 0, -camspeed1]
- cont.activate(followcam.actuators["up"])
- else:
- cont.deactivate(followcam.actuators["up"])
- # #down
- if lUD < .080 and lUD > .03:
- followcam.actuators["down"].dLoc = [0, 0, camspeed1]
- cont.activate(followcam.actuators["down"])
- else:
- cont.deactivate(followcam.actuators["down"])
- # #left
- if lLR > -0.080 and lLR < -0.030:
- followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
- cont.activate(followcam.actuators["left"])
- else:
- cont.deactivate(followcam.actuators["left"])
- # #right
- if lLR < .080 and lLR > .03:
- followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
- cont.activate(followcam.actuators["right"])
- else:
- cont.deactivate(followcam.actuators["right"])
- #up
- if rUD > -0.080 and rUD < -0.030:
- followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
- cont.activate(followcam.actuators["rotup"])
- else:
- cont.deactivate(followcam.actuators["rotup"])
- # #down
- if rUD < .080 and rUD > .03:
- followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
- cont.activate(followcam.actuators["rotdown"])
- else:
- cont.deactivate(followcam.actuators["rotdown"])
- # #left
- if rLR > -0.080 and rLR < -0.030:
- followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
- cont.activate(followcam.actuators["rotleft"])
- else:
- cont.deactivate(followcam.actuators["rotleft"])
- # #right
- if rLR < .080 and rLR > .03:
- followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
- cont.activate(followcam.actuators["rotright"])
- else:
- cont.deactivate(followcam.actuators["rotright"])
- def move_flycam():
- if own['camera'] == 1:
- if dict['last_bkBut'] == True and bkBut == False:
- if own['move_freecam'] == False:
- own['move_freecam'] = True
- else:
- own['move_freecam'] = False
- if own['move_freecam'] == True:
- camspeed1 = .015
- camspeed2 = .055
- camrot1 = .005
- camrot2 = .02
- #up
- if lUD < -0.080:
- freecam.actuators["up"].dLoc = [0, 0, -camspeed2]
- cont.activate(freecam.actuators["up"])
- else:
- cont.deactivate(freecam.actuators["up"])
- # #down
- if lUD > .080:
- freecam.actuators["down"].dLoc = [0, 0, camspeed2]
- cont.activate(freecam.actuators["down"])
- else:
- cont.deactivate(freecam.actuators["down"])
- # #left
- if lLR < -0.080:
- freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
- cont.activate(freecam.actuators["left"])
- else:
- cont.deactivate(freecam.actuators["left"])
- # #right
- if lLR > 0.080:
- freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
- cont.activate(freecam.actuators["right"])
- else:
- cont.deactivate(freecam.actuators["right"])
- #up
- if rUD < -0.080:
- freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
- cont.activate(freecam.actuators["rotup"])
- else:
- cont.deactivate(freecam.actuators["rotup"])
- # #down
- if rUD > .080:
- freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
- cont.activate(freecam.actuators["rotdown"])
- else:
- cont.deactivate(freecam.actuators["rotdown"])
- # #left
- if rLR < -0.080:
- freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
- cont.activate(freecam.actuators["rotleft"])
- else:
- cont.deactivate(freecam.actuators["rotleft"])
- # #right
- if rLR > 0.080:
- freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
- cont.activate(freecam.actuators["rotright"])
- else:
- cont.deactivate(freecam.actuators["rotright"])
-
- #*********************************************
-
- if lUD > -0.080 and lUD < -0.030:
- freecam.actuators["up"].dLoc = [0, 0, -camspeed1]
- cont.activate(freecam.actuators["up"])
- else:
- cont.deactivate(freecam.actuators["up"])
- # #down
- if lUD < .080 and lUD > .03:
- freecam.actuators["down"].dLoc = [0, 0, camspeed1]
- cont.activate(freecam.actuators["down"])
- else:
- cont.deactivate(freecam.actuators["down"])
- # #left
- if lLR > -0.080 and lLR < -0.030:
- freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
- cont.activate(freecam.actuators["left"])
- else:
- cont.deactivate(freecam.actuators["left"])
- # #right
- if lLR < .080 and lLR > .03:
- freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
- cont.activate(freecam.actuators["right"])
- else:
- cont.deactivate(freecam.actuators["right"])
- #up
- if rUD > -0.080 and rUD < -0.030:
- freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
- cont.activate(freecam.actuators["rotup"])
- else:
- cont.deactivate(freecam.actuators["rotup"])
- # #down
- if rUD < .080 and rUD > .03:
- freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
- cont.activate(freecam.actuators["rotdown"])
- else:
- cont.deactivate(freecam.actuators["rotdown"])
- # #left
- if rLR > -0.080 and rLR < -0.030:
- freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
- cont.activate(freecam.actuators["rotleft"])
- else:
- cont.deactivate(freecam.actuators["rotleft"])
- # #right
- if rLR < .080 and rLR > .03:
- freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
- cont.activate(freecam.actuators["rotright"])
- else:
- cont.deactivate(freecam.actuators["rotright"])
-
- if not onGround:
- own["lF_air_frame"] = own["framenum"]
- if onGround:
- own["lF_ground_frame"] = own["framenum"]
-
- if own['LAST_GRIND'] == True:
- own['last_grind_frame'] = own['framenum']
- if own['LAST_GRIND'] == False and onGround and own['jump_timer'] == 0:
- if own['jump_stance'] != 3:
- own['jump_stance'] = 3
-
- def control_calib():
- #controller calibration test
- scenes = bge.logic.getSceneList()
- controller_calib = [scene for scene in scenes if scene.name=="controller_calib"][0]
- cq1 = controller_calib.objects['q1']
- cq2 = controller_calib.objects['q2']
- cq3 = controller_calib.objects['q3']
- cq4 = controller_calib.objects['q4']
- cq5 = controller_calib.objects['q5']
- cq6 = controller_calib.objects['q6']
- cq7 = controller_calib.objects['q7']
- cq8 = controller_calib.objects['q8']
- if lq1on == 1:
- cq1["q1"] = 1
- else:
- cq1["q1"] = 0
- if lq2on == 1:
- cq2["q2"] = 1
- else:
- cq2["q2"] = 0
- if lq3on == 1:
- cq3["q3"] = 1
- else:
- cq3["q3"] = 0
- if lq4on == 1:
- cq4["q4"] = 1
- else:
- cq4["q4"] = 0
- if lq5on == 1:
- cq5["q5"] = 1
- else:
- cq5["q5"] = 0
- if lq6on == 1:
- cq6["q6"] = 1
- else:
- cq6["q6"] = 0
- if lq7on == 1:
- cq7["q7"] = 1
- else:
- cq7["q7"] = 0
- if lq8on == 1:
- cq8["q8"] = 1
- else:
- cq8["q8"] = 0
- def grind_turn():
- jumping = None
- gotcd = 25
- force = [0, 0, 0]
- grindHit = own['grindTouch']
- sincegrinding = own['framenum'] - own['grindstartFrame']
- STANCE = own['stance']
- if rUD > turnsens or rLR > turnsens or rUD < -turnsens or rLR < -turnsens:
- jumping = True
- if grindHit == False:
- cont.deactivate(own.actuators['grindoutRight'])
- cont.deactivate(own.actuators['grindoutLeft'])
- if (LAST_GRIND == True and jumping == None and sincegrinding > 35 and ground_since > 20) or own['invert_on'] == True and LAST_GRIND == 1:
- outloc = 0.022
- bsoutloc = .001#.07
- bsoutvel = .01#.1
- outrot = .06#2 #0.012
- outrot2 = .24
- outact = own.actuators["grindoutRight"]
- STANCE = own['grind_stance']
- if 'fak' in own['l_actionState']:
- STANCE = 1
- if 'reg' in own['l_actionState']:
- STANCE = 0
- if own['grindpos'] == 'reg_5050':
- if sl.q3 >= countdown or sl.q2 >= countdown or dict['kb_ra'] == 2:
- #if lq3on == 1 or lq2on or dict['kb_ra'] == 2:
- if own['gt_cd2'] == 0:
- own['gt_cd2'] = 60
-
- if STANCE == True:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'fak right'
- if STANCE == False:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'reg right'
- own["grindoutturn"] = gotcd
- if sl.q7 >= countdown or sl.q8 >= countdown or dict['kb_la'] == 2:
- #if lq7on == 1 or lq8on or dict['kb_la'] == 2:
- if own['gt_cd2'] == 0:
- own['gt_cd2'] = 60
- if STANCE == True:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'fak left'
- if STANCE == False:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'reg left'
- own["grindoutturn"] = gotcd
- #if lq4on == 1:
- if sl.q4 >= countdown:
- if own['gt_cd2'] == 0:
- own['gt_cd2'] = 60
- if STANCE == True:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'fak fak right'
- if STANCE == False:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'reg fak right'
- own["grindoutturn"] = gotcd
- #if lq6on == 1:
- if sl.q6 >= countdown:
- if own['gt_cd2'] == 0:
- own['gt_cd2'] = 60
- if STANCE == True:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'fak fak left'
- if STANCE == False:
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'reg fak left'
- own["grindoutturn"] = gotcd
- #use stance for 5050 and grindstance for boards
- if own['grindpos'] == 'reg_board':
- outvel = own.getLinearVelocity(1)
- outact.dLoc = [0, 0, 0]
- outact.dRot = [0, 0, 0]
-
-
- #if lq5on == 1 or dict['kb_da'] == 2:
- if sl.q5 >= countdown or dict['kb_da'] == 2:
- if own['gt_cd2'] == 0:
- own['gt_cd2'] = 60
- if STANCE == True:
-
- if own['footplant_on'] == True:
- own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
- cont.activate(own.actuators["grindoutRight"])
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'bs fak back'
- #own.applyRotation((0, .15, 0), True)
- print('board out')
- if STANCE == False:
-
- if own['footplant_on'] == True:
- own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
- cont.activate(own.actuators["grindoutRight"])
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'bs reg back'
- #own.applyRotation((0, -.15, 0), True)
- print('board out')
- own["grindoutturn"] = gotcd
- own['invert_on'] = 0
- if sl.q1 >= countdown or dict['kb_ua'] == 2:
- #if lq1on == 1 or dict['kb_ua'] == 2:
- if own['gt_cd2'] == 0:
- own['gt_cd2'] = 60
- if STANCE == True:
- if own['footplant_on'] == True:
- own.setLinearVelocity([(outvel.x + bsoutvel), outvel.y, outvel.z], 1)
- #cont.activate(own.actuators["grindoutRight"])
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'bs fak forward'
- #own.applyRotation((0, .15, 0), True)
- if STANCE == False:
- if own['footplant_on'] == True:
- own.setLinearVelocity([(outvel.x + -bsoutvel), outvel.y, outvel.z], 1)
- #cont.activate(own.actuators["grindoutRight"])
- if own['grind_out_type'] == None:
- own['grind_out_type'] = 'bs reg forward'
- #own.applyRotation((0, -.15, 0), True)
- own["grindoutturn"] = gotcd
- own['invert_on'] = 0
- #if lq1on or lq2on or lq3on or lq4on or lq5on or lq6on or lq7on or lq8on:
- 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:
- gt_cd = own['gt_cd']
- if gt_cd == 0:
- gt_cd = 30
- own['gt_cd'] = gt_cd
-
- if own['grindoutturn'] == 0:
- cont.deactivate(own.actuators["grindoutRight"])
- own["grindoutturn"] = 0
- gt_cd = own['gt_cd']
- if gt_cd > 0:
- own['gt_cd'] = gt_cd - 1
- else:
- own['gt_cd'] = 0
- #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- reg_move = .05
- reg_rot = 0.02#2
- reg_rot2 = .26
- reg_move2 = .13
- bsforce = 1#50
- bs_dloc = .04
- outvel = own.linearVelocity
- if own["coping"] == 1:
- reg_rot = reg_rot * 3
- if own['gt_cd2'] > 50 and own['jump_timer'] < 20:
- if own['grind_out_type'] == 'reg right':
- own.applyMovement([0, reg_move, 0], True)
- own.applyRotation([0, 0, -reg_rot], True)
- if own['grind_out_type'] == 'fak right':
- own.applyMovement([0, -reg_move, 0], True)
- own.applyRotation([0, 0, -reg_rot], True)
- if own['grind_out_type'] == 'reg left':
- own.applyMovement([0, -reg_move, 0], True)
- own.applyRotation([0, 0, reg_rot], True)
- if own['grind_out_type'] == 'fak left':
- own.applyMovement([0, reg_move, 0], True)
- own.applyRotation([0, 0, reg_rot], True)
- if own['grind_out_type'] == 'reg fak right':
- if own['gt_cd2'] > 55:
- own.applyMovement([0, reg_move2, 0], True)
- own.applyRotation([0, 0, reg_rot2], True)
- if own['grind_out_type'] == 'fak fak right':
- if own['gt_cd2'] > 55:
- own.applyMovement([0, -reg_move2, 0], True)
- own.applyRotation([0, 0, reg_rot2], True)
- if own['grind_out_type'] == 'reg fak left':
- if own['gt_cd2'] > 55:
- own.applyMovement([0, -reg_move2, 0], True)
- own.applyRotation([0, 0, -reg_rot2], True)
- if own['grind_out_type'] == 'fak fak left':
- if own['gt_cd2'] > 55:
- own.applyMovement([0, reg_move2, 0], True)
- own.applyRotation([0, 0, -reg_rot2], True)
- 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':
- own.setLinearVelocity([outvel.x * 1.01, outvel.y, outvel.z], True)
- 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':
- if own['gt_cd2'] == 51:
- if STANCE == False:
- own.applyForce([-200, 0, 0], True)
- own['stance'] = True
- STANCE = True
- if STANCE == True:
- own.applyForce([200, 0, 0], True)
- own['stance'] = False
- STANCE = False
- if own['grind_out_type'] == 'bs reg back' or own['grind_out_type'] == 'bs fak forward':
- if own['gt_cd2'] > 50:
- if STANCE == True:
- own.applyForce([bsforce, 0, 0], True)
- if STANCE == False:
- own.applyForce([bsforce, 0, 0], True)
- own.applyMovement([bs_dloc, 0, 0], True)
- if own['grind_out_type'] == 'bs fak back' or own['grind_out_type'] == 'bs reg forward':
- if own['gt_cd2'] > 50:
- if STANCE == True:
- own.applyForce([-bsforce, 0, 0], True)
- if STANCE == False:
- own.applyForce([-bsforce, 0, 0], True)
- own.applyMovement([-bs_dloc, 0, 0], True)
-
- if own['gt_cd2'] > 0:
- own['gt_cd2'] -= 1
- if own['gt_cd2'] == 0:
- own['grind_out_type'] = None
-
- if own["grindoutturn"] > 0:
- own["grindoutturn"] = own["grindoutturn"] - 1
-
-
- def air_height():
- height = own["air_height"]
- if lf_ground == True and not onGround:
- height = 0
-
- #wallride
- def wallride():
- wallride_off = own['wallride_off']
- wallride_off = False
- distance = own.getDistanceTo(gray.hitPosition)
- upforce = 25
- sideforce = 15
- if wallrideL.triggered or wallrideR.triggered:
- print('----wall triggered', wallride_off, onGround)
- try:
- obj = gray.hitObject
- objpos = obj.worldPosition
- ownpos = own.worldPosition
- distance = ownpos.z - objpos.z
- except:
- #print('gray broke')
- pass
- if wallrideL.triggered and wallride_off == 0 and not onGround:
- own['jump_timer'] = 0
- if not onGround:
- own["wallride"] = "L"
- cont.activate(wallrideconstL)
- force = [0, sideforce, upforce]
- own.applyForce(force, 1)
- #align
- print('wallride')
- if STANCE == 0:
- own['requestAction'] = 'reg_wall_r'
- else:
- own['requestAction'] = 'fak_wall_l'
-
- else:
- if own["wallride"] != "R":
- own["wallride"] = None
- cont.deactivate(wallrideconstL)
-
- if wallrideR.triggered and wallride_off == 0:
- own['jump_timer'] = 0
- if not onGround:
- own["wallride"] = "R"
- cont.activate(wallrideconstR)
- force = [0, -sideforce, upforce]
- own.applyForce(force, 1)
- print('wallride')
- if STANCE == 0:
- own['requestAction'] = 'reg_wall_l'
- else:
- own['requestAction'] = 'fak_wall_r'
- else:
- if own["wallride"] != "L":
- own["wallride"] = None
- cont.deactivate(wallrideconstR)
-
- def wallride_sound():
- sact = own.actuators["wallSound"]
- if own["wallride"] != None and (own['actionState'] == 'reg_wall_r' or own['actionState'] == 'reg_wall_l' or own['actionState'] == 'fak_wall_r' or own['actionState'] == 'fak_wall_l'):
- sact.volume = .2
- cont.activate(own.actuators["wallSound"])
- else:
- sact.volume = .001
- sact.stopSound()
- if own['revert_timer'] > 0:
- own['revert_timer'] = own['revert_timer'] - 1
-
- def shutoff_timers():
- if (LAST_GRIND == False and grindHit == True) or (jump_timer > 10 and own['wallride'] == None):
- sr.reset()
- sl.reset()
-
- def grindout_cleanup():
- lgf = own['last_grind_frame']
-
- def trans_jump():
- if own['jump_from_trans'] == 1:
- ground_ray = cont.sensors['ground_look']
- jump_obj = own['trans_jump_obj']
- jump_obj = scene.objects[str(own['trans_jump_obj'])]
- worldVect = [1, 0, 0]
- vect = jump_obj.getAxisVect(worldVect)
- go = jump_obj.worldOrientation
- grinder_axis = [0, 1, 0]
- player_pos = own.worldPosition
- jump_obj = jump_obj.worldPosition
- try:
- delta = player_pos - jump_obj
- except:
- pass
- delta = delta.cross(vect)
- deltamove = delta[1] * .25
- move = [deltamove, 0, 0]
- if abs(deltamove) < 1 and delta[1] < 1:
- own.applyMovement(move, True)
-
- def air_mover():
- stren = 140 # 120
- stren2 = 10 #7
- if not onGround and jump_timer > 53 and frames_since_grinding > 50:
- if lUD > 0.075:
- if STANCE == 0:
- force2 = [stren, 0, 10]
- if STANCE == 1:
- force2 = [-stren, 0, 10]
- own.applyForce(force2, True)
- own['no_grind_pull'] = 1
- if not onGround and jump_timer > 53 and frames_since_grinding > 50:
- if lUD < -0.075:
- own['no_grind_pull'] = 1
- if not onGround and jump_timer > 10 and lUD > 0.075 and frames_since_grinding > 50:
- if STANCE == 0:
- force2 = [stren2, 0, 10]
- if STANCE == 1:
- force2 = [-stren2, 0, 10]
- own.applyForce(force2, True)
- own.applyForce([0, 0, 5], False)
- own['air_mover'] = True
- own['no_grind_pull'] = 1
- else:
- own['air_mover'] = False
-
- def dropinRotate():
- if own['dropinTimer'] > 30 and own['dropinTimer'] < 40:
- rot = [0.01, 0.0, 0]
- vel = [linVelocity.x - .25, linVelocity.y, linVelocity.z - .01]
- if STANCE == 1:
- rot = [-0.01, 0.0, 0]
- vel = [linVelocity.x + .25, linVelocity.y, linVelocity.z - .01]
- local = True
- own.applyRotation(rot, local)
- own.setLinearVelocity(vel, local)
- if own['dropinTimer'] == 50:
- if STANCE == 1:
- force = (linVelocity.x +1, linVelocity.y, linVelocity.z)
- else:
- force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
- own.setLinearVelocity(force, True)
-
- framenum = own['framenum']
- last_ground_frame = own['lF_ground_frame']
- lF_air_frame = own['lF_air_frame']
- frames_since_ground = framenum - lF_air_frame
- if framenum - lF_air_frame > 30:
- own['no_grind_pull'] = 0
-
- def wallhit():
- linvelx = linVelocity.x
- lastx = own["linvelx"]
- wallsens = cont.sensors['wall']
- if frames_since_ground > 20 and (abs(lastx) - abs(linvelx)) > .5 and wallsens.positive:
- velx = linVelocity.x * -1.5
- if velx > 0 and velx < 1:
- velx = 1
- if velx < 0 and velx > -1:
- velx = -1
- force = (velx, linVelocity.y, linVelocity.z)
- own.setLinearVelocity(force, True)
-
- def grind_but_align():
- if rBump == True:
- own.alignAxisToVect([0.0, 0.0, 1.0], 2, .06)
-
- def ragdoll_out():
- rdmax = 120
- if own['ragdoll_out'] > 0:
- print('deactivating ragdoll')
- stre = 1 - (own['ragdoll_out'] / rdmax)
- own['ragdoll_out'] += 1
- if own['ragdoll_out'] == rdmax:
- stre = 0
- if own['ragdoll_out'] > rdmax:
- own['ragdoll_out'] = 0
- stre = 0
-
- armature = scene.objects['Char4']
- for const in armature.constraints:
- #print(const, 'const')
- if ('rd_cl' in str(const) or 'rd_cr' in str(const)):
- const.enforce = stre
-
-
-
- def land_mod():
- if own['requestAction'] == 'reg_land':
- if land_overRideL == True:
- own['requestAction'] = 'reg_landL'
- print('requesting unbalanced land1')
- own['lland'] = own['requestAction']
- elif land_overRideR == True:
- own['requestAction'] = 'reg_landR'
- print('requesting unbalanced land2')
- own['lland'] = own['requestAction']
- elif land_overRideLb == True:
- own['requestAction'] = 'reg_landLb'
- print('requesting unbalanced land1b')
- own['lland'] = own['requestAction']
- elif land_overRideRb == True:
- own['requestAction'] = 'reg_landRb'
- print('requesting unbalanced land2b')
- own['lland'] = own['requestAction']
- else:
- own['lland'] = own['requestAction']
-
- if own['requestAction'] == 'fak_land':
- if land_overRideL == True:
- own['requestAction'] = 'fak_landL'
- print('requesting unbalanced landf1')
- own['lland'] = own['requestAction']
- elif land_overRideR == True:
- own['requestAction'] = 'fak_landR'
- print('requesting unbalanced landf2')
- own['lland'] = own['requestAction']
- elif land_overRideLb == True:
- own['requestAction'] = 'fak_landLb'
- print('requesting unbalanced landf1b')
- own['lland'] = own['requestAction']
- elif land_overRideRb == True:
- own['requestAction'] = 'fak_landRb'
- print('requesting unbalanced landf2b')
- own['lland'] = own['requestAction']
- else:
- own['lland'] = own['requestAction']
-
- def incline_action():
- own['ground_since'] = ground_since
- if own['rotz'] < .97:
- if own['requestAction'] == 'reg_roll':
- own['requestAction'] = 'reg_opos'
- if own['requestAction'] == 'reg_turnLeft':
- own['requestAction'] = 'reg_pump_left'
- if own['requestAction'] == 'reg_turnRight':
- own['requestAction'] = 'reg_pump_right'
-
- if own['requestAction'] == 'fak_roll':
- own['requestAction'] = 'fak_opos'
- if own['requestAction'] == 'fak_turnLeft':
- own['requestAction'] = 'fak_pump_left'
- if own['requestAction'] == 'fak_turnRight':
- own['requestAction'] = 'fak_pump_right'
-
- jump_Timer()
- check_landing()
- nextframe()
- wheelroll()
- rollsound()
- reset_pos()
- ylimit()
- getoffboard()
- #switchcam()
- move_flycam()
- move_followcam()
- grind_turn()
- air_height()
- wallride()
- wallride_sound()
- shutoff_timers()
- grindout_cleanup()
- air_mover()
- dropinRotate()
- onboard()
- grind_but_align()
- land_mod()
- incline_action()
- #ragdoll_out()
- linvelx = own.getLinearVelocity(True)
- own["linvelx"] = linvelx.x
- LAST_STANCE = STANCE
- LAST_STANCE = own["stance"]
- own["last_stance"] = STANCE
- own["lastGrab"] = GRAB_ON
- own['ground'] = onGround
- own['last_ground'] = onGround
- own["LAST_GRIND"] = grindHit
- own["rotz"] = rot.z
- own['walk'] = 0
- own['lasty'] = yBut
- own['lastlts'] = ltsBut
- own['lastrts'] = rtsBut
- own["lF_ground2"] = own["lF_ground"]
- own['last_invert'] = invert_on
- own['grab_type'] = grab_type
- own['last_last_manual'] = own['last_manual']
- own['last_manual'] = own['manual']
- own['last_reg_manual'] = own['reg_manual']
- own['last_fak_manual'] = own['fak_manual']
- own['last_fak_nmanual'] = own['fak_nmanual']
- own['last_reg_nmanual'] = own['reg_nmanual']
- if own['manual'] == 1:
- own['last_manual_frame'] = frame
-
- own['last_hippy'] = own['hippy']
- if aBut == 1 and own["lasta"] == 0:
- own["lastaf"] = frame
- if xBut == 1 and own["lastx"] == 0:
- own["lastxf"] = frame
- own["lasta"] = aBut
- own["lastx"] = xBut
- own['lastaBut_ground'] = aBut_ground
- own['lastxBut_ground'] = xBut_ground
- own["last_sel"] = own["sel"]
- own["sel"] = bkBut
- dict['walk'] = 0
-
- Axis = 2
- Distance = -10
- End = own.worldPosition + (own.worldOrientation.col[Axis]*Distance)
- Start = own.worldPosition
- #localRay = own.rayCast(End, Start, 0,'ground', 0, 0, 0)
- localRay = groundRay
- own['vert'] = 0
- own['transition'] = False
- aligned = False
- #if localRay[0] or grindRay[0]:
- if localRay[0]:
-
- #if grindRay[0] and not localRay[0]:
- #localRay = grindRay
- if 'transition' in localRay[0]:
- own['transition'] = True
- own['last_transition_frame'] = own['framenum']
- #print('transition')
- localHitDist = (own.worldPosition - localRay[1]).length
- #print('gh', localHitDist)
- if localHitDist < .4:
- if own['jump_timer'] < 30:
- own.localLinearVelocity.z *= .9
-
- #if localHitDist < .287:
- if localHitDist < .295:
- if own['jump_timer'] < 30:
- own.localLinearVelocity.z = 0
- own.applyMovement((0, 0, (.295 - (localHitDist))), True)
- #own.applyMovement((0, 0, (.32 - (localHitDist))), True)
- #own.applyMovement((0, 0, (.5 - localHitDist)), True)
- #print('moving new ray a')
- #if localRay[2] != [0, 0, -1] and grindHit == 0:
- if localRay[2] != [0, 0, -1]:
- #own.alignAxisToVect(localRay[2], 2, .25)
- own.alignAxisToVect(localRay[2], 2, .5)
- aligned = True
- #print('localRay')
-
- if localHitDist > .31 and localHitDist < 2:
- own.alignAxisToVect(localRay[2], 2, .05)
- #print('new align')
- #else:
- #print('no localRay')
- else:
- if own['jump_timer'] == 0:
- y1 = Start
- y2 = Start
- y1.x += .25
- y2.x -= .25
- r1 = own.rayCast(End, y1, 0, 'ground', 1, 0, 0)
- r2 = own.rayCast(End, y2, 0, 'ground', 1, 0, 0)
- if r1[0] or r2[0]:
- #print('secondary ray active!!!')
- if r1[0]:
- localRay = r1
- Start = y1
- #print('front truck hit')
- else:
- localRay = r2
- Start = y2
- #print('back truck hit')
- localHitDist = (Start - localRay[1]).length
- if localHitDist < .3:
- own.applyMovement((0, 0, (.3 - localHitDist)), True)
- #print('moving new rayb')
- if localRay[2] != [0, 0, -1] and grindHit == 0:
- own.alignAxisToVect(localRay[2], 2, .25)
- aligned = True
-
- else:
- #print('vh')
- Axis = 2
- Distance = -2
- End = Vector.copy(own.worldPosition + (own.worldOrientation.col[Axis]*Distance))
- Start = Vector.copy(own.worldPosition)
- localRay_v = own.rayCast(End, Start, 0, 'vert', 1, 0, 0, 61439)
-
- if lBump == 1 and rBump == 1:
- own.alignAxisToVect([0.0, 0.0, 1.0], 2, .05)
- 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)):
- own['vert'] = 1
- #print('vert hit')
-
- if 'spine' in localRay_v[0] and lUD < -.04:
- print('spine hit!!!!!', lUD)
-
- #print('roting')
- if STANCE == True:
- own.applyRotation([0,.15,0], True)
- else:
- own.applyRotation([0,-.15,0], True)
- own.linearVelocity.x *= .97
- elif lUD > -.04:
- own['last_vert_frame'] = own['framenum']
- localHitDist = Vector.copy(Start - localRay_v[1]).length
- own.linearVelocity.x *= .98
- own.linearVelocity.z = .1
- #if localHitDist < .8 and (dict['lUD'] < .04 or dict['lUD'] > -.04):
- #if localHitDist < .8:
- if localHitDist < 1.5:
- #own.applyMovement((0,0,((.4 - (localHitDist) * .1))), True)
- #own.applyMovement((0, 0, (.3 - localHitDist)), True)
- own.applyMovement((0, 0, (.4 - localHitDist)), True)
- #print('moving vert ray')
- if localRay_v[2] != [0, 0, -1] and grindHit == 0:
- #if localRay_v[2] != [0,0,-1]:
- own.alignAxisToVect(localRay_v[2], 2, .4)
- #own.alignAxisToVect(localRay_v[2], 2, .05)
- aligned = True
- #print(own['lGobj'], 'lGobj')
-
-
-
-
- localHitDist = 1000
- raytof = scene.objects['rayTo_f']
- raytob = scene.objects['rayTo_b']
-
-
- if localRay[0]:
- #print('gh')
- localHitDist = (own.worldPosition - localRay[1]).length
- if localHitDist > .3 and frames_since_grinding < 30 and frames_since_grinding > 0 and own['grindTouch'] == False:
- rayf = own.rayCast(raytof.worldPosition, own.worldPosition, 0, 'transition', 1, 0, 0)
- rayb = own.rayCast(raytob.worldPosition, own.worldPosition, 0, 'transition', 1, 0, 0)
-
- if rayf[0]:
- print('rayf hit')
- own.alignAxisToVect(rayf[2], 2, .2)
- aligned = True
- elif rayb[0]:
- own.alignAxisToVect(rayb[2], 2, .2)
- aligned = True
- print('rayb hit')
-
-
- if not aligned or (lBump == 1):
- own.alignAxisToVect([0.0, 0.0, 1.0], 2, .00003)
-
- if own.linearVelocity.x > 12:
- own.linearVelocity.x = 12
- if (grindDar == False and onGround and own['grindTouch'] == False) or own['jump_timer'] > 40:
- own['grindType'] = ''
-
-
-
-
-
- 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']:
- own['requestAction'] = 'reg_land'
-
- 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']:
- own['requestAction'] = 'fak_land'
-
-
-
-
-
|