among_us.txt 167 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424
  1. /*
  2. TODO
  3. ? bug: impostor und task partikel verschwinden nach sabotagen
  4. ? bug: manchmal instant meeting skip
  5. --- Version 2 ---
  6. Hüte
  7. Door Closing
  8. Visual Tasks
  9. Stay in lobby after win
  10. Freeplay reset after all tasks done
  11. Trailer musik. JPB - Defeat the night (feat Ashley appollodor) _NCS Release
  12. rauswerf animation. mit no gravity stufenweise in die mitte tpen?
  13. vision durch rauch-partikel rund um den spieler (zylinder)
  14. geister vanishen, auch bei sich ändernden effekten
  15. */
  16. @game_core
  17. event.load("entity_mount");
  18. event.load("inv_click");
  19. event.load("function_key");
  20. event.load("player_toss");
  21. player_colors = map.new();
  22. specific_lobby_handling = true;
  23. no_lobby_tp = true;
  24. no_core_reset = true;
  25. gamename = "§cAmong Us";
  26. settings_inv = inv.new("333333333333333333333333333333333333333333333333333333");
  27. for(i = 0; i < 9; i++) {
  28. inv.setItem(settings_inv, i, read.item("km:arrow_up"));
  29. }
  30. inv.setItem(settings_inv, 9, read.item("km:gear", 1, concat("§rImpostors: ", text.number(amount_impostors))));
  31. inv.setItem(settings_inv, 10, read.item("km:gear", 1, concat("§rShort Tasks: ", text.number(amount_short))));
  32. inv.setItem(settings_inv, 11, read.item("km:gear", 1, concat("§rCommon Tasks: ", text.number(amount_common))));
  33. inv.setItem(settings_inv, 12, read.item("km:gear", 1, concat("§rLong Tasks: ", text.number(amount_long))));
  34. inv.setItem(settings_inv, 13, read.item("km:gear", 1, concat("§rAmount Meetings: ", text.number(amount_meetings))));
  35. inv.setItem(settings_inv, 14, read.item("km:gear", 1, concat("§rMeeting Cooldown: ", text.number(meeting_cooldown))));
  36. inv.setItem(settings_inv, 15, read.item("km:gear", 1, concat("§rDiscussion Time: ", text.number(discuss_time))));
  37. inv.setItem(settings_inv, 16, read.item("km:gear", 1, concat("§rVoting Time: ", text.number(vote_time))));
  38. inv.setItem(settings_inv, 17, read.item("km:gear", 1, concat("§rSpeed: ", text.number(move_speed))));
  39. for(i = 18; i < 27; i++) {
  40. inv.setItem(settings_inv, i, read.item("km:arrow_down"));
  41. }
  42. for(i = 27; i < 29; i++) {
  43. inv.setItem(settings_inv, i, read.item("km:arrow_up"));
  44. }
  45. inv.setItem(settings_inv, 36, read.item("km:gear", 1, concat("§rKill Cooldown: ", text.number(kill_cooldown))));
  46. inv.setItem(settings_inv, 37, read.item("km:gear", 1, concat("§rConfirm Ejects: ", confirm_ejects)));
  47. //inv.setItem(settings_inv, 38, read.item("km:gear", 1, concat("§r: ", text.number())));
  48. //inv.setItem(settings_inv, 39, read.item("km:gear", 1, concat("§r: ", text.number())));
  49. //inv.setItem(settings_inv, 40, read.item("km:gear", 1, concat("§r: ", text.number())));
  50. //inv.setItem(settings_inv, 41, read.item("km:gear", 1, concat("§r: ", text.number())));
  51. //inv.setItem(settings_inv, 42, read.item("km:gear", 1, concat("§r: ", text.number())));
  52. //inv.setItem(settings_inv, 43, read.item("km:gear", 1, concat("§r: ", text.number())));
  53. //inv.setItem(settings_inv, 44, read.item("km:gear", 1, concat("§r: ", text.number())));
  54. for(i = 45; i < 47; i++) {
  55. inv.setItem(settings_inv, i, read.item("km:arrow_down"));
  56. }
  57. color_list = list.new();
  58. list.add(color_list, "dark_gray");
  59. list.add(color_list, "cyan");
  60. list.add(color_list, "red");
  61. list.add(color_list, "blue");
  62. list.add(color_list, "orange");
  63. list.add(color_list, "green");
  64. list.add(color_list, "gray");
  65. list.add(color_list, "white");
  66. list.add(color_list, "pink");
  67. list.add(color_list, "purple");
  68. list.add(color_list, "yellow");
  69. list.add(color_list, "lime");
  70. cloth_code_map = map.new();
  71. map.add(cloth_code_map, "dark_gray", 4673362);
  72. map.add(cloth_code_map, "cyan", 1481884);
  73. map.add(cloth_code_map, "red", 11546150);
  74. map.add(cloth_code_map, "blue", 3949738);
  75. map.add(cloth_code_map, "orange", 16351261);
  76. map.add(cloth_code_map, "green", 6192150);
  77. map.add(cloth_code_map, "gray", 10329495);
  78. map.add(cloth_code_map, "white", 16383998);
  79. map.add(cloth_code_map, "pink", 15961002);
  80. map.add(cloth_code_map, "purple", 8991416);
  81. map.add(cloth_code_map, "yellow", 16701501);
  82. map.add(cloth_code_map, "lime", 8439583);
  83. color_code_map = map.new();
  84. map.add(color_code_map, "dark_gray", "§8");
  85. map.add(color_code_map, "cyan", "§b");
  86. map.add(color_code_map, "red", "§c");
  87. map.add(color_code_map, "blue", "§9");
  88. map.add(color_code_map, "orange", "§6");
  89. map.add(color_code_map, "green", "§2");
  90. map.add(color_code_map, "gray", "§7");
  91. map.add(color_code_map, "white", "§f");
  92. map.add(color_code_map, "pink", "§d");
  93. map.add(color_code_map, "purple", "§5");
  94. map.add(color_code_map, "yellow", "§e");
  95. map.add(color_code_map, "lime", "§a");
  96. //color_choose_inv = inv.new("000000000 033333300 033333300 000000000");
  97. color_choose_inv = inv.new("000000000033333300033333300000000000");
  98. index = 0;
  99. iter = list.iterator(color_list);
  100. while(hasNext(iter)) {
  101. color_name = next(iter);
  102. cloth_code = map.get(cloth_code_map, color_name);
  103. color_name = text.upperFirstLetter(color_name);
  104. item = read.item(concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", cloth_code, ",Name:'{\"text\":\"§r", color_name, "\"}'}}}"));
  105. item.hide(item, "attributes");
  106. inv.setItem(color_choose_inv, index++, item);
  107. }
  108. gosub("setstart");
  109. goto("simplelobby");
  110. @specificLobbyHandling
  111. if(event == "player_join") {
  112. resetplayer(player);
  113. assignSeat(player);
  114. if(lobby_leader == null) {
  115. lobby_leader = player.getUuid(player);
  116. stacks.set(player, 1, "km:gear");
  117. }
  118. display.add(player, 0, "Lobby-Leader: ", player.getName(lobby_leader));
  119. display.add(player, 1, gamename);
  120. display.add(player, 2, "Impostors: ", text.number(amount_impostors));
  121. display.add(player, 3, "Short Tasks: ", text.number(amount_short));
  122. display.add(player, 4, "Common Tasks: ", text.number(amount_common));
  123. display.add(player, 5, "Long Tasks: ", text.number(amount_long));
  124. display.add(player, 6, "Amount Meetings: ", text.number(amount_meetings));
  125. display.add(player, 7, "Meeting Cooldown: ", text.number(meeting_cooldown), " s");
  126. display.add(player, 8, "Discussion Time: ", text.number(discuss_time), " s");
  127. display.add(player, 9, "Voting Time: ", text.number(vote_time), " s");
  128. display.add(player, 10, "Speed: ", text.number(move_speed));
  129. display.add(player, 11, "Kill Cooldown: ", text.number(kill_cooldown), " s");
  130. display.add(player, 12, "Confirm Ejects: ", confirm_ejects);
  131. stacks.set(player, 0, "minecraft:leather_chestplate");
  132. stacks.setActive(player, true);
  133. player.setSpeed(player, move_speed);
  134. player.setHunger(player, 20);
  135. player.setSaturation(player, 100);
  136. return;
  137. }
  138. if(event == "player_toss") {
  139. cancel = true;
  140. player.giveItem(player, item);
  141. inv.update(player);
  142. return;
  143. }
  144. if(event == "block_click") {
  145. if(block_loc == start_sign_loc) {
  146. if(player.getUuid(player) != lobby_leader) {
  147. msg.prefix(player, gamename, "You are not the Lobby-Leader.");
  148. return;
  149. }
  150. if(!started) {
  151. counterindex = 3;
  152. goto("startcountdown");
  153. }
  154. }
  155. return;
  156. }
  157. if(event == "inv_click") {
  158. if(inv_name == "§cSettings") {
  159. //amount_impostors
  160. if(inv_slot == 0 || inv_slot == 9 || inv_slot == 18) {
  161. if(inv_slot == 0 || inv_slot == 9) {
  162. if(amount_impostors < amount_impostors_max) {
  163. amount_impostors++;
  164. }
  165. } elseif(inv_slot == 18) {
  166. if(amount_impostors > amount_impostors_min) {
  167. amount_impostors--;
  168. }
  169. }
  170. minigame.displayAll(2, concat("Impostors: ", text.number(amount_impostors)));
  171. inv.setItem(settings_inv, 9, read.item("km:gear", 1, concat("§rImpostors: ", text.number(amount_impostors))));
  172. inv.update(player);
  173. return;
  174. }
  175. //short_tasks
  176. if(inv_slot == 1 || inv_slot == 10 || inv_slot == 19) {
  177. if(inv_slot == 1 || inv_slot == 10) {
  178. if(amount_short < amount_short_max) {
  179. amount_short++;
  180. }
  181. } elseif(inv_slot == 19) {
  182. if(amount_short > amount_short_min) {
  183. amount_short--;
  184. }
  185. }
  186. minigame.displayAll(3, concat("Short Tasks: ", text.number(amount_short)));
  187. inv.setItem(settings_inv, 10, read.item("km:gear", 1, concat("§rShort Tasks: ", text.number(amount_short))));
  188. inv.update(player);
  189. return;
  190. }
  191. //common_tasks
  192. if(inv_slot == 2 || inv_slot == 11 || inv_slot == 20) {
  193. if(inv_slot == 2 || inv_slot == 11) {
  194. if(amount_common < amount_common_max) {
  195. amount_common++;
  196. }
  197. } elseif(inv_slot == 20) {
  198. if(amount_common > amount_common_min) {
  199. amount_common--;
  200. }
  201. }
  202. minigame.displayAll(4, concat("Common Tasks: ", text.number(amount_common)));
  203. inv.setItem(settings_inv, 11, read.item("km:gear", 1, concat("§rCommon Tasks: ", text.number(amount_common))));
  204. inv.update(player);
  205. return;
  206. }
  207. //long_tasks
  208. if(inv_slot == 3 || inv_slot == 12 || inv_slot == 21) {
  209. if(inv_slot == 3 || inv_slot == 12) {
  210. if(amount_long < amount_long_max) {
  211. amount_long++;
  212. }
  213. } elseif(inv_slot == 21) {
  214. if(amount_long > amount_long_min) {
  215. amount_long--;
  216. }
  217. }
  218. minigame.displayAll(5, concat("Long Tasks: ", text.number(amount_long)));
  219. inv.setItem(settings_inv, 12, read.item("km:gear", 1, concat("§rLong Tasks: ", text.number(amount_long))));
  220. inv.update(player);
  221. return;
  222. }
  223. //amount_meetings
  224. if(inv_slot == 4 || inv_slot == 13 || inv_slot == 22) {
  225. if(inv_slot == 4 || inv_slot == 13) {
  226. if(amount_meetings < amount_meetings_max) {
  227. amount_meetings++;
  228. }
  229. } elseif(inv_slot == 22) {
  230. if(amount_meetings > amount_meetings_min) {
  231. amount_meetings--;
  232. }
  233. }
  234. minigame.displayAll(6, concat("Amount Meetings: ", text.number(amount_meetings)));
  235. inv.setItem(settings_inv, 13, read.item("km:gear", 1, concat("§rAmount Meetings: ", text.number(amount_meetings))));
  236. inv.update(player);
  237. return;
  238. }
  239. //meeting_cooldown
  240. if(inv_slot == 5 || inv_slot == 14 || inv_slot == 23) {
  241. if(inv_slot == 5 || inv_slot == 14) {
  242. if(meeting_cooldown < meeting_cooldown_max) {
  243. meeting_cooldown += 5;
  244. }
  245. } elseif(inv_slot == 23) {
  246. if(meeting_cooldown > meeting_cooldown_min) {
  247. meeting_cooldown -= 5;
  248. }
  249. }
  250. minigame.displayAll(7, concat("Meeting Cooldown: ", text.number(meeting_cooldown), " s"));
  251. inv.setItem(settings_inv, 14, read.item("km:gear", 1, concat("§rMeeting Cooldown: ", text.number(meeting_cooldown))));
  252. inv.update(player);
  253. return;
  254. }
  255. //discuss_time
  256. if(inv_slot == 6 || inv_slot == 15 || inv_slot == 24) {
  257. if(inv_slot == 6 || inv_slot == 15) {
  258. if(discuss_time < discuss_time_max) {
  259. discuss_time += 5;
  260. }
  261. } elseif(inv_slot == 24) {
  262. if(discuss_time > discuss_time_min) {
  263. discuss_time -= 5;
  264. }
  265. }
  266. minigame.displayAll(8, concat("Discussion Time: ", text.number(discuss_time), " s"));
  267. inv.setItem(settings_inv, 15, read.item("km:gear", 1, concat("§rDiscussion Time: ", text.number(discuss_time))));
  268. inv.update(player);
  269. return;
  270. }
  271. //vote_time
  272. if(inv_slot == 7 || inv_slot == 16 || inv_slot == 25) {
  273. if(inv_slot == 7 || inv_slot == 16) {
  274. if(vote_time < vote_time_max) {
  275. vote_time += 5;
  276. }
  277. } elseif(inv_slot == 25) {
  278. if(vote_time > vote_time_min) {
  279. vote_time -= 5;
  280. }
  281. }
  282. minigame.displayAll(9, concat("Voting Time: ", text.number(vote_time), " s"));
  283. inv.setItem(settings_inv, 16, read.item("km:gear", 1, concat("§rVoting Time: ", text.number(vote_time))));
  284. inv.update(player);
  285. return;
  286. }
  287. //move_speed
  288. if(inv_slot == 8 || inv_slot == 17 || inv_slot == 26) {
  289. if(inv_slot == 8 || inv_slot == 17) {
  290. if(move_speed < move_speed_max) {
  291. move_speed += 0.25;
  292. }
  293. } elseif(inv_slot == 26) {
  294. if(move_speed > move_speed_min) {
  295. move_speed -= 0.25;
  296. }
  297. }
  298. iter = list.iterator(minigame.getPlayers(script_id));
  299. while(hasNext(iter)) {
  300. p_uuid = next(iter);
  301. p = player.get(p_uuid);
  302. player.setSpeed(p, move_speed);
  303. }
  304. minigame.displayAll(10, concat("Speed: ", text.number(move_speed)));
  305. inv.setItem(settings_inv, 17, read.item("km:gear", 1, concat("§rSpeed: ", text.number(move_speed))));
  306. inv.update(player);
  307. return;
  308. }
  309. //kill_cooldown
  310. if(inv_slot == 27 || inv_slot == 36 || inv_slot == 45) {
  311. if(inv_slot == 27 || inv_slot == 36) {
  312. if(kill_cooldown < kill_cooldown_max) {
  313. kill_cooldown++;
  314. }
  315. } elseif(inv_slot == 45) {
  316. if(kill_cooldown > kill_cooldown_min) {
  317. kill_cooldown--;
  318. }
  319. }
  320. minigame.displayAll(11, concat("Kill Cooldown: ", text.number(kill_cooldown), " s"));
  321. inv.setItem(settings_inv, 36, read.item("km:gear", 1, concat("§rKill Cooldown: ", text.number(kill_cooldown))));
  322. inv.update(player);
  323. return;
  324. }
  325. //confirm_ejects
  326. if(inv_slot == 28 || inv_slot == 37 || inv_slot == 46) {
  327. if(confirm_ejects) {
  328. confirm_ejects = false;
  329. } else {
  330. confirm_ejects = true;
  331. }
  332. minigame.displayAll(12, concat("Confirm Ejects: ", confirm_ejects));
  333. inv.setItem(settings_inv, 37, read.item("km:gear", 1, concat("§rConfirm Ejects: ", confirm_ejects)));
  334. inv.update(player);
  335. return;
  336. }
  337. return;
  338. }
  339. if(inv_name == "§cChoose your color") {
  340. item_name = item.getName(item);
  341. if(text.startsWith(item_name, "§cUsed", 0)) {
  342. return;
  343. }
  344. color = amongus.getPlayerColor(player);
  345. if(color != null) {
  346. item.setName(inv.getItem(inv, list.getIndexOf(color_list, color)), concat("§r", text.upperFirstLetter(color)));
  347. }
  348. new_color = removeFormat(text.toLowerCase(item_name));
  349. cloth_color = map.get(cloth_code_map, new_color);
  350. amongus.setPlayerColor(player, new_color);
  351. item.setName(item, concat("§cUsed by ", player.getName(player)));
  352. inv.update(player);
  353. amongus.forceEquip(player, new_color);
  354. }
  355. return;
  356. }
  357. if(event == "function_key") {
  358. if(key == 1) {
  359. inv.open(color_choose_inv, player, "§cChoose your color");
  360. return;
  361. }
  362. if(key == 2) {
  363. if(player.getUuid(player) != lobby_leader) {
  364. return;
  365. }
  366. inv.open(settings_inv, player, "§cSettings");
  367. return;
  368. }
  369. return;
  370. }
  371. if(event == "entity_mount") {
  372. if(isPlayer(rider)) {
  373. leaveSeat(rider);
  374. }
  375. return;
  376. }
  377. if(event == "player_logout" || event == "player_giveup") {
  378. leaveSeat(player);
  379. if(lobby_leader == player.getUuid(player)) {
  380. list = minigame.getPlayers(script_id);
  381. if(list.getSize(list) != 0) {
  382. lobby_leader = list.getIndex(list, 0);
  383. }
  384. }
  385. }
  386. return;
  387. @finalstart
  388. player_list = minigame.getPlayers(script_id);
  389. gosub("init_map_specific");
  390. boss.setColor("GREEN");
  391. boss.setName("TOTAL TASKS COMPLETED");
  392. boss.setPercent(0);
  393. boss.setOverlay("PROGRESS");
  394. boss.setCreateFog(false);
  395. boss.setDarkenSky(false);
  396. boss.setPlayEndbossmusic(false);
  397. wooden_trapdoors_tag = block.getTag("minecraft:wooden_trapdoors");
  398. shulker_tag = block.getTag("minecraft:shulker_boxes");
  399. digit_tag = item.getTag("km:digit");
  400. master_sound_category = sound.getCategory("master");
  401. kill_sound = sound.get("entity.slime.hurt");
  402. task_sound = sound.get("minecraft:block.note_block.chime");
  403. vote_sound = sound.get("minecraft:block.note_block.pling");
  404. vote_ends_sound = sound.get("minecraft:block.note_block.bell");
  405. crit_sabo_sound = sound.get("minecraft:block.note_block.bell");
  406. all_list = list.new(); //All players (Ingame + Ghost + Left)
  407. vote_inv_map = map.new();
  408. sabo_par_list = list.new();
  409. ghosts = list.new();
  410. dead_bodies = list.new();
  411. roles = map.new();
  412. player_tasks = map.new();
  413. task_steps = map.new();
  414. all_tasks = map.new();
  415. auto_close_list = list.new();
  416. auto_close_list_2 = list.new();
  417. task_part_map = map.new();
  418. admin_table_map = map.new(); //In welchem Raum befindet sich ein Spieler? (Geister ausgenommen)
  419. admin_table_map_2 = map.new(); //Wie viele Spieler befinden sich in einem Raum? (Geister ausgenommen)
  420. impostors_list = list.new(); //Impostors (Ingame + Ghost + Left)
  421. impostors_list_2 = list.new(); //Impostors (Ingame + Ghost)
  422. holded_kill_cooldown = map.new();
  423. report_map = map.new();
  424. meeting_amounts = map.new();
  425. removed_perms = list.new(); //Spieler-Uuids, denen Building-Perms entfernt wurden
  426. short_tasks = list.new();
  427. list.addAll(short_tasks, 1, 3, 5, 6, 7, 9, 14, 15, 17);
  428. common_tasks = list.new();
  429. list.addAll(common_tasks, 10, 11);
  430. long_tasks = list.new();
  431. list.addAll(long_tasks, 2, 4, 8, 12, 13, 16);
  432. amount_done_tasks = 0;
  433. sabo_list = list.new();
  434. comms_state_list = list.new();
  435. comms_fix_list = list.new();
  436. comms_fix_map = map.new();
  437. comms_state_map = map.new();
  438. comms_counter_map = map.new();
  439. comms_inv_map = map.new();
  440. oxygen_map = map.new();
  441. vent_list = list.new();
  442. vent_map_2 = map.new();
  443. vent_map_4 = map.new();
  444. vent_loop = false;
  445. cam_list = list.new();
  446. cam_map = map.new();
  447. cam_map_2 = map.new();
  448. cam_map_3 = map.new();
  449. cam_map_4 = map.new();
  450. align_engine_map = map.new(); //Position des Engine-Outputs für jeden Spieler
  451. align_engine_map_2 = map.new(); //Dient zur Zuordnung zur Engine-Location bei korrekt ausgerichtetem Engine-Output
  452. align_le_engine_set = set.new(); //Spieler, die Align-Engine bei Lower-Engine gemacht haben
  453. align_ue_engine_set = set.new(); //Spieler, die Align-Engine bei Upper-Engine gemacht haben
  454. submit_scan_list = list.new();
  455. submit_scan_list_2 = list.new();
  456. submit_scan_map = map.new();
  457. submit_scan_map_2 = map.new();
  458. ast_directions = array.new(8);
  459. ast_start_pos = list.new();
  460. ast_start_pos_dirs = map.new();
  461. clear_ast_list = list.new();
  462. clear_ast_list_2 = list.new();
  463. clear_ast_list_3 = list.new();
  464. clear_ast_map = map.new();
  465. clear_ast_map_2 = map.new();
  466. clear_ast_map_3 = map.new();
  467. fuel_counter = map.new();
  468. download_counter = map.new();
  469. download_map = map.new();
  470. download_map_3 = map.new();
  471. download_list = list.new();
  472. download_list_2 = list.new();
  473. chart_course_counter = map.new();
  474. chart_course_pattern = map.new();
  475. manifolds_counter = map.new();
  476. manifolds_list = list.new();
  477. manifolds_list_2 = list.new();
  478. reactor_draw_list_1 = list.new();
  479. reactor_draw_list_2 = list.new();
  480. reset_reactor_draw_list = list.new();
  481. reactor_block_list = list.new();
  482. reset_reactor_click_list = list.new();
  483. reset_reactor_click_list_2 = list.new();
  484. reactor_false_click_list = list.new();
  485. start_reactor_map = map.new();
  486. sample_list = list.new();
  487. sample_list_2 = list.new();
  488. empty_garb_list = list.new();
  489. empty_garb_list_2 = list.new();
  490. empty_garb_map = map.new();
  491. empty_garb_map_2 = map.new();
  492. empty_garb_map_3 = map.new();
  493. sample_map = map.new();
  494. calibrate_dist_list = list.new();
  495. calibrate_dist_list_2 = list.new();
  496. calibrate_dist_map = map.new();
  497. wires_map = map.new();
  498. wires_map_2 = map.new();
  499. wires_map_4 = map.new();
  500. swipe_card_map = map.new();
  501. divert_pow_map_3 = map.new();
  502. clean_o2_map = map.new();
  503. align_engine_array = array.new(11);
  504. temp_list = list.new();
  505. list.addAll(temp_list, 34, 42);
  506. align_engine_array[0] = temp_list;
  507. temp_list = list.new();
  508. list.addAll(temp_list, 25, 32, 33, 39, 40);
  509. align_engine_array[1] = temp_list;
  510. temp_list = list.new();
  511. list.addAll(temp_list, 24, 25, 30, 31, 32, 36, 37, 38);
  512. align_engine_array[2] = temp_list;
  513. temp_list = list.new();
  514. list.addAll(temp_list, 23, 24, 25, 28, 29, 30, 31, 36);
  515. align_engine_array[3] = temp_list;
  516. temp_list = list.new();
  517. list.addAll(temp_list, 22, 23, 24, 25, 27, 28, 29, 30);
  518. align_engine_array[4] = temp_list;
  519. temp_list = list.new();
  520. list.addAll(temp_list, 18, 19, 20, 21, 22, 23, 24, 25);
  521. align_engine_array[5] = temp_list;
  522. temp_list = list.new();
  523. list.addAll(temp_list, 9, 10, 11, 12, 22, 23, 24, 25);
  524. align_engine_array[6] = temp_list;
  525. temp_list = list.new();
  526. list.addAll(temp_list, 0, 10, 11, 12, 13, 23, 24, 25);
  527. align_engine_array[7] = temp_list;
  528. temp_list = list.new();
  529. list.addAll(temp_list, 0, 1, 2, 12, 13, 14, 24, 25);
  530. align_engine_array[8] = temp_list;
  531. temp_list = list.new();
  532. list.addAll(temp_list, 3, 4, 14, 15, 25);
  533. align_engine_array[9] = temp_list;
  534. temp_list = list.new();
  535. list.addAll(temp_list, 6, 16);
  536. align_engine_array[10] = temp_list;
  537. calibrate_dist_array = array.new(12);
  538. calibrate_dist_array[0] = 5;
  539. calibrate_dist_array[1] = 4;
  540. calibrate_dist_array[2] = 3;
  541. calibrate_dist_array[3] = 6;
  542. calibrate_dist_array[4] = 8;
  543. calibrate_dist_array[5] = 12;
  544. calibrate_dist_array[6] = 15;
  545. calibrate_dist_array[7] = 16;
  546. calibrate_dist_array[8] = 17;
  547. calibrate_dist_array[9] = 13;
  548. calibrate_dist_array[10] = 9;
  549. calibrate_dist_array[11] = 7;
  550. wires_list = list.new();
  551. list.add(wires_list, read.item("minecraft:blue_stained_glass_pane", 1, "§rBlue Wire"));
  552. list.add(wires_list, read.item("minecraft:green_stained_glass_pane", 1, "§rGreen Wire"));
  553. list.add(wires_list, read.item("minecraft:red_stained_glass_pane", 1, "§rRed Wire"));
  554. list.add(wires_list, read.item("minecraft:yellow_stained_glass_pane", 1, "§rYellow Wire"));
  555. garb_items = list.new();
  556. list.add(garb_items, read.item("minecraft:diamond"));
  557. list.add(garb_items, read.item("minecraft:dead_bush"));
  558. list.add(garb_items, read.item("minecraft:rotten_flesh"));
  559. list.add(garb_items, read.item("minecraft:totem_of_undying"));
  560. list.add(garb_items, read.item("minecraft:bone"));
  561. list.add(garb_items, read.item("minecraft:bone_meal"));
  562. addAstDirection(0, 1, 0); //rechts
  563. addAstDirection(1, -1, 0); //links
  564. addAstDirection(2, 0, -1); //oben
  565. addAstDirection(3, 0, 1); //unten
  566. addAstDirection(4, 1, -1); //rechts oben
  567. addAstDirection(5, -1, 1); //links unten
  568. addAstDirection(6, 1, 1); //rechts unten
  569. addAstDirection(7, -1, -1); //links oben
  570. addAstStartPos(0, 6, 6, 6);
  571. addAstStartPos(1, 3, 5, 6);
  572. addAstStartPos(2, 3, 5, 6);
  573. addAstStartPos(3, 3, 5, 6);
  574. addAstStartPos(4, 3, 5, 6);
  575. addAstStartPos(5, 3, 5, 6);
  576. addAstStartPos(6, 3, 5, 6);
  577. addAstStartPos(7, 3, 5, 6);
  578. addAstStartPos(8, 5, 5, 5);
  579. addAstStartPos(9, 0, 4, 6);
  580. addAstStartPos(17, 1, 5, 7);
  581. addAstStartPos(18, 0, 4, 6);
  582. addAstStartPos(26, 1, 5, 7);
  583. addAstStartPos(27, 0, 4, 6);
  584. addAstStartPos(35, 1, 5, 7);
  585. addAstStartPos(36, 0, 4, 6);
  586. addAstStartPos(44, 1, 5, 7);
  587. addAstStartPos(45, 4, 4, 4);
  588. addAstStartPos(46, 2, 4, 7);
  589. addAstStartPos(47, 2, 4, 7);
  590. addAstStartPos(48, 2, 4, 7);
  591. addAstStartPos(49, 2, 4, 7);
  592. addAstStartPos(50, 2, 4, 7);
  593. addAstStartPos(51, 2, 4, 7);
  594. addAstStartPos(52, 2, 4, 7);
  595. addAstStartPos(53, 7, 7, 7);
  596. air_item = read.item("minecraft:air");
  597. lime_glass = read.item("minecraft:lime_stained_glass_pane", 1, "");
  598. green_glass = read.item("minecraft:green_stained_glass_pane", 1, "");
  599. red_glass = read.item("minecraft:red_stained_glass_pane", 1, "");
  600. gray_glass = read.item("minecraft:gray_stained_glass_pane", 1, "");
  601. black_glass = read.item("minecraft:black_stained_glass_pane", 1, "");
  602. yellow_glass = read.item("minecraft:yellow_stained_glass_pane", 1, "");
  603. blue_glass = read.item("minecraft:blue_stained_glass_pane", 1, "");
  604. cyan_glass = read.item("minecraft:cyan_stained_glass_pane", 1, "");
  605. zombie_head = read.item("minecraft:zombie_head", 1, "");
  606. space_par = particle.get("minecraft:end_rod");
  607. task_par = particle.get("minecraft:composter");
  608. cam_par = particle.get("minecraft:witch");
  609. sabo_par = particle.get("minecraft:witch");
  610. imp_par = particle.get("minecraft:witch");
  611. cam_loop = false;
  612. meeting = false;
  613. amongus.setAlert(false);
  614. lights_sabotaged = false;
  615. comms_sabotaged = false;
  616. reactor_sabotaged = false;
  617. oxygen_sabotaged = false;
  618. reactor_used = false;
  619. lights_inv = inv.new("202020202");
  620. reactor_inv_1 = inv.new("333333333333333333333333333333333333333333333333333333");
  621. sabotage.holdReactor(reactor_inv_1, false);
  622. reactor_inv_2 = inv.new("333333333333333333333333333333333333333333333333333333");
  623. sabotage.holdReactor(reactor_inv_2, false);
  624. reactor_hold_list_1 = list.new();
  625. reactor_hold_list_2 = list.new();
  626. common_tasks_2 = list.new();
  627. for(i = 0; i < amount_common; i++) {
  628. index = math.random(0, list.getSize(common_tasks) - 1);
  629. id = list.getIndex(common_tasks, index);
  630. list.add(common_tasks_2, id);
  631. }
  632. registerTask(1, "Storage", "Fuel Engines", 0, 4);
  633. registerTask(2, "[Room]", "Download Data", 0, 2);
  634. registerTask(3, "Shields", "Prime Shields", 0, 1);
  635. registerTask(4, "Reactor", "Start Reactor", 0, 1);
  636. registerTask(5, "Reactor", "Unlock Manifolds", 0, 1);
  637. registerTask(6, "Navigation", "Chart Course", 0, 1);
  638. registerTask(7, "Navigation", "Stabilize Steering", 0, 1);
  639. registerTask(8, "MedBay", "Inspect Sample", 0, 1);
  640. registerTask(9, "Electrical", "Calibrate Distributor", 0, 1);
  641. registerTask(10, "Cafeteria", "Fix Wiring", 0, 3);
  642. registerTask(11, "Admin", "Swipe Card", 0, 1);
  643. registerTask(12, "Cafeteria", "Empty Garbage", 0, 2);
  644. registerTask(13, "Weapons", "Clear Asteroids", 0, 20);
  645. registerTask(14, "Electrical", "Divert Power to [Room]", 0, 2);
  646. registerTask(15, "O2", "Clean O2 Filter", 0, 1);
  647. registerTask(16, "MedBay", "Submit Scan", 0, 1);
  648. registerTask(17, "UE/LE", "Align Engine Output", 0, 2);
  649. player_list_size = list.getSize(player_list);
  650. if(player_list_size < 6) {
  651. amount_impostors = 1;
  652. }
  653. imps = set.new();
  654. for(i = 0; i < amount_impostors; i++) {
  655. index = math.random(0, player_list_size - 1);
  656. while(set.contains(imps, index)) {
  657. index = math.random(0, player_list_size - 1);
  658. }
  659. set.add(imps, index);
  660. }
  661. if(player_list_size == 1) {
  662. amount_all_tasks = 17;
  663. freeplay = true;
  664. } else {
  665. minplayers = multi_minplayers;
  666. amount_crew = player_list_size - amount_impostors;
  667. amount_all_tasks = (amount_short + amount_common + amount_long) * amount_crew;
  668. freeplay = false;
  669. }
  670. for(i = 0; i < player_list_size; i++) {
  671. p_uuid = list.getIndex(player_list, i);
  672. p = player.get(p_uuid);
  673. if(amount_impostors > 1) {
  674. msg.prefix(p, gamename, concat("There are §c", text.number(amount_impostors), " Impostors §ramong us."));
  675. } else {
  676. msg.prefix(p, gamename, concat("There is §c", text.number(amount_impostors), " Impostor §ramong us."));
  677. }
  678. entity.teleport(p, list.getIndex(spawn_locs, i));
  679. sound.spawnForPlayer(p, pling_sound, sound_category_ambient);
  680. player.setGamemode(p, "survival");
  681. player.setFly(p, false);
  682. entity.setName(p, "");
  683. }
  684. for(h = 0; h < player_list_size; h++) {
  685. p_uuid = list.getIndex(player_list, h);
  686. p = player.get(p_uuid);
  687. list.add(all_list, p_uuid);
  688. boss.send(p, "ADD");
  689. data.setTimer(p, "Meeting Cooldown", $meeting_cooldown * 20);
  690. status.addTimed(p, 0, $meeting_cooldown * 20, "Meeting Cooldown");
  691. player.setSpeed(p, move_speed);
  692. map.add(meeting_amounts, p_uuid, amount_meetings);
  693. player.clearInventory(p);
  694. player.giveItem(p, read.item("minecraft:map"));
  695. inv.close(p);
  696. player.mute(p, true);
  697. //Building-Perms entfernen
  698. if(perm.has(p, "plot.bypass")) {
  699. perm.unregisterPlayer(p_uuid, 1);
  700. perm.unregisterPlayer(p_uuid, 15);
  701. list.add(removed_perms, p_uuid);
  702. }
  703. //Farbe zuweisen bzw. erneut forcen
  704. color = amongus.getPlayerColor(p);
  705. if(color == null) {
  706. iter = list.iterator(color_list);
  707. while(hasNext(iter)) {
  708. color = next(iter);
  709. if(!amongus.isUsedPlayerColor(color)) {
  710. amongus.setPlayerColor(p, color);
  711. amongus.forceEquip(p, color);
  712. break;
  713. }
  714. }
  715. } else {
  716. amongus.forceEquip(p, color);
  717. }
  718. display.reset(p);
  719. if(set.contains(imps, h)) {
  720. setImpostor(p);
  721. } else {
  722. setCrewmate(p);
  723. }
  724. if(freeplay) {
  725. giveTask(p, 1, "Storage", "Fuel Engines", 0, 4, null);
  726. giveTask(p, 2, "[Room]", "Download Data", 0, 2, null);
  727. giveTask(p, 3, "Shields", "Prime Shields", 0, 1, null);
  728. giveTask(p, 4, "Reactor", "Start Reactor", 0, 1, null);
  729. giveTask(p, 5, "Reactor", "Unlock Manifolds", 0, 1, null);
  730. giveTask(p, 6, "Navigation", "Chart Course", 0, 1, null);
  731. giveTask(p, 7, "Navigation", "Stabilize Steering", 0, 1, null);
  732. giveTask(p, 8, "MedBay", "Inspect Sample", 0, 1, null);
  733. giveTask(p, 9, "Electrical", "Calibrate Distributor", 0, 1, null);
  734. giveTask(p, 10, "Cafeteria", "Fix Wiring", 0, 3, null);
  735. giveTask(p, 11, "Admin", "Swipe Card", 0, 1, null);
  736. giveTask(p, 12, "Cafeteria", "Empty Garbage", 0, 2, null);
  737. giveTask(p, 13, "Weapons", "Clear Asteroids", 0, 20, null);
  738. giveTask(p, 14, "Electrical", "Divert Power to [Room]", 0, 2, null);
  739. giveTask(p, 15, "O2", "Clean O2 Filter", 0, 1, null);
  740. giveTask(p, 16, "MedBay", "Submit Scan", 0, 1, null);
  741. giveTask(p, 17, "UE/LE", "Align Engine Output", 0, 2, null);
  742. } else {
  743. for(i = 0; i < list.getSize(common_tasks_2); i++) {
  744. id = list.getIndex(common_tasks_2, i);
  745. a = map.get(all_tasks, id);
  746. giveTask(p, id, a[0], a[1], a[2], a[3], null);
  747. }
  748. i = 0;
  749. while(i != amount_short) {
  750. index = math.random(0, list.getSize(short_tasks) - 1);
  751. id = list.getIndex(short_tasks, index);
  752. if(hasTask(p, id)) {
  753. continue;
  754. }
  755. i++;
  756. a = map.get(all_tasks, id);
  757. giveTask(p, id, a[0], a[1], a[2], a[3], null);
  758. }
  759. i = 0;
  760. while(i != amount_long) {
  761. index = math.random(0, list.getSize(long_tasks) - 1);
  762. id = list.getIndex(long_tasks, index);
  763. if(hasTask(p, id)) {
  764. continue;
  765. }
  766. i++;
  767. a = map.get(all_tasks, id);
  768. giveTask(p, id, a[0], a[1], a[2], a[3], null);
  769. }
  770. }
  771. }
  772. if(!freeplay) {
  773. imp_string = "";
  774. iter = list.iterator(impostors_list);
  775. while(hasNext(iter)) {
  776. p_uuid = next(iter);
  777. p_name = player.getName(p_uuid);
  778. if(imp_string == "") {
  779. imp_string = p_name;
  780. } else {
  781. imp_string = concat(imp_string, ", ", amongus.getPlayerColorCode(p_uuid), p_name);
  782. }
  783. }
  784. for(i = 0; i < list.getSize(impostors_list); i++) {
  785. p_uuid = list.getIndex(impostors_list, i);
  786. p = player.get(p_uuid);
  787. map.remove(player_tasks, p_uuid);
  788. msg.prefix(p, gamename, concat("§4Impostors: §r", imp_string));
  789. }
  790. }
  791. setSaboCooldown(0);
  792. event.unload("entity_mount");
  793. event.load("chat");
  794. event.load("player_move");
  795. event.load("inv_close");
  796. event.load("player_data_tick");
  797. sgoto(10, "space_loop");
  798. sgoto(10, "task_part_loop");
  799. sgoto(5, "imp_par_loop");
  800. switchLights(true);
  801. goto("loop");
  802. @checkgame
  803. wait();
  804. if(event == "living_pre_hurt") {
  805. if(isPlayer(living_entity)) {
  806. player = living_entity;
  807. if(player.hasMinigameId(player, script_id)) {
  808. cancel = true;
  809. }
  810. } else {
  811. player = player.getFromDamageSource(damage_source);
  812. if(player == null) {
  813. goto("checkgame");
  814. }
  815. if(player.hasMinigameId(player, script_id)) {
  816. cancel = true;
  817. }
  818. }
  819. goto("checkgame");
  820. }
  821. if(player.hasMinigameId(player, script_id)) {
  822. ignoreGoto(event);
  823. }
  824. goto("checkgame");
  825. @chat
  826. cancel = true;
  827. if(player.isGhost(player)) {
  828. iter = list.iterator(ghosts);
  829. while(hasNext(iter)) {
  830. p_uuid = next(iter);
  831. if(!list.contains(player_list, p_uuid)) {
  832. continue;
  833. }
  834. p = player.get(p_uuid);
  835. msg.prefix(p, concat("Ghost ", amongus.getPlayerColorCode(player), player.getName(player)), message);
  836. }
  837. goto("checkgame");
  838. }
  839. if(meeting) {
  840. minigame.speakAll(concat(amongus.getPlayerColorCode(player), player.getName(player)), message);
  841. } else {
  842. msg.prefix(player, "§6Commands", "You are muted.");
  843. }
  844. goto("checkgame");
  845. @player_move
  846. player_uuid = player.getUuid(player);
  847. player.action(player, map.getOrDefault(move_id_map, id, ""));
  848. if(player.isOnCam(player)) {
  849. goto("checkgame");
  850. }
  851. if(player.isGhost(player)) {
  852. goto("checkgame");
  853. }
  854. old_room_id = map.getOrDefault(admin_table_map, player_uuid, "");
  855. if(old_room_id != id) {
  856. map.add(admin_table_map, player_uuid, id);
  857. //Neuer Raum
  858. amount_players = map.getOrDefault(admin_table_map_2, id, 0) + 1;
  859. map.add(admin_table_map_2, id, amount_players);
  860. amongus.updateAdminTable(id, amount_players);
  861. //Alter Raum
  862. amount_players = map.getOrDefault(admin_table_map_2, old_room_id, 0) - 1;
  863. map.add(admin_table_map_2, old_room_id, amount_players);
  864. amongus.updateAdminTable(old_room_id, amount_players);
  865. }
  866. goto("checkgame");
  867. function amongus.updateAdminTable(room_id, amount_players) {
  868. if(amount_players == 0) {
  869. if(room_id == $move_id_le) {
  870. inv.setItem($admin_table_inv, 23, read.item("minecraft:blue_stained_glass_pane", 1, "§rLower Engine"));
  871. } elseif(room_id == $move_id_sec) {
  872. inv.setItem($admin_table_inv, 14, read.item("minecraft:blue_stained_glass_pane", 1, "§rSecurity"));
  873. } elseif(room_id == $move_id_ue) {
  874. inv.setItem($admin_table_inv, 0, read.item("minecraft:blue_stained_glass_pane", 1, "§rUpper Engine"));
  875. } elseif(room_id == $move_id_reac) {
  876. inv.setItem($admin_table_inv, 12, read.item("minecraft:blue_stained_glass_pane", 1, "§rReactor"));
  877. } elseif(room_id == $move_id_o2) {
  878. inv.setItem($admin_table_inv, 10, read.item("minecraft:blue_stained_glass_pane", 1, "§rO2"));
  879. } elseif(room_id == $move_id_navi) {
  880. inv.setItem($admin_table_inv, 18, read.item("minecraft:blue_stained_glass_pane", 1, "§rNavigation"));
  881. } elseif(room_id == $move_id_weap) {
  882. inv.setItem($admin_table_inv, 6, read.item("minecraft:blue_stained_glass_pane", 1, "§rWeapons"));
  883. } elseif(room_id == $move_id_shie) {
  884. inv.setItem($admin_table_inv, 29, read.item("minecraft:blue_stained_glass_pane", 1, "§rShields"));
  885. } elseif(room_id == $move_id_comm) {
  886. inv.setItem($admin_table_inv, 30, read.item("minecraft:blue_stained_glass_pane", 1, "§rCommunications"));
  887. } elseif(room_id == $move_id_stor1 || room_id == $move_id_stor2) {
  888. inv.setItem($admin_table_inv, 27, read.item("minecraft:blue_stained_glass_pane", 1, "§rStorage"));
  889. } elseif(room_id == $move_id_elec1 || room_id == $move_id_elec2) {
  890. inv.setItem($admin_table_inv, 20, read.item("minecraft:blue_stained_glass_pane", 1, "§rElectrical"));
  891. } elseif(room_id == $move_id_med1 || room_id == $move_id_med2) {
  892. inv.setItem($admin_table_inv, 8, read.item("minecraft:blue_stained_glass_pane", 1, "§rMedBay"));
  893. } elseif(room_id == $move_id_cafe) {
  894. inv.setItem($admin_table_inv, 4, read.item("minecraft:blue_stained_glass_pane", 1, "§rCafeteria"));
  895. } elseif(room_id == $move_id_admin) {
  896. inv.setItem($admin_table_inv, 16, read.item("minecraft:blue_stained_glass_pane", 1, "§rAdmin"));
  897. }
  898. } else {
  899. if(room_id == move_id_le) {
  900. inv.setItem($admin_table_inv, 23, read.item("minecraft:sticky_piston", amount_players, "§rLower Engine"));
  901. } elseif(room_id == $move_id_sec) {
  902. inv.setItem($admin_table_inv, 14, read.item("minecraft:observer", amount_players, "§rSecurity"));
  903. } elseif(room_id == $move_id_ue) {
  904. inv.setItem($admin_table_inv, 0, read.item("minecraft:sticky_piston", amount_players, "§rUpper Engine"));
  905. } elseif(room_id == $move_id_reac) {
  906. inv.setItem($admin_table_inv, 12, read.item("minecraft:tnt", amount_players, "§rReactor"));
  907. } elseif(room_id == $move_id_o2) {
  908. inv.setItem($admin_table_inv, 10, read.item("km:plum_sapling", amount_players, "§rO2"));
  909. } elseif(room_id == $move_id_navi) {
  910. inv.setItem($admin_table_inv, 18, read.item("minecraft:compass", amount_players, "§rNavigation"));
  911. } elseif(room_id == $move_id_weap) {
  912. sword_item = read.item("minecraft:golden_sword", amount_players, "§rWeapons");
  913. item.hide(sword_item, "attributes");
  914. inv.setItem($admin_table_inv, 6, sword_item);
  915. } elseif(room_id == $move_id_shie) {
  916. inv.setItem($admin_table_inv, 29, read.item("minecraft:shield", amount_players, "§rShields"));
  917. } elseif(room_id == $move_id_comm) {
  918. inv.setItem($admin_table_inv, 30, read.item("minecraft:end_rod", amount_players, "§rCommunications"));
  919. } elseif(room_id == $move_id_stor1 || room_id == $move_id_stor2) {
  920. inv.setItem($admin_table_inv, 27, read.item("minecraft:red_shulker_box", amount_players, "§rStorage"));
  921. } elseif(room_id == $move_id_elec1 || room_id == $move_id_elec2) {
  922. inv.setItem($admin_table_inv, 20, read.item("minecraft:redstone", amount_players, "§rElectrical"));
  923. } elseif(room_id == $move_id_med1 || room_id == $move_id_med2) {
  924. inv.setItem($admin_table_inv, 8, read.item("km:plus_red", amount_players, "§rMedBay"));
  925. } elseif(room_id == $move_id_cafe) {
  926. inv.setItem($admin_table_inv, 4, read.item("minecraft:cake", amount_players, "§rCafeteria"));
  927. } elseif(room_id == $move_id_admin) {
  928. inv.setItem($admin_table_inv, 16, read.item("minecraft:lectern", amount_players, "§rAdmin"));
  929. }
  930. }
  931. }
  932. @block_click
  933. if(action == "left") {
  934. goto("checkgame");
  935. }
  936. if(hand == "OFF_HAND") {
  937. goto("checkgame");
  938. }
  939. if(block.hasTag(shulker_tag, block)) {
  940. cancel = true;
  941. goto("checkgame");
  942. }
  943. if(block.hasTag(wooden_trapdoors_tag, block)) {
  944. cancel = true;
  945. goto("checkgame");
  946. }
  947. if(set.contains(cams_locs, block_loc)) {
  948. cam_number = 0;
  949. player_uuid = player.getUuid(player);
  950. map.add(cam_map, player_uuid, cam_number);
  951. player_loc = entity.getLocation(player);
  952. map.add(cam_map_2, player_uuid, player_loc);
  953. if(!player.isGhost(player)) {
  954. ent = human.spawn(player_loc);
  955. living.removeAi(ent);
  956. map.add(cam_map_3, player_uuid, ent);
  957. map.add(cam_map_4, ent, player_uuid);
  958. human.setSkin(ent, player_uuid);
  959. entity.setName(ent, "");
  960. color = amongus.getPlayerColor(player);
  961. amongus.forceEquip(ent, color);
  962. }
  963. cam.enter(player);
  964. goto("checkgame");
  965. }
  966. if(set.contains(med_scan_locs, block_loc)) {
  967. task_id = 16;
  968. if(!hasTask(player, task_id)) {
  969. goto("checkgame");
  970. }
  971. step = task.getStep(player, task_id);
  972. if(step == 1) {
  973. goto("checkgame");
  974. }
  975. if(loc.distance(entity.getLocation(player), block_loc) > 3) {
  976. msg.prefix(player, gamename, "Get closer.");
  977. goto("checkgame");
  978. }
  979. player_uuid = player.getUuid(player);
  980. //inv = inv.new("202222202 002222200 202222202 002222200 202222202 003333300");
  981. inv = inv.new("202222202002222200202222202002222200202222202003333300");
  982. inv.setItem(inv, 9, player.getHead(player_uuid, player.getName(player)));
  983. color = amongus.getPlayerColor(player);
  984. color_code = map.get(cloth_code_map, color);
  985. item = read.item(concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  986. item.hide(item, "attributes");
  987. inv.setItem(inv, 15, item);
  988. item = read.item(concat("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  989. item.hide(item, "attributes");
  990. inv.setItem(inv, 21, item);
  991. item = read.item(concat("{id:\"minecraft:leather_boots\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  992. item.hide(item, "attributes");
  993. inv.setItem(inv, 27, item);
  994. inv.open(inv, player, "§cSubmit Scan");
  995. list.add(submit_scan_list, player_uuid);
  996. map.add(submit_scan_map, player_uuid, 0);
  997. map.add(submit_scan_map_2, player_uuid, inv);
  998. sgoto(20, "submit_scan");
  999. goto("checkgame");
  1000. }
  1001. if(set.contains(clear_ast_locs, block_loc)) {
  1002. task_id = 13;
  1003. if(!hasTask(player, task_id)) {
  1004. goto("checkgame");
  1005. }
  1006. step = task.getStep(player, task_id);
  1007. if(step == 20) {
  1008. goto("checkgame");
  1009. }
  1010. //inv = inv.new("333333333 333333333 333333333 333333333 333333333 333333333");
  1011. inv = inv.new("333333333333333333333333333333333333333333333333333333");
  1012. a = array.new(7);
  1013. a[0] = inv;
  1014. slot = list.getIndex(ast_start_pos, math.random(0, 25));
  1015. a[1] = slot;
  1016. inv.setItem(inv, slot, read.item("minecraft:bedrock", 1, "§rAsteroid"));
  1017. inv.open(inv, player, "§cClear Asteroids");
  1018. b = getAstDirection(slot);
  1019. a[2] = b[0]; //x_dir
  1020. a[3] = b[1]; //y_dir
  1021. a[4] = false; //reached end
  1022. a[5] = math.random(1, 2); //speed
  1023. a[6] = 0; //speed counter
  1024. my_list = list.new();
  1025. list.add(my_list, a);
  1026. player_uuid = player.getUuid(player);
  1027. map.add(clear_ast_map, player_uuid, my_list);
  1028. map.add(clear_ast_map_2, player_uuid, 0);
  1029. map.add(clear_ast_map_3, player_uuid, inv);
  1030. if(list.getSize(clear_ast_list) == 0) {
  1031. sgoto(5, "clear_ast");
  1032. }
  1033. list.add(clear_ast_list, player_uuid);
  1034. goto("checkgame");
  1035. }
  1036. if(set.contains(inspect_sample_locs, block_loc)) {
  1037. task_id = 8;
  1038. if(!hasTask(player, task_id)) {
  1039. goto("checkgame");
  1040. }
  1041. step = task.getStep(player, task_id);
  1042. if(step == 1) {
  1043. goto("checkgame");
  1044. }
  1045. player_uuid = player.getUuid(player);
  1046. inv = map.get(sample_map, player_uuid);
  1047. if(inv == null) {
  1048. //inv = inv.new("202020202 202020202 202020202 000000000 202020202 000000002");
  1049. inv = inv.new("202020202202020202202020202000000000202020202000000002");
  1050. for(i = 0; i < 15; i++) {
  1051. inv.setItem(inv, i, read.item("minecraft:white_stained_glass_pane", 1, "§rSample"));
  1052. }
  1053. for(i = 15; i < 20; i++) {
  1054. inv.setItem(inv, i, read.item("minecraft:gray_stained_glass_pane", 1, "§rSelect sample"));
  1055. }
  1056. inv.setItem(inv, 20, read.item("minecraft:green_stained_glass_pane", 1, "§rPress to start"));
  1057. }
  1058. inv.open(inv, player, "§cInspect Sample");
  1059. goto("checkgame");
  1060. }
  1061. if(block_loc == admin_table_loc) {
  1062. if(comms_sabotaged) {
  1063. msg.prefix(player, gamename, "Communications disabled.");
  1064. goto("checkgame");
  1065. }
  1066. inv.open(admin_table_inv, player, "§cAdmin Table");
  1067. goto("checkgame");
  1068. }
  1069. if(block_loc == ue_align_loc || block_loc == le_align_loc) {
  1070. task_id = 17;
  1071. if(!hasTask(player, task_id)) {
  1072. goto("checkgame");
  1073. }
  1074. step = task.getStep(player, task_id);
  1075. if(step == 2) {
  1076. goto("checkgame");
  1077. }
  1078. player_uuid = player.getUuid(player);
  1079. if(block_loc == ue_align_loc && set.contains(align_ue_engine_set, player_uuid)) {
  1080. goto("checkgame");
  1081. }
  1082. if(block_loc == le_align_loc && set.contains(align_le_engine_set, player_uuid)) {
  1083. goto("checkgame");
  1084. }
  1085. //inv = inv.new("333333332 333333333 222222222 333333333 333333332");
  1086. inv = inv.new("333333332333333333222222222333333333333333332");
  1087. inv.setItem(inv, 8, read.item("km:arrow_up"));
  1088. inv.setItem(inv, 44, read.item("km:arrow_down"));
  1089. inv.setItem(inv, 26, green_glass);
  1090. inv.open(inv, player, "§cAlign Engine Output");
  1091. pos = math.random(0, 10);
  1092. while(pos == 5) {
  1093. pos = math.random(0, 10);
  1094. }
  1095. map.add(align_engine_map, player_uuid, pos);
  1096. map.add(align_engine_map_2, player_uuid, block_loc);
  1097. set_engine(player, inv, null);
  1098. inv.update(player);
  1099. goto("checkgame");
  1100. }
  1101. if(block_loc == clean_o2_loc) {
  1102. task_id = 15;
  1103. if(!hasTask(player, task_id)) {
  1104. goto("checkgame");
  1105. }
  1106. step = task.getStep(player, task_id);
  1107. if(step == 1) {
  1108. goto("checkgame");
  1109. }
  1110. //inv = inv.new("222222222 222222222 222222222 222222222 222222222 222222222");
  1111. inv = inv.new("222222222222222222222222222222222222222222222222222222");
  1112. inv.setItem(inv, 0, black_glass);
  1113. inv.setItem(inv, 9, black_glass);
  1114. inv.setItem(inv, 36, black_glass);
  1115. inv.setItem(inv, 45, black_glass);
  1116. for(i = 0; i < 6; i++) {
  1117. slot = math.random(1, 53);
  1118. while(slot % 9 == 0 || item.getType(inv.getItem(inv, slot)) != "minecraft:air") {
  1119. slot = math.random(1, 53);
  1120. }
  1121. inv.setItem(inv, slot, read.item("minecraft:oak_leaves"));
  1122. if(slot < 18) {
  1123. if(item.getType(inv.getItem(inv, slot + 9)) == "minecraft:air") {
  1124. inv.setItem(inv, slot + 9, read.item("km:arrow_down"));
  1125. continue;
  1126. }
  1127. }
  1128. if(slot > 36) {
  1129. if(item.getType(inv.getItem(inv, slot - 9)) == "minecraft:air") {
  1130. inv.setItem(inv, slot - 9, read.item("km:arrow_up"));
  1131. continue;
  1132. }
  1133. }
  1134. if(item.getType(inv.getItem(inv, slot - 1)) == "minecraft:air") {
  1135. inv.setItem(inv, slot - 1, read.item("km:arrow_left"));
  1136. }
  1137. }
  1138. inv.open(inv, player, "§cClean O2 Filter");
  1139. goto("checkgame");
  1140. }
  1141. if(block_loc == elec_power_loc) {
  1142. task_id = 14;
  1143. if(!hasTask(player, task_id)) {
  1144. goto("checkgame");
  1145. }
  1146. step = task.getStep(player, task_id);
  1147. if(step != 0) {
  1148. goto("checkgame");
  1149. }
  1150. //inv = inv.new("000020000 002222200 022222220 222222222 222222222 000000000");
  1151. inv = inv.new("000020000002222200022222220222222222222222222000000000");
  1152. gunpowder = read.item("minecraft:gunpowder");
  1153. for(i = 0; i < 22; i++) {
  1154. inv.setItem(inv, i, gunpowder);
  1155. }
  1156. for(i = 22; i < 31; i++) {
  1157. inv.setItem(inv, i, read.item("minecraft:lever", 1, map.get(divert_pow_map, i)));
  1158. }
  1159. r = map.get(divert_pow_map_3, player.getUuid(player));
  1160. inv.setItem(inv, r, read.item("minecraft:redstone_torch", 1, map.get(divert_pow_map, r)));
  1161. inv.open(inv, player, "§cDivert Power");
  1162. goto("checkgame");
  1163. }
  1164. r = map.get(divert_pow_map_3, player.getUuid(player));
  1165. if(r != null && block_loc == map.get(divert_pow_map_2, r)) {
  1166. task_id = 14;
  1167. if(!hasTask(player, task_id)) {
  1168. goto("checkgame");
  1169. }
  1170. step = task.getStep(player, task_id);
  1171. if(step != 1) {
  1172. goto("checkgame");
  1173. }
  1174. //inv = inv.new("002200002 220200220 020202002 222222220 002002002 220000220");
  1175. inv = inv.new("002200002220200220020202002222222220002002002220000220");
  1176. gunpowder = read.item("minecraft:gunpowder");
  1177. redstone = read.item("minecraft:redstone");
  1178. inv.setItem(inv, 0, redstone);
  1179. inv.setItem(inv, 1, redstone);
  1180. inv.setItem(inv, 2, gunpowder);
  1181. inv.setItem(inv, 3, redstone);
  1182. inv.setItem(inv, 4, redstone);
  1183. inv.setItem(inv, 5, redstone);
  1184. inv.setItem(inv, 6, gunpowder);
  1185. inv.setItem(inv, 7, gunpowder);
  1186. inv.setItem(inv, 8, redstone);
  1187. inv.setItem(inv, 9, redstone);
  1188. inv.setItem(inv, 10, gunpowder);
  1189. inv.setItem(inv, 11, gunpowder);
  1190. inv.setItem(inv, 12, redstone);
  1191. inv.setItem(inv, 13, redstone);
  1192. inv.setItem(inv, 14, redstone);
  1193. inv.setItem(inv, 15, redstone);
  1194. inv.setItem(inv, 16, read.item("stone_button", 1, "§rConnect Grids"));
  1195. inv.setItem(inv, 17, gunpowder);
  1196. inv.setItem(inv, 18, gunpowder);
  1197. inv.setItem(inv, 19, gunpowder);
  1198. inv.setItem(inv, 20, redstone);
  1199. inv.setItem(inv, 21, gunpowder);
  1200. inv.setItem(inv, 22, gunpowder);
  1201. inv.setItem(inv, 23, redstone);
  1202. inv.setItem(inv, 24, redstone);
  1203. inv.setItem(inv, 25, gunpowder);
  1204. inv.setItem(inv, 26, gunpowder);
  1205. inv.open(inv, player, "§cDivert Power");
  1206. goto("checkgame");
  1207. }
  1208. if(block_loc == cafe_garb_loc || block_loc == o2_garb_loc) {
  1209. cancel = true;
  1210. task_id = 12;
  1211. if(!hasTask(player, task_id)) {
  1212. goto("checkgame");
  1213. }
  1214. step = task.getStep(player, task_id);
  1215. if(step != 0) {
  1216. goto("checkgame");
  1217. }
  1218. player_uuid = player.getUuid(player);
  1219. r = map.get(empty_garb_map_3, player_uuid);
  1220. if(r == 0 && block_loc == o2_garb_loc) {
  1221. goto("checkgame");
  1222. } elseif(r == 1 && block_loc == cafe_garb_loc) {
  1223. goto("checkgame");
  1224. }
  1225. //inv = inv.new("033333330 033333330 033333330 033333330 033333332 033333330");
  1226. inv = inv.new("033333330033333330033333330033333330033333332033333330");
  1227. for(i = 7; i < 43; i++) {
  1228. r = math.random(1, 6);
  1229. if(r == 1) {
  1230. inv.setItem(inv, i, read.item("minecraft:oak_leaves"));
  1231. } elseif(r == 2) {
  1232. inv.setItem(inv, i, read.item("minecraft:birch_leaves"));
  1233. } elseif(r == 3) {
  1234. inv.setItem(inv, i, read.item("minecraft:spruce_leaves"));
  1235. } elseif(r == 4) {
  1236. inv.setItem(inv, i, read.item("minecraft:jungle_leaves"));
  1237. } elseif(r == 5) {
  1238. inv.setItem(inv, i, read.item("minecraft:acacia_leaves"));
  1239. } elseif(r == 6) {
  1240. inv.setItem(inv, i, read.item("minecraft:dark_oak_leaves"));
  1241. }
  1242. }
  1243. inv.setItem(inv, 35, read.item("km:arrow_down", 1, "§rEmpty Garbage"));
  1244. inv.open(inv, player, "§cEmpty Garbage");
  1245. goto("checkgame");
  1246. }
  1247. if(block_loc == stor_garb_loc) {
  1248. cancel = true;
  1249. task_id = 12;
  1250. if(!hasTask(player, task_id)) {
  1251. goto("checkgame");
  1252. }
  1253. step = task.getStep(player, task_id);
  1254. if(step != 1) {
  1255. goto("checkgame");
  1256. }
  1257. //inv = inv.new("033333330 033333330 033333330 033333330 033333332 033333330");
  1258. inv = inv.new("033333330033333330033333330033333330033333332033333330");
  1259. for(i = 7; i < 43; i++) {
  1260. r = math.random(1, 6);
  1261. if(r == 1) {
  1262. inv.setItem(inv, i, read.item("minecraft:oak_leaves"));
  1263. } elseif(r == 2) {
  1264. inv.setItem(inv, i, read.item("minecraft:birch_leaves"));
  1265. } elseif(r == 3) {
  1266. inv.setItem(inv, i, read.item("minecraft:spruce_leaves"));
  1267. } elseif(r == 4) {
  1268. inv.setItem(inv, i, read.item("minecraft:jungle_leaves"));
  1269. } elseif(r == 5) {
  1270. inv.setItem(inv, i, read.item("minecraft:acacia_leaves"));
  1271. } elseif(r == 6) {
  1272. inv.setItem(inv, i, read.item("minecraft:dark_oak_leaves"));
  1273. }
  1274. }
  1275. list.shuffle(garb_items);
  1276. inv.setItem(inv, math.random(7, 18), list.getIndex(garb_items, 0));
  1277. inv.setItem(inv, math.random(19, 30), list.getIndex(garb_items, 1));
  1278. inv.setItem(inv, math.random(31, 42), list.getIndex(garb_items, 2));
  1279. inv.setItem(inv, 35, read.item("km:arrow_down", 1, "§rEmpty Garbage"));
  1280. inv.open(inv, player, "§cEmpty Garbage");
  1281. goto("checkgame");
  1282. }
  1283. if(block_loc == swipe_card_loc) {
  1284. task_id = 11;
  1285. if(!hasTask(player, task_id)) {
  1286. goto("checkgame");
  1287. }
  1288. step = task.getStep(player, task_id);
  1289. if(step == 1) {
  1290. goto("checkgame");
  1291. }
  1292. //inv = inv.new("000000000 003333320 000000000");
  1293. inv = inv.new("000000000003333320000000000");
  1294. inv.open(inv, player, "§cSwipe Card");
  1295. goto("checkgame");
  1296. }
  1297. if(block_loc == calibrate_dist_loc) {
  1298. task_id = 9;
  1299. if(!hasTask(player, task_id)) {
  1300. goto("checkgame");
  1301. }
  1302. step = task.getStep(player, task_id);
  1303. if(step == 1) {
  1304. goto("checkgame");
  1305. }
  1306. //inv = inv.new("000222000 000333000 003000300 003000322 003000302 00033300");
  1307. inv = inv.new("00022200000033300000300030000300032200300030200033300");
  1308. inv.setItem(inv, 0, read.item("km:cross_red"));
  1309. inv.setItem(inv, 1, read.item("km:cross_red"));
  1310. inv.setItem(inv, 2, read.item("km:cross_red"));
  1311. for(i = 0; i < 12; i++) {
  1312. inv.setItem(inv, calibrate_dist_array[i], air_item);
  1313. }
  1314. inv.setItem(inv, 10, yellow_glass);
  1315. inv.setItem(inv, 11, yellow_glass);
  1316. inv.setItem(inv, 14, read.item("km:minus_green", 1, "§rPress"));
  1317. inv.open(inv, player, "§cCalibrate Distributor");
  1318. start_index = math.random(0, 8);
  1319. a = array.new(5);
  1320. player_uuid = player.getUuid(player);
  1321. a[0] = player_uuid;
  1322. a[1] = inv;
  1323. a[2] = start_index;
  1324. a[3] = start_index; //index
  1325. a[4] = 0; //stage
  1326. list.add(calibrate_dist_list, player_uuid);
  1327. map.add(calibrate_dist_map, player_uuid, a);
  1328. sgoto(7, "calibrate_dist");
  1329. goto("checkgame");
  1330. }
  1331. if(block_loc == steering_loc) {
  1332. task_id = 7;
  1333. if(!hasTask(player, task_id)) {
  1334. goto("checkgame");
  1335. }
  1336. step = task.getStep(player, task_id);
  1337. if(step == 1) {
  1338. goto("checkgame");
  1339. }
  1340. //inv = inv.new("222222222 222222222 222222222 222222222 222222222");
  1341. inv = inv.new("222222222222222222222222222222222222222222222");
  1342. inv.setItem(inv, 22, read.item("km:plus_red"));
  1343. r = math.random(0, 3);
  1344. if(r == 0) {
  1345. slot = 6;
  1346. slot_left = 5;
  1347. slot_right = 7;
  1348. slot_down = 15;
  1349. slot_up = -1;
  1350. } elseif(r == 1) {
  1351. slot = 9;
  1352. slot_left = -1;
  1353. slot_right = 10;
  1354. slot_down = 18;
  1355. slot_up = 0;
  1356. } elseif(r == 2) {
  1357. slot = 28;
  1358. slot_left = 27;
  1359. slot_right = 29;
  1360. slot_down = 37;
  1361. slot_up = 19;
  1362. } else {
  1363. slot = 35;
  1364. slot_left = 34;
  1365. slot_right = -1;
  1366. slot_down = 44;
  1367. slot_up = 26;
  1368. }
  1369. if(slot_left != -1) {
  1370. inv.setItem(inv, slot_left, read.item("km:arrow_left"));
  1371. }
  1372. if(slot_right != -1) {
  1373. inv.setItem(inv, slot_right, read.item("km:arrow_right"));
  1374. }
  1375. if(slot_up != -1) {
  1376. inv.setItem(inv, slot_up, read.item("km:arrow_up"));
  1377. }
  1378. if(slot_down != -1) {
  1379. inv.setItem(inv, slot_down, read.item("km:arrow_down"));
  1380. }
  1381. inv.setItem(inv, slot, read.item("km:plus_red"));
  1382. inv.open(inv, player, "§cStabilize Steering");
  1383. goto("checkgame");
  1384. }
  1385. if(block_loc == chart_course_loc) {
  1386. task_id = 6;
  1387. if(!hasTask(player, task_id)) {
  1388. goto("checkgame");
  1389. }
  1390. step = task.getStep(player, task_id);
  1391. if(step == 1) {
  1392. goto("checkgame");
  1393. }
  1394. a = array.new(9);
  1395. r = math.random(0, 2);
  1396. if(r == 0) {
  1397. //inv = inv.new("000000000 000000300 030003030 303030003 000300000 000000002");
  1398. inv = inv.new("000000000000000300030003030303030003000300000000000002");
  1399. a[0] = 4;
  1400. a[1] = 1;
  1401. a[2] = 5;
  1402. a[3] = 8;
  1403. a[4] = 6;
  1404. a[5] = 2;
  1405. a[6] = 0;
  1406. a[7] = 3;
  1407. a[8] = 7;
  1408. } elseif(r == 1) {
  1409. //inv = inv.new("000000000 000000000 300030003 030303030 003000300 000000002");
  1410. inv = inv.new("000000000000000000300030003030303030003000300000000002");
  1411. a[0] = 0;
  1412. a[1] = 3;
  1413. a[2] = 7;
  1414. a[3] = 4;
  1415. a[4] = 1;
  1416. a[5] = 5;
  1417. a[6] = 8;
  1418. a[7] = 6;
  1419. a[8] = 2;
  1420. } else {
  1421. //inv = inv.new("000000000 000030000 003303033 030000300 300000000 000000002");
  1422. inv = inv.new("000000000000030000003303033030000300300000000000000002");
  1423. a[0] = 8;
  1424. a[1] = 6;
  1425. a[2] = 1;
  1426. a[3] = 2;
  1427. a[4] = 0;
  1428. a[5] = 3;
  1429. a[6] = 7;
  1430. a[7] = 4;
  1431. a[8] = 5;
  1432. }
  1433. player_uuid = player.getUuid(player);
  1434. map.add(chart_course_pattern, player_uuid, a);
  1435. inv.open(inv, player, "§cChart Course");
  1436. goto("checkgame");
  1437. }
  1438. if(block_loc == unlock_manifolds_loc) {
  1439. task_id = 5;
  1440. if(!hasTask(player, task_id)) {
  1441. goto("checkgame");
  1442. }
  1443. step = task.getStep(player, task_id);
  1444. if(step == 1) {
  1445. goto("checkgame");
  1446. }
  1447. //inv = inv.new("003333300 003333300");
  1448. inv = inv.new("003333300003333300");
  1449. list = list.new();
  1450. for(i = 0; i < 10; i++) {
  1451. list.add(list, read.item("minecraft:blue_stained_glass_pane", i + 1));
  1452. }
  1453. list.shuffle(list);
  1454. for(i = 0; i < 10; i++) {
  1455. inv.setItem(inv, i, list.getIndex(list, i));
  1456. }
  1457. inv.open(inv, player, "§cUnlock Manifolds");
  1458. goto("checkgame");
  1459. }
  1460. if(block_loc == start_reactor_loc) {
  1461. task_id = 4;
  1462. if(!hasTask(player, task_id)) {
  1463. goto("checkgame");
  1464. }
  1465. step = task.getStep(player, task_id);
  1466. if(step == 1) {
  1467. goto("checkgame");
  1468. }
  1469. if(reactor_used) {
  1470. msg.prefix(player, gamename, "Another player already starts the reactor.");
  1471. goto("checkgame");
  1472. }
  1473. reactor_used = true;
  1474. reactor_array = reactor.get(player);
  1475. if(reactor_array == null) {
  1476. //inv = inv.new("003333300 000000000 022202220 022202220 022202220 000000000");
  1477. inv = inv.new("003333300000000000022202220022202220022202220000000000");
  1478. reactor_array = array.new(5);
  1479. reactor.setInv(reactor_array, inv);
  1480. reactor.setStage(reactor_array, 0);
  1481. reactor.setPattern(reactor_array);
  1482. } else {
  1483. inv = reactor.getInv(reactor_array);
  1484. }
  1485. reactor.setCounter(reactor_array, 0);
  1486. reactor.setPhase(reactor_array, "draw");
  1487. reactor.save(reactor_array, player);
  1488. reactor.setHeader(inv, air_item);
  1489. reactor.setLeftSide(inv, black_glass);
  1490. reactor.setRightSide(inv, black_glass);
  1491. inv.open(inv, player, "§cStart Reactor");
  1492. list.add(reactor_draw_list_1, player.getUuid(player));
  1493. sgoto(20, "draw_pattern_1");
  1494. goto("checkgame");
  1495. }
  1496. if(block_loc == prime_shields_loc) {
  1497. task_id = 3;
  1498. if(!hasTask(player, task_id)) {
  1499. goto("checkgame");
  1500. }
  1501. step = task.getStep(player, task_id);
  1502. if(step == 1) {
  1503. goto("checkgame");
  1504. }
  1505. //inv = inv.new("000000000 000222000 002222200 002222200 000222000 000000000");
  1506. inv = inv.new("000000000000222000002222200002222200000222000000000000");
  1507. for(i = 0; i < 16; i++) {
  1508. r = math.random(0, 1);
  1509. if(r == 0) {
  1510. inv.setItem(inv, i, green_glass);
  1511. } else {
  1512. inv.setItem(inv, i, red_glass);
  1513. }
  1514. }
  1515. inv.open(inv, player, "§cPrime Shields");
  1516. goto("checkgame");
  1517. }
  1518. if(block_loc == fix_o2_loc_1 || block_loc == fix_o2_loc_2) {
  1519. if(player.isGhost(player)) {
  1520. goto("checkgame");
  1521. }
  1522. if(oxygen_sabotaged) {
  1523. if(block_loc == fix_o2_loc_1) {
  1524. map.add(oxygen_map, player.getUuid(player), fix_o2_loc_1);
  1525. if(oxy_fixed_1) {
  1526. goto("checkgame");
  1527. }
  1528. } elseif(block_loc == fix_o2_loc_2) {
  1529. map.add(oxygen_map, player.getUuid(player), fix_o2_loc_2);
  1530. if(oxy_fixed_2) {
  1531. goto("checkgame");
  1532. }
  1533. }
  1534. //oxygen_inv = inv.new("003333322 000000000 000222000 000222000 000222000 000222000");
  1535. oxygen_inv = inv.new("003333322000000000000222000000222000000222000000222000");
  1536. inv.setItem(oxygen_inv, 6, read.item("minecraft:paper", 1, concat("§r", text.number(oxy_code))));
  1537. inv.setItem(oxygen_inv, 7, read.item("km:digit_0", 1, "§f0"));
  1538. inv.setItem(oxygen_inv, 8, read.item("km:digit_1", 1, "§f1"));
  1539. inv.setItem(oxygen_inv, 9, read.item("km:digit_2", 1, "§f2"));
  1540. inv.setItem(oxygen_inv, 10, read.item("km:digit_3", 1, "§f3"));
  1541. inv.setItem(oxygen_inv, 11, read.item("km:digit_4", 1, "§f4"));
  1542. inv.setItem(oxygen_inv, 12, read.item("km:digit_5", 1, "§f5"));
  1543. inv.setItem(oxygen_inv, 13, read.item("km:digit_6", 1, "§f6"));
  1544. inv.setItem(oxygen_inv, 14, read.item("km:digit_7", 1, "§f7"));
  1545. inv.setItem(oxygen_inv, 15, read.item("km:digit_8", 1, "§f8"));
  1546. inv.setItem(oxygen_inv, 16, read.item("km:cross_red"));
  1547. inv.setItem(oxygen_inv, 17, read.item("km:digit_9", 1, "§f9"));
  1548. inv.setItem(oxygen_inv, 18, read.item("km:check_green"));
  1549. inv.open(oxygen_inv, player, "§cENTER CODE");
  1550. sabotage.openedInv(player);
  1551. }
  1552. goto("checkgame");
  1553. }
  1554. if(block_loc == fix_reactor_loc_1 || block_loc == fix_reactor_loc_2) {
  1555. if(player.isGhost(player)) {
  1556. goto("checkgame");
  1557. }
  1558. if(reactor_sabotaged) {
  1559. if(block_loc == fix_reactor_loc_1) {
  1560. sabotage.openedInv(player);
  1561. inv.open(reactor_inv_1, player, "§cPRESS TO STOP MELTDOWN");
  1562. list.add(reactor_hold_list_1, player.getUuid(player));
  1563. goto("checkgame");
  1564. }
  1565. if(block_loc == fix_reactor_loc_2) {
  1566. sabotage.openedInv(player);
  1567. inv.open(reactor_inv_2, player, "§cPRESS TO STOP MELTDOWN");
  1568. list.add(reactor_hold_list_2, player.getUuid(player));
  1569. }
  1570. }
  1571. goto("checkgame");
  1572. }
  1573. if(block_loc == fix_comms_loc) {
  1574. if(player.isGhost(player)) {
  1575. goto("checkgame");
  1576. }
  1577. if(comms_sabotaged) {
  1578. player_uuid = player.getUuid(player);
  1579. inv = inv.new("333333333333333333333333333333333333000000000000222002");
  1580. inv.setItem(inv, 36, read.item("km:arrow_left"));
  1581. inv.setItem(inv, 37, read.item("minecraft:black_stained_glass_pane", 32));
  1582. inv.setItem(inv, 38, read.item("km:arrow_right"));
  1583. inv.open(inv, player, "§cFix Communications");
  1584. sabotage.openedInv(player);
  1585. diff = math.abs(32 - comms_fix_freq);
  1586. if(diff == 0) {
  1587. comms.drawCorrect(inv, player);
  1588. } elseif(diff < 4) {
  1589. comms.drawClose(inv, player);
  1590. } else {
  1591. comms.drawWorst(inv, player);
  1592. }
  1593. map.add(comms_inv_map, player_uuid, inv);
  1594. if(!list.contains(comms_state_list, player_uuid)) {
  1595. list.add(comms_state_list, player_uuid);
  1596. sgoto(5, "draw_comms");
  1597. }
  1598. }
  1599. goto("checkgame");
  1600. }
  1601. if(block_loc == fix_lights_loc_1 || block_loc == fix_lights_loc_2) {
  1602. if(player.isGhost(player)) {
  1603. goto("checkgame");
  1604. }
  1605. if(lights_sabotaged) {
  1606. sabotage.openedInv(player);
  1607. inv.open(lights_inv, player, "§cFix Lights");
  1608. }
  1609. goto("checkgame");
  1610. }
  1611. if(block_loc == meeting_button_loc) {
  1612. if(player.isGhost(player)) {
  1613. goto("checkgame");
  1614. }
  1615. if(amongus.isAlert()) {
  1616. msg.prefix(player, gamename, "No meetings allowed while sabotaged.");
  1617. goto("checkgame");
  1618. }
  1619. if(!meeting) {
  1620. callMeeting(player);
  1621. }
  1622. goto("checkgame");
  1623. }
  1624. block_type = block.getType(block_loc);
  1625. if(block_type == "minecraft:lever") {
  1626. cancel = true;
  1627. }
  1628. if(block_type == "minecraft:redstone_lamp") {
  1629. task_id = 10;
  1630. if(!hasTask(player, task_id)) {
  1631. goto("checkgame");
  1632. }
  1633. step = task.getStep(player, task_id);
  1634. if(step == 3) {
  1635. goto("checkgame");
  1636. }
  1637. my_list = map.get(wires_map_4, player.getUuid(player));
  1638. if(block_loc != list.getIndex(my_list, step)) {
  1639. goto("checkgame");
  1640. }
  1641. //inv = inv.new("000000000 002202200 002202200 002202200 002202200 000000000");
  1642. inv = inv.new("000000000002202200002202200002202200002202200000000000");
  1643. inv.setItem(inv, 1, read.item("km:cross_red", 1, "§rDisconnected"));
  1644. inv.setItem(inv, 2, read.item("km:cross_red", 1, "§rDisconnected"));
  1645. inv.setItem(inv, 5, read.item("km:cross_red", 1, "§rDisconnected"));
  1646. inv.setItem(inv, 6, read.item("km:cross_red", 1, "§rDisconnected"));
  1647. inv.setItem(inv, 9, read.item("km:cross_red", 1, "§rDisconnected"));
  1648. inv.setItem(inv, 10, read.item("km:cross_red", 1, "§rDisconnected"));
  1649. inv.setItem(inv, 13, read.item("km:cross_red", 1, "§rDisconnected"));
  1650. inv.setItem(inv, 14, read.item("km:cross_red", 1, "§rDisconnected"));
  1651. list.shuffle(wires_list);
  1652. inv.setItem(inv, 0, list.getIndex(wires_list, 0));
  1653. inv.setItem(inv, 4, list.getIndex(wires_list, 1));
  1654. inv.setItem(inv, 8, list.getIndex(wires_list, 2));
  1655. inv.setItem(inv, 12, list.getIndex(wires_list, 3));
  1656. list.shuffle(wires_list);
  1657. inv.setItem(inv, 3, list.getIndex(wires_list, 0));
  1658. inv.setItem(inv, 7, list.getIndex(wires_list, 1));
  1659. inv.setItem(inv, 11, list.getIndex(wires_list, 2));
  1660. inv.setItem(inv, 15, list.getIndex(wires_list, 3));
  1661. inv.open(inv, player, "§cFix Wiring");
  1662. goto("checkgame");
  1663. }
  1664. if(list.contains(download_list_3, block_loc) || block_loc == admin_upload_loc) {
  1665. cancel = true;
  1666. task_id = 2;
  1667. if(!hasTask(player, task_id)) {
  1668. goto("checkgame");
  1669. }
  1670. step = task.getStep(player, task_id);
  1671. if(block_loc == admin_upload_loc) {
  1672. if(step != 1) {
  1673. goto("checkgame");
  1674. }
  1675. //Upload
  1676. //inv = inv.new("222222222 200000002 000020000");
  1677. inv = inv.new("222222222200000002000020000");
  1678. inv.setItem(inv, 9, read.item("minecraft:birch_trapdoor", 1, "§rMy Laptop"));
  1679. inv.setItem(inv, 10, read.item("minecraft:redstone_torch", 1, "§rHeadquarters"));
  1680. inv.setItem(inv, 11, read.item("km:arrow_up", 1, "§rUpload"));
  1681. inv.open(inv, player, "§cUpload Data");
  1682. goto("checkgame");
  1683. }
  1684. if(step != 0) {
  1685. goto("checkgame");
  1686. }
  1687. r = map.get(download_map_3, player.getUuid(player));
  1688. down_loc = list.getIndex(download_list_3, r);
  1689. if(down_loc != block_loc) {
  1690. goto("checkgame");
  1691. }
  1692. //Download
  1693. inv = inv.new("222222222200000002000020000");
  1694. inv.setItem(inv, 9, read.item("minecraft:chest", 1, map.get(download_map_2, block_loc)));
  1695. inv.setItem(inv, 10, read.item("minecraft:birch_trapdoor", 1, "§rMy Laptop"));
  1696. inv.setItem(inv, 11, read.item("km:arrow_down", 1, "§rDownload"));
  1697. inv.open(inv, player, "§cDownload Data");
  1698. goto("checkgame");
  1699. }
  1700. if(block_loc == get_fuel_loc) {
  1701. task_id = 1;
  1702. if(!hasTask(player, task_id)) {
  1703. goto("checkgame");
  1704. }
  1705. step = task.getStep(player, task_id);
  1706. if(step == 1 || step == 3 || step == 4) {
  1707. goto("checkgame");
  1708. }
  1709. inv = inv.new("333333302333333300333333300333333300333333300333333300");
  1710. //inv = inv.new(333333302 333333300 333333300 333333300 333333300 333333300);
  1711. player_uuid = player.getUuid(player);
  1712. c = map.getOrDefault(fuel_counter, player_uuid, 0);
  1713. for(i = 0; i < 43; i++) {
  1714. if(i >= c) {
  1715. inv.setItem(inv, i, read.item("minecraft:lime_terracotta"));
  1716. }
  1717. }
  1718. inv.setItem(inv, 7, read.item("km:arrow_down", 1, "§rGet fuel"));
  1719. inv.open(inv, player, "§cFuel");
  1720. goto("checkgame");
  1721. }
  1722. if(block_loc == upper_engine_loc || block_loc == lower_engine_loc) {
  1723. task_id = 1;
  1724. cancel = true;
  1725. if(!hasTask(player, task_id)) {
  1726. goto("checkgame");
  1727. }
  1728. step = task.getStep(player, task_id);
  1729. if(step == 0 || step == 2 || step == 4) {
  1730. goto("checkgame");
  1731. }
  1732. if(step == 1 && block_loc != upper_engine_loc) {
  1733. goto("checkgame");
  1734. }
  1735. if(step == 3 && block_loc != lower_engine_loc) {
  1736. goto("checkgame");
  1737. }
  1738. inv = inv.new("333333302333333300333333300333333300333333300333333300");
  1739. //inv = inv.new(333333302 333333300 333333300 333333300 333333300 333333300);
  1740. player_uuid = player.getUuid(player);
  1741. c = map.getOrDefault(fuel_counter, player_uuid, 42);
  1742. for(i = 42; i > c; i--) {
  1743. inv.setItem(inv, i, read.item("minecraft:lime_terracotta"));
  1744. }
  1745. inv.setItem(inv, 7, read.item("km:arrow_up", 1, "§rFill engine"));
  1746. inv.open(inv, player, "§cEngine");
  1747. goto("checkgame");
  1748. }
  1749. goto("checkgame");
  1750. @inv_close
  1751. player_uuid = player.getUuid(player);
  1752. if(list.contains(auto_close_list, player_uuid)) {
  1753. list.add(auto_close_list_2, player_uuid);
  1754. }
  1755. if(amongus.isAlert()) {
  1756. sabotage.closedInv(player);
  1757. }
  1758. if(reactor_sabotaged) {
  1759. if(inv_id == inv.getId(reactor_inv_1)) {
  1760. list.remove(reactor_hold_list_1, player_uuid);
  1761. if(list.getSize(reactor_hold_list_1) == 0) {
  1762. sabotage.holdReactor(reactor_inv_1, false);
  1763. hold_reactor_1 = false;
  1764. }
  1765. goto("checkgame");
  1766. }
  1767. if(inv_id == inv.getId(reactor_inv_2)) {
  1768. list.remove(reactor_hold_list_2, player_uuid);
  1769. if(list.getSize(reactor_hold_list_2) == 0) {
  1770. sabotage.holdReactor(reactor_inv_2, false);
  1771. hold_reactor_2 = false;
  1772. }
  1773. goto("checkgame");
  1774. }
  1775. }
  1776. if(inv_name == "§cFix Communications") {
  1777. map.remove(comms_inv_map, player_uuid);
  1778. map.remove(comms_fix_map, player_uuid);
  1779. goto("checkgame");
  1780. }
  1781. if(inv_name == "§cClean O2 Filter") {
  1782. map.remove(clean_o2_map, player_uuid);
  1783. goto("checkgame");
  1784. }
  1785. if(inv_name == "§cSubmit Scan") {
  1786. list.add(submit_scan_list_2, player_uuid);
  1787. sgoto(20, "unblock_submit_scan");
  1788. goto("checkgame");
  1789. }
  1790. if(inv_name == "§cCalibrate Distributor") {
  1791. list.add(calibrate_dist_list_2, player_uuid);
  1792. sgoto(7, "unblock_calib_dist");
  1793. goto("checkgame");
  1794. }
  1795. if(inv_name == "§cChart Course") {
  1796. map.remove(chart_course_counter, player_uuid);
  1797. map.remove(chart_course_pattern, player_uuid);
  1798. goto("checkgame");
  1799. }
  1800. if(inv_name == "§cEmpty Garbage") {
  1801. list.add(empty_garb_list_2, player_uuid);
  1802. sgoto(25, "unblock_empty_garb");
  1803. goto("checkgame");
  1804. }
  1805. if(inv_name == "§cClear Asteroids") {
  1806. list.add(clear_ast_list_2, player_uuid);
  1807. sgoto(5, "unblock_clear_ast");
  1808. goto("checkgame");
  1809. }
  1810. if(inv_name == "§cUnlock Manifolds") {
  1811. map.remove(manifolds_counter, player_uuid);
  1812. goto("checkgame");
  1813. }
  1814. if(inv_name == "§cStart Reactor") {
  1815. reactor_used = false;
  1816. list.add(reactor_block_list, player_uuid);
  1817. sgoto(20, "unblock_start_reactor");
  1818. goto("checkgame");
  1819. }
  1820. if(inv_name == "§cDownload Data" || inv_name == "Upload Data") {
  1821. list.add(download_list_2, player_uuid);
  1822. sgoto(25, "unblock_download");
  1823. }
  1824. goto("checkgame");
  1825. @inv_click
  1826. if(inv_name == "§cVOTE") {
  1827. if(player.isGhost(player)) {
  1828. goto("checkgame");
  1829. }
  1830. player_uuid = player.getUuid(player);
  1831. if(map.contains(vote_count_map_2, player_uuid)) {
  1832. goto("checkgame");
  1833. }
  1834. item_type = item.getType(item);
  1835. if(item_type == "km:return_green" || item_type == "minecraft:player_head" && item.getType(inv.getItem(inv, inv_slot - 1)) != "minecraft:zombie_head") {
  1836. inv.setItem(inv, 2, air_item);
  1837. inv.setItem(inv, 3, air_item);
  1838. inv.setItem(inv, 6, air_item);
  1839. inv.setItem(inv, 7, air_item);
  1840. inv.setItem(inv, 10, air_item);
  1841. inv.setItem(inv, 11, air_item);
  1842. inv.setItem(inv, 14, air_item);
  1843. inv.setItem(inv, 15, air_item);
  1844. inv.setItem(inv, 18, air_item);
  1845. inv.setItem(inv, 19, air_item);
  1846. inv.setItem(inv, 22, air_item);
  1847. inv.setItem(inv, 23, air_item);
  1848. inv.setItem(inv, 26, air_item);
  1849. inv.setItem(inv, 27, air_item);
  1850. inv.setItem(inv, 30, air_item);
  1851. inv.setItem(inv, 31, air_item);
  1852. inv.setItem(inv, 34, air_item);
  1853. inv.setItem(inv, 35, air_item);
  1854. inv.setItem(inv, 38, air_item);
  1855. inv.setItem(inv, 39, air_item);
  1856. inv.setItem(inv, 41, air_item);
  1857. inv.setItem(inv, 42, air_item);
  1858. inv.setItem(inv, inv_slot + 1, read.item("km:check_green", 1, "§rConfirm"));
  1859. inv.setItem(inv, inv_slot + 2, read.item("km:cross_red", 1, "§rCancel"));
  1860. inv.update(player);
  1861. goto("checkgame");
  1862. }
  1863. if(item_type == "km:cross_red") {
  1864. inv.setItem(inv, inv_slot, air_item);
  1865. inv.setItem(inv, inv_slot - 1, air_item);
  1866. inv.update(player);
  1867. goto("checkgame");
  1868. }
  1869. if(item_type == "km:check_green") {
  1870. if(item.getType(inv.getItem(inv, inv_slot - 2)) != "minecraft:zombie_head") {
  1871. vote_item = inv.getItem(inv, inv_slot - 1);
  1872. if(item.getType(vote_item) == "km:return_green") {
  1873. map.add(vote_count_map, "skip", map.getOrDefault(vote_count_map, "skip", 0) + 1);
  1874. map.add(vote_count_map_2, player_uuid, "skip");
  1875. } else {
  1876. vote_item_name = item.getName(vote_item);
  1877. list = text.split(" ", vote_item_name);
  1878. vote_name = list.getIndex(list, 2);
  1879. vote_uuid = player.getUuid(removeFormat(vote_name));
  1880. map.add(vote_count_map, vote_uuid, map.getOrDefault(vote_count_map, vote_uuid, 0) + 1);
  1881. map.add(vote_count_map_2, player_uuid, vote_uuid);
  1882. }
  1883. inv.setItem(inv, inv_slot, air_item);
  1884. inv.setItem(inv, inv_slot + 1, air_item);
  1885. //Bei allen Spielern anzeigen, dass player gevoted hat
  1886. index = list.getIndexOf(all_list, player_uuid);
  1887. voted_slot = index * 4;
  1888. voted_item = read.item("km:skill33", 1, concat(amongus.getPlayerColorCode(player), player.getName(player), "§r has voted"));
  1889. iter = list.iterator(player_list);
  1890. while(hasNext(iter)) {
  1891. p_uuid = next(iter);
  1892. p = player.get(p_uuid);
  1893. inv = getVoteInv(p);
  1894. inv.setItem(inv, voted_slot, voted_item);
  1895. }
  1896. inv.update(player);
  1897. sound.spawnForPlayer(player, vote_sound, master_sound_category);
  1898. //Haben bereits alle gevoted?
  1899. if(map.getSize(vote_count_map_2) == list.getSize(player_list) - list.getSize(ghosts)) {
  1900. goto("score_evaluation");
  1901. }
  1902. }
  1903. }
  1904. goto("checkgame");
  1905. }
  1906. if(inv_name == "§cENTER CODE") {
  1907. //CODE eingeben
  1908. if(item.hasTag(digit_tag, item)) {
  1909. number = item.getName(item);
  1910. for(i = 0; i < 5; i++) {
  1911. if(item.getType(inv.getItem(inv, i)) == "minecraft:air") {
  1912. break;
  1913. }
  1914. }
  1915. if(i == 5) {
  1916. goto("checkgame");
  1917. }
  1918. inv.setItem(inv, i, item);
  1919. inv.setItem(inv, 5, air_item);
  1920. inv.update(player);
  1921. goto("checkgame");
  1922. }
  1923. //CODEEINGABE CANCELN
  1924. if(inv_slot == 16) {
  1925. for(i = 0; i < 5; i++) {
  1926. inv.setItem(inv, i, air_item);
  1927. }
  1928. inv.update(player);
  1929. goto("checkgame");
  1930. }
  1931. //CODE BESTÄTIGEN
  1932. if(inv_slot == 18) {
  1933. number = "";
  1934. for(i = 0; i < 5; i++) {
  1935. item = inv.getItem(inv, i);
  1936. if(item.getType(item) == "minecraft:air") {
  1937. for(h = 0; h < 5; h++) {
  1938. inv.setItem(inv, h, air_item);
  1939. }
  1940. inv.update(player);
  1941. goto("checkgame");
  1942. }
  1943. number = concat(number, item.getName(item));
  1944. }
  1945. number = read.number(removeFormat(number));
  1946. if(number == oxy_code) {
  1947. player_uuid = player.getUuid(player);
  1948. sgoto_auto_close_inv(player_uuid);
  1949. inv.setItem(inv, 5, read.item("km:check_green", 1, "§rCorrect code"));
  1950. loc = map.get(oxygen_map, player_uuid);
  1951. if(loc == fix_o2_loc_1) {
  1952. oxy_fixed_1 = true;
  1953. removeSaboParticles(fix_o2_par_loc_1, null);
  1954. if(oxy_fixed_2) {
  1955. fix_oxygen();
  1956. }
  1957. } elseif(loc == fix_o2_loc_2) {
  1958. oxy_fixed_2 = true;
  1959. removeSaboParticles(fix_o2_par_loc_2, null);
  1960. if(oxy_fixed_1) {
  1961. fix_oxygen();
  1962. }
  1963. }
  1964. } else {
  1965. inv.setItem(inv, 5, read.item("km:cross_red", 1, "§rFalse code"));
  1966. for(i = 0; i < 5; i++) {
  1967. inv.setItem(inv, i, air_item);
  1968. }
  1969. }
  1970. inv.update(player);
  1971. }
  1972. goto("checkgame");
  1973. }
  1974. if(inv_name == "§cAlign Engine Output") {
  1975. task_id = 17;
  1976. step = task.getStep(player, task_id);
  1977. if(step == 2) {
  1978. goto("checkgame");
  1979. }
  1980. player_uuid = player.getUuid(player);
  1981. loc = map.get(align_engine_map_2, player_uuid);
  1982. if(block_loc == ue_align_loc && set.contains(align_ue_engine_set, player_uuid)) {
  1983. goto("checkgame");
  1984. }
  1985. if(block_loc == le_align_loc && set.contains(align_le_engine_set, player_uuid)) {
  1986. goto("checkgame");
  1987. }
  1988. item_type = item.getType(item);
  1989. if(item_type == "km:arrow_up") {
  1990. temp = set_engine(player, inv, "up");
  1991. } elseif(item_type == "km:arrow_down") {
  1992. temp = set_engine(player, inv, "down");
  1993. } else {
  1994. goto("checkgame");
  1995. }
  1996. inv.update(player);
  1997. if(temp) {
  1998. if(loc == le_align_loc) {
  1999. set.add(align_le_engine_set, player_uuid);
  2000. removeTaskParticle(player, le_align_par_loc);
  2001. } else {
  2002. set.add(align_ue_engine_set, player_uuid);
  2003. removeTaskParticle(player, ue_align_par_loc);
  2004. }
  2005. step = task.stepIncrease(player, task_id);
  2006. giveTask(player, 17, "UE/LE", "Align Engine Output", step, 2, null);
  2007. sgoto_auto_close_inv(player_uuid);
  2008. }
  2009. goto("checkgame");
  2010. }
  2011. if(inv_name == "§cClean O2 Filter") {
  2012. task_id = 15;
  2013. step = task.getStep(player, task_id);
  2014. if(step == 1) {
  2015. goto("checkgame");
  2016. }
  2017. item_type = item.getType(item);
  2018. if(item_type == "km:arrow_up") {
  2019. old_slot = inv_slot + 9;
  2020. } elseif(item_type == "km:arrow_left") {
  2021. old_slot = inv_slot + 1;
  2022. } elseif(item_type == "km:arrow_down") {
  2023. old_slot = inv_slot - 9;
  2024. } else {
  2025. goto("checkgame");
  2026. }
  2027. inv.setItem(inv, inv_slot, read.item("minecraft:oak_leaves"));
  2028. inv.setItem(inv, old_slot, air_item);
  2029. if(inv_slot == 18 || inv_slot == 27) {
  2030. inv.setItem(inv, inv_slot, air_item);
  2031. player_uuid = player.getUuid(player);
  2032. c = map.getOrDefault(clean_o2_map, player_uuid, 0) + 1;
  2033. map.add(clean_o2_map, player_uuid, c);
  2034. if(c == 6) {
  2035. removeTaskParticle(player, clean_o2_par_loc);
  2036. step = task.stepIncrease(player, task_id);
  2037. giveTask(player, 15, "O2", "Clean O2 Filter", 1, 1, null);
  2038. inv.update(player);
  2039. sgoto_auto_close_inv(player_uuid);
  2040. goto("checkgame");
  2041. }
  2042. }
  2043. for(slot = 1; slot < 53; slot++) {
  2044. if(item.getType(inv.getItem(inv, slot)) == "minecraft:oak_leaves") {
  2045. if(slot < 18) {
  2046. temp_type = item.getType(inv.getItem(inv, slot + 9));
  2047. temp_type_2 = item.getType(inv.getItem(inv, slot - 1));
  2048. if(temp_type == "km:arrow_down" || temp_type_2 == "km:arrow_left") {
  2049. continue;
  2050. }
  2051. if(temp_type == "minecraft:air") {
  2052. inv.setItem(inv, slot + 9, read.item("km:arrow_down"));
  2053. continue;
  2054. }
  2055. }
  2056. if(slot > 36) {
  2057. temp_type = item.getType(inv.getItem(inv, slot - 9));
  2058. temp_type_2 = item.getType(inv.getItem(inv, slot - 1));
  2059. if(temp_type == "km:arrow_up" || temp_type_2 == "km:arrow_left") {
  2060. continue;
  2061. }
  2062. if(temp_type == "minecraft:air") {
  2063. inv.setItem(inv, slot - 9, read.item("km:arrow_up"));
  2064. continue;
  2065. }
  2066. }
  2067. if(item.getType(inv.getItem(inv, slot - 1)) == "minecraft:air") {
  2068. inv.setItem(inv, slot - 1, read.item("km:arrow_left"));
  2069. }
  2070. }
  2071. }
  2072. inv.update(player);
  2073. goto("checkgame");
  2074. }
  2075. if(inv_name == "§cDivert Power") {
  2076. task_id = 14;
  2077. step = task.getStep(player, task_id);
  2078. if(step == 2) {
  2079. goto("checkgame");
  2080. }
  2081. item_type = item.getType(item);
  2082. if(item_type == "minecraft:redstone_torch") {
  2083. if(step == 1) {
  2084. goto("checkgame");
  2085. }
  2086. redstone = read.item("minecraft:redstone");
  2087. inv.setItem(inv, 0, redstone);
  2088. inv.setItem(inv, 3, redstone);
  2089. inv.setItem(inv, inv_slot - 9, redstone);
  2090. if(inv_slot < 26) {
  2091. inv.setItem(inv, inv_slot - 16, redstone);
  2092. if(inv_slot < 24) {
  2093. inv.setItem(inv, inv_slot - 20, redstone);
  2094. inv.setItem(inv, inv_slot - 21, redstone);
  2095. }
  2096. } elseif(inv_slot > 26) {
  2097. inv.setItem(inv, inv_slot - 18, redstone);
  2098. if(inv_slot > 28) {
  2099. inv.setItem(inv, inv_slot - 25, redstone);
  2100. inv.setItem(inv, inv_slot - 26, redstone);
  2101. }
  2102. } else {
  2103. inv.setItem(inv, inv_slot - 17, redstone);
  2104. }
  2105. player_uuid = player.getUuid(player);
  2106. removeTaskParticle(player, elec_power_par_loc);
  2107. r = map.get(divert_pow_map_3, player_uuid);
  2108. addTaskParticle(player, map.get(divert_pow_map_4, r));
  2109. step = task.stepIncrease(player, task_id);
  2110. giveTask(player, task_id, "[Room]", "Divert power to [Room]", step, 2, null);
  2111. inv.update(player);
  2112. sgoto_auto_close_inv(player_uuid);
  2113. goto("checkgame");
  2114. }
  2115. if(item_type == "minecraft:stone_button") {
  2116. redstone = read.item("minecraft:redstone");
  2117. inv.setItem(inv, 2, redstone);
  2118. inv.setItem(inv, 6, redstone);
  2119. inv.setItem(inv, 7, redstone);
  2120. inv.setItem(inv, 10, redstone);
  2121. inv.setItem(inv, 11, redstone);
  2122. inv.setItem(inv, 17, redstone);
  2123. inv.setItem(inv, 18, redstone);
  2124. inv.setItem(inv, 19, redstone);
  2125. inv.setItem(inv, 21, redstone);
  2126. inv.setItem(inv, 22, redstone);
  2127. inv.setItem(inv, 25, redstone);
  2128. inv.setItem(inv, 26, redstone);
  2129. player_uuid = player.getUuid(player);
  2130. r = map.get(divert_pow_map_3, player_uuid);
  2131. removeTaskParticle(player, map.get(divert_pow_map_4, r));
  2132. step = task.stepIncrease(player, task_id);
  2133. giveTask(player, task_id, "[Room]", "Divert power to [Room]", step, 2, null);
  2134. inv.open(inv, player, "§cDivert Power");
  2135. inv.update(player);
  2136. sgoto_auto_close_inv(player.getUuid(player));
  2137. }
  2138. goto("checkgame");
  2139. }
  2140. if(inv_name == "§cClear Asteroids") {
  2141. task_id = 13;
  2142. step = task.getStep(player, task_id);
  2143. if(step == 20) {
  2144. goto("checkgame");
  2145. }
  2146. if(item.getType(item) == "minecraft:bedrock") {
  2147. inv.setItem(inv, inv_slot, air_item);
  2148. inv.update(player);
  2149. player_uuid = player.getUuid(player);
  2150. my_list = map.get(clear_ast_map, player_uuid);
  2151. iter = list.iterator(my_list);
  2152. while(hasNext(iter)) {
  2153. a = next(iter);
  2154. slot = a[1];
  2155. if(slot == inv_slot) {
  2156. step = task.stepIncrease(player, task_id);
  2157. giveTask(player, 13, "Weapons", "Clear Asteroids", step, 20, null);
  2158. if(step == 20) {
  2159. removeTaskParticle(player, clear_ast_par_loc);
  2160. sgoto_auto_close_inv(player_uuid);
  2161. list.add(clear_ast_list_3, player_uuid);
  2162. break;
  2163. } else {
  2164. remove(iter);
  2165. continue;
  2166. }
  2167. }
  2168. }
  2169. }
  2170. goto("checkgame");
  2171. }
  2172. if(inv_name == "§cEmpty Garbage") {
  2173. task_id = 12;
  2174. step = task.getStep(player, task_id);
  2175. if(step == 2) {
  2176. goto("checkgame");
  2177. }
  2178. if(item.getType(item) == "km:arrow_down") {
  2179. inv.setItem(inv, 35, air_item);
  2180. inv.update(player);
  2181. player_uuid = player.getUuid(player);
  2182. list.add(empty_garb_list, player_uuid);
  2183. map.add(empty_garb_map, player_uuid, 0);
  2184. map.add(empty_garb_map_2, player_uuid, inv);
  2185. sgoto(20, "empty_garb");
  2186. }
  2187. goto("checkgame");
  2188. }
  2189. if(inv_name == "§cSwipe Card") {
  2190. task_id = 11;
  2191. step = task.getStep(player, task_id);
  2192. if(step == 1) {
  2193. goto("checkgame");
  2194. }
  2195. if(inv_slot == 0 || (item.getType(item) == "minecraft:air" && item.getType(inv.getItem(inv, inv_slot - 1)) == "minecraft:lime_stained_glass_pane")) {
  2196. player_uuid = player.getUuid(player);
  2197. if(inv_slot == 0) {
  2198. map.add(swipe_card_map, player_uuid, time.getMillis());
  2199. }
  2200. inv.setItem(inv, inv_slot, lime_glass);
  2201. if(inv_slot == 4) {
  2202. start_time = map.get(swipe_card_map, player_uuid);
  2203. time = (time.getMillis() - start_time) / 1000;
  2204. if(time < 1.8) {
  2205. inv.setItem(inv, 5, read.item("km:cross_red", 1, concat("§rToo fast ", math.roundComma(time, 1), "s")));
  2206. for(i = 0; i < 5; i++) {
  2207. inv.setItem(inv, i, air_item);
  2208. }
  2209. } elseif(time > 2.2) {
  2210. inv.setItem(inv, 5, read.item("km:cross_red", 1, concat("§rToo slow ", math.roundComma(time, 1), "s")));
  2211. for(i = 0; i < 5; i++) {
  2212. inv.setItem(inv, i, air_item);
  2213. }
  2214. } else {
  2215. removeTaskParticle(player, swipe_card_par_loc);
  2216. inv.setItem(inv, 5, read.item("km:check_green", 1, "§rTask completed"));
  2217. step = task.stepIncrease(player, task_id);
  2218. giveTask(player, 11, "Admin", "Swipe Card", 1, 1, null);
  2219. sgoto_auto_close_inv(player_uuid);
  2220. }
  2221. }
  2222. inv.update(player);
  2223. }
  2224. goto("checkgame");
  2225. }
  2226. if(inv_name == "§cFix Wiring") {
  2227. task_id = 10;
  2228. step = task.getStep(player, task_id);
  2229. if(step == 3) {
  2230. goto("checkgame");
  2231. }
  2232. player_uuid = player.getUuid(player);
  2233. if(inv_slot == 0 || inv_slot == 4 || inv_slot == 8 || inv_slot == 12) {
  2234. map.add(wires_map_2, player_uuid, inv_slot);
  2235. }
  2236. if(inv_slot == 3 || inv_slot == 7 || inv_slot == 11 || inv_slot == 15) {
  2237. slot = map.get(wires_map_2, player_uuid);
  2238. if(slot == null) {
  2239. goto("checkgame");
  2240. }
  2241. map.remove(wires_map_2, player_uuid);
  2242. if(item.getType(inv.getItem(inv, slot)) == item.getType(item) && item.getType(inv.getItem(inv, inv_slot - 1)) == "km:cross_red") {
  2243. inv.setItem(inv, slot + 1, read.item("km:check_green", 1, "§rConnected"));
  2244. inv.setItem(inv, inv_slot - 1, read.item("km:check_green", 1, "§rConnected"));
  2245. inv.update(player);
  2246. c = map.getOrDefault(wires_map, player_uuid, 0) + 1;
  2247. map.add(wires_map, player_uuid, c);
  2248. if(c == 4) {
  2249. map.remove(wires_map, player_uuid);
  2250. step = task.stepIncrease(player, task_id);
  2251. giveTask(player, 10, "Cafeteria", "Fix Wiring", step, 3, null);
  2252. sgoto_auto_close_inv(player_uuid);
  2253. }
  2254. }
  2255. }
  2256. goto("checkgame");
  2257. }
  2258. if(inv_name == "§cCalibrate Distributor") {
  2259. task_id = 9;
  2260. step = task.getStep(player, task_id);
  2261. if(step == 1) {
  2262. goto("checkgame");
  2263. }
  2264. if(inv_slot == 14) {
  2265. player_uuid = player.getUuid(player);
  2266. a = map.get(calibrate_dist_map, player_uuid);
  2267. if(item.getType(inv.getItem(inv, 9)) == item.getType(inv.getItem(inv, 10))) {
  2268. stage = a[4] + 1;
  2269. a[4] = stage;
  2270. if(stage == 1) {
  2271. inv.setItem(inv, 0, read.item("km:check_green"));
  2272. inv.setItem(inv, 10, blue_glass);
  2273. inv.setItem(inv, 11, blue_glass);
  2274. } elseif(stage == 2) {
  2275. inv.setItem(inv, 1, read.item("km:check_green"));
  2276. inv.setItem(inv, 10, cyan_glass);
  2277. inv.setItem(inv, 11, cyan_glass);
  2278. } elseif(stage == 3) {
  2279. removeTaskParticle(player, calibrate_dist_par_loc);
  2280. inv.setItem(inv, 2, read.item("km:check_green"));
  2281. step = task.stepIncrease(player, task_id);
  2282. giveTask(player, 9, "Electrical", "Calibrate Distributor", 1, 1, null);
  2283. sgoto_auto_close_inv(player_uuid);
  2284. }
  2285. } else {
  2286. a[4] = 0;
  2287. inv.setItem(inv, 0, read.item("km:cross_red"));
  2288. inv.setItem(inv, 1, read.item("km:cross_red"));
  2289. inv.setItem(inv, 2, read.item("km:cross_red"));
  2290. inv.setItem(inv, 10, yellow_glass);
  2291. inv.setItem(inv, 11, yellow_glass);
  2292. }
  2293. a[3] = a[2]; //Index = Start_index
  2294. map.add(calibrate_dist_map, player_uuid, a);
  2295. for(h = 0; h < 12; h++) {
  2296. inv.setItem(inv, calibrate_dist_array[h], air_item);
  2297. }
  2298. inv.update(player);
  2299. }
  2300. goto("checkgame");
  2301. }
  2302. if(inv_name == "§cInspect Sample") {
  2303. task_id = 8;
  2304. step = task.getStep(player, task_id);
  2305. if(step == 1) {
  2306. goto("checkgame");
  2307. }
  2308. item_type = item.getType(item);
  2309. if(item_type == "minecraft:green_stained_glass_pane") {
  2310. if(inv_slot == 20) {
  2311. inv.setItem(inv, 20, read.item("minecraft:gray_stained_glass_pane", 59, "§rGo grab a coffee"));
  2312. giveTask(player, 8, "MedBay", "Inspect Sample", 0, 1, 59);
  2313. player_uuid = player.getUuid(player);
  2314. list.add(sample_list, player_uuid);
  2315. list.add(sample_list_2, 59);
  2316. map.add(sample_map, player_uuid, inv);
  2317. inv.update(player);
  2318. sgoto(20, "countdown_sample");
  2319. goto("checkgame");
  2320. }
  2321. if(inv_slot >= 15) {
  2322. if(item.getType(inv.getItem(inv, inv_slot - 5)) == "minecraft:red_stained_glass_pane") {
  2323. removeTaskParticle(player, inspect_par_loc);
  2324. step = task.stepIncrease(player, task_id);
  2325. giveTask(player, 8, "MedBay", "Inspect Sample", 1, 1, null);
  2326. sgoto_auto_close_inv(player.getUuid(player));
  2327. } else {
  2328. for(i = 0; i < 15; i++) {
  2329. inv.setItem(inv, i, read.item("minecraft:white_stained_glass_pane", 1, "§rSample"));
  2330. }
  2331. for(i = 15; i < 20; i++) {
  2332. inv.setItem(inv, i, read.item("minecraft:gray_stained_glass_pane", 1, "§rSelect sample"));
  2333. }
  2334. inv.setItem(inv, 20, read.item("minecraft:green_stained_glass_pane", 1, "§rPress to start"));
  2335. giveTask(player, 8, "MedBay", "Inspect Sample", 0, 1, null);
  2336. inv.update(player);
  2337. }
  2338. }
  2339. }
  2340. goto("checkgame");
  2341. }
  2342. if(inv_name == "§cStabilize Steering") {
  2343. task_id = 7;
  2344. step = task.getStep(player, task_id);
  2345. if(step == 1) {
  2346. goto("checkgame");
  2347. }
  2348. item_type = item.getType(item);
  2349. new_cross_slot = inv_slot;
  2350. if(item_type == "km:arrow_down") {
  2351. cross_slot = inv_slot - 9;
  2352. if(cross_slot == 22) {
  2353. new_cross_slot = cross_slot;
  2354. cross_slot -= 9;
  2355. }
  2356. } elseif(item_type == "km:arrow_up") {
  2357. cross_slot = inv_slot + 9;
  2358. if(cross_slot == 22) {
  2359. new_cross_slot = cross_slot;
  2360. cross_slot += 9;
  2361. }
  2362. } elseif(item_type == "km:arrow_left") {
  2363. cross_slot = inv_slot + 1;
  2364. if(cross_slot == 22) {
  2365. new_cross_slot = cross_slot;
  2366. cross_slot++;
  2367. }
  2368. } elseif(item_type == "km:arrow_right") {
  2369. cross_slot = inv_slot - 1;
  2370. if(cross_slot == 22) {
  2371. new_cross_slot = cross_slot;
  2372. cross_slot--;
  2373. }
  2374. } else {
  2375. goto("checkgame");
  2376. }
  2377. //remove old plus
  2378. if(cross_slot != 22) {
  2379. inv.setItem(inv, cross_slot, air_item);
  2380. }
  2381. temp_slot = cross_slot - 1;
  2382. if(temp_slot == 22) {
  2383. temp_slot--;
  2384. }
  2385. if(temp_slot >= 0 && cross_slot % 9 != 0) {
  2386. inv.setItem(inv, temp_slot, air_item);
  2387. }
  2388. temp_slot = cross_slot + 1;
  2389. if(temp_slot == 22) {
  2390. temp_slot++;
  2391. }
  2392. if(temp_slot >= 0 && temp_slot % 9 != 0) {
  2393. inv.setItem(inv, temp_slot, air_item);
  2394. }
  2395. temp_slot = cross_slot - 9;
  2396. if(temp_slot == 22) {
  2397. temp_slot -= 9;
  2398. }
  2399. if(temp_slot >= 0) {
  2400. inv.setItem(inv, temp_slot, air_item);
  2401. }
  2402. temp_slot = cross_slot + 9;
  2403. if(temp_slot == 22) {
  2404. temp_slot += 9;
  2405. }
  2406. if(temp_slot < 45) {
  2407. inv.setItem(inv, temp_slot, air_item);
  2408. }
  2409. //set new plus
  2410. inv.setItem(inv, new_cross_slot, read.item("km:plus_red"));
  2411. temp_slot = new_cross_slot - 1;
  2412. if(temp_slot == 22) {
  2413. inv.setItem(inv, temp_slot - 1, read.item("km:arrow_left"));
  2414. } else {
  2415. if(temp_slot >= 0 && new_cross_slot % 9 != 0) {
  2416. inv.setItem(inv, temp_slot, read.item("km:arrow_left"));
  2417. }
  2418. }
  2419. temp_slot = new_cross_slot + 1;
  2420. if(temp_slot == 22) {
  2421. inv.setItem(inv, temp_slot + 1, read.item("km:arrow_right"));
  2422. } else {
  2423. if(temp_slot >= 0 && temp_slot % 9 != 0) {
  2424. inv.setItem(inv, temp_slot, read.item("km:arrow_right"));
  2425. }
  2426. }
  2427. temp_slot = new_cross_slot - 9;
  2428. if(temp_slot == 22) {
  2429. inv.setItem(inv, temp_slot - 9, read.item("km:arrow_up"));
  2430. } else {
  2431. if(temp_slot >= 0) {
  2432. inv.setItem(inv, temp_slot, read.item("km:arrow_up"));
  2433. }
  2434. }
  2435. temp_slot = new_cross_slot + 9;
  2436. if(temp_slot == 22) {
  2437. inv.setItem(inv, temp_slot + 9, read.item("km:arrow_down"));
  2438. } else {
  2439. if(temp_slot < 45) {
  2440. inv.setItem(inv, temp_slot, read.item("km:arrow_down"));
  2441. }
  2442. }
  2443. //finish task
  2444. if(new_cross_slot == 22) {
  2445. removeTaskParticle(player, steering_par_loc);
  2446. inv.setItem(inv, 44, read.item("km:check_green", 1, "§rTask completed"));
  2447. step = task.stepIncrease(player, task_id);
  2448. giveTask(player, task_id, "Navigation", "Stabilize Steering", 1, 1, null);
  2449. sgoto_auto_close_inv(player.getUuid(player));
  2450. }
  2451. inv.update(player);
  2452. goto("checkgame");
  2453. }
  2454. if(inv_name == "§cChart Course") {
  2455. task_id = 6;
  2456. step = task.getStep(player, task_id);
  2457. if(step == 1) {
  2458. goto("checkgame");
  2459. }
  2460. player_uuid = player.getUuid(player);
  2461. a = map.get(chart_course_pattern, player_uuid);
  2462. c = map.getOrDefault(chart_course_counter, player_uuid, 0);
  2463. if(a[c] == inv_slot) {
  2464. inv.setItem(inv, inv_slot, green_glass);
  2465. map.add(chart_course_counter, player_uuid, c + 1);
  2466. if(c == 8) {
  2467. inv.setItem(inv, inv.getSize(inv) - 1, read.item("km:check_green", 1, "§rTask completed"));
  2468. removeTaskParticle(player, chart_course_par_loc);
  2469. step = task.stepIncrease(player, task_id);
  2470. giveTask(player, task_id, "Navigation", "Chart Course", 1, 1, null);
  2471. sgoto_auto_close_inv(player_uuid);
  2472. }
  2473. inv.update(player);
  2474. }
  2475. goto("checkgame");
  2476. }
  2477. if(inv_name == "§cUnlock Manifolds") {
  2478. task_id = 5;
  2479. step = task.getStep(player, task_id);
  2480. if(step == 1) {
  2481. goto("checkgame");
  2482. }
  2483. item_type = item.getType(item);
  2484. if(item_type == "minecraft:blue_stained_glass_pane") {
  2485. player_uuid = player.getUuid(player);
  2486. amount = map.getOrDefault(manifolds_counter, player_uuid, 1);
  2487. if(amount == item.getAmount(item)) {
  2488. inv.setItem(inv, inv_slot, read.item("minecraft:green_stained_glass_pane", amount));
  2489. inv.update(player);
  2490. map.add(manifolds_counter, player_uuid, amount + 1);
  2491. if(amount == 10) {
  2492. removeTaskParticle(player, unlock_manifolds_par_loc);
  2493. step = task.stepIncrease(player, task_id);
  2494. giveTask(player, task_id, "Reactor", "Unlock Manifolds", 1, 1, null);
  2495. sgoto_auto_close_inv(player_uuid);
  2496. }
  2497. goto("checkgame");
  2498. }
  2499. goto("false_manifolds_click");
  2500. }
  2501. if(item_type == "minecraft:green_stained_glass_pane") {
  2502. goto("false_manifolds_click");
  2503. }
  2504. goto("checkgame");
  2505. }
  2506. if(inv_name == "§cStart Reactor") {
  2507. task_id = 4;
  2508. step = task.getStep(player, task_id);
  2509. if(step == 1) {
  2510. goto("checkgame");
  2511. }
  2512. if(!(inv_slot > 7 && inv_slot < 11 || inv_slot > 13 && inv_slot < 17 || inv_slot > 19 && inv_slot < 23)) {
  2513. goto("checkgame");
  2514. }
  2515. player_uuid = player.getUuid(player);
  2516. item_type = item.getType(item);
  2517. if(item_type == "minecraft:red_stained_glass_pane") {
  2518. goto("checkgame");
  2519. }
  2520. if(item_type == "minecraft:black_stained_glass_pane") {
  2521. goto("false_reactor_click");
  2522. }
  2523. if(reactor.getPhase(reactor_array) == "draw") {
  2524. goto("false_reactor_click");
  2525. }
  2526. reactor_array = reactor.get(player);
  2527. stage = reactor.getStage(reactor_array);
  2528. counter = reactor.getCounter(reactor_array);
  2529. pattern = reactor.getPattern(reactor_array);
  2530. if(inv_slot - 3 != pattern[counter]) {
  2531. goto("false_reactor_click");
  2532. }
  2533. inv.setItem(inv, inv_slot, blue_glass);
  2534. inv.update(player);
  2535. list.add(reset_reactor_click_list, player_uuid);
  2536. list.add(reset_reactor_click_list_2, inv_slot);
  2537. sgoto(10, "reset_reactor_click");
  2538. if(counter == stage && stage < 5) {
  2539. stage++;
  2540. reactor.setStage(reactor_array, stage);
  2541. reactor.setCounter(reactor_array, 0);
  2542. reactor.setPhase(reactor_array, "draw");
  2543. reactor.save(reactor_array, player);
  2544. if(stage == 5) {
  2545. removeTaskParticle(player, start_reactor_par_loc);
  2546. step = task.stepIncrease(player, task_id);
  2547. giveTask(player, task_id, "Reactor", "Start Reactor", 1, 1, null);
  2548. sgoto_auto_close_inv(player_uuid);
  2549. reactor_used = false;
  2550. goto("checkgame");
  2551. }
  2552. list.add(reactor_draw_list_1, player_uuid);
  2553. sgoto(20, "draw_pattern_1");
  2554. goto("checkgame");
  2555. }
  2556. reactor.setCounter(reactor_array, ++counter);
  2557. reactor.save(reactor_array, player);
  2558. goto("checkgame");
  2559. }
  2560. if(inv_name == "§cPrime Shields") {
  2561. task_id = 3;
  2562. step = task.getStep(player, task_id);
  2563. if(step == 1) {
  2564. goto("checkgame");
  2565. }
  2566. item_type = item.getType(item);
  2567. if(item_type == "minecraft:red_stained_glass_pane") {
  2568. inv.setItem(inv, inv_slot, green_glass);
  2569. inv.update(player);
  2570. c = 0;
  2571. for(i = 0; i < 16; i++) {
  2572. if(item.getType(inv.getitem(inv, i)) == "minecraft:green_stained_glass_pane") {
  2573. c++;
  2574. }
  2575. }
  2576. if(c == 16) {
  2577. removeTaskParticle(player, prime_shields_par_loc);
  2578. step = task.stepIncrease(player, task_id);
  2579. giveTask(player, task_id, "Shields", "Prime Shields", 1, 1, null);
  2580. sgoto_auto_close_inv(player.getUuid(player));
  2581. }
  2582. }
  2583. if(item_type == "minecraft:green_stained_glass_pane") {
  2584. inv.setItem(inv, inv_slot, red_glass);
  2585. inv.update(player);
  2586. }
  2587. goto("checkgame");
  2588. }
  2589. if(inv_id == inv.getId(reactor_inv_1)) {
  2590. if(reactor_sabotaged) {
  2591. sabotage.holdReactor(reactor_inv_1, true);
  2592. inv.update(player);
  2593. hold_reactor_1 = true;
  2594. if(hold_reactor_2) {
  2595. fix_meltdown();
  2596. }
  2597. }
  2598. goto("checkgame");
  2599. }
  2600. if(inv_id == inv.getId(reactor_inv_2)) {
  2601. if(reactor_sabotaged) {
  2602. sabotage.holdReactor(reactor_inv_2, true);
  2603. inv.update(player);
  2604. hold_reactor_2 = true;
  2605. if(hold_reactor_1) {
  2606. fix_meltdown();
  2607. }
  2608. }
  2609. goto("checkgame");
  2610. }
  2611. if(inv_name == "§cFix Communications") {
  2612. if(!comms_sabotaged) {
  2613. goto("checkgame");
  2614. }
  2615. if(inv_slot == 36) {
  2616. comms_freq = item.getAmount(inv.getItem(inv, 37)) - 1;
  2617. } elseif(inv_slot == 38) {
  2618. comms_freq = item.getAmount(inv.getItem(inv, 37)) + 1;
  2619. } else {
  2620. goto("checkgame");
  2621. }
  2622. if(comms_freq < 1 || comms_freq > 64) {
  2623. goto("checkgame");
  2624. }
  2625. inv.setItem(inv, 37, read.item("minecraft:black_stained_glass_pane", comms_freq));
  2626. inv.update(player);
  2627. player_uuid = player.getUuid(player);
  2628. comms_state = map.get(comms_state_map, player_uuid);
  2629. diff = math.abs(comms_freq - comms_fix_freq);
  2630. if(diff == 0) {
  2631. if(comms_state != 2) {
  2632. comms.drawCorrect(inv, player);
  2633. }
  2634. list.add(comms_fix_list, player_uuid);
  2635. map.add(comms_fix_map, player_uuid, time.getMillis());
  2636. sgoto(40, "scheduled_fix_comms");
  2637. goto("checkgame");
  2638. } elseif(diff < 4) {
  2639. if(comms_state != 1) {
  2640. comms.drawClose(inv, player);
  2641. }
  2642. map.remove(comms_fix_map, player_uuid);
  2643. } else {
  2644. if(comms_state != 0) {
  2645. comms.drawWorst(inv, player);
  2646. }
  2647. map.remove(comms_fix_map, player_uuid);
  2648. }
  2649. goto("checkgame");
  2650. }
  2651. if(inv_name == "§cFix Lights") {
  2652. if(!lights_sabotaged) {
  2653. goto("checkgame");
  2654. }
  2655. item_type = item.getType(item);
  2656. if(item_type == "minecraft:red_stained_glass_pane") {
  2657. inv.setItem(lights_inv, inv_slot, read.item("minecraft:green_stained_glass_pane", 1, "§rOn"));
  2658. inv.update(player);
  2659. c = 0;
  2660. for(i = 0; i < 5; i++) {
  2661. if(item.getType(inv.getitem(lights_inv, i)) == "minecraft:green_stained_glass_pane") {
  2662. c++;
  2663. }
  2664. }
  2665. if(c == 5) {
  2666. fix_light();
  2667. }
  2668. goto("checkgame");
  2669. }
  2670. if(item_type == "minecraft:green_stained_glass_pane") {
  2671. inv.setItem(lights_inv, inv_slot, read.item("minecraft:red_stained_glass_pane", 1, "§rOff"));
  2672. inv.update(player);
  2673. }
  2674. goto("checkgame");
  2675. }
  2676. if(inv_name == "§cDownload Data") {
  2677. if(item.getName(item) == "§rDownload") {
  2678. inv.setItem(inv, 11, air_item);
  2679. gosub("download_data_2");
  2680. }
  2681. goto("checkgame");
  2682. }
  2683. if(inv_name == "§cUpload Data") {
  2684. if(item.getName(item) == "§rUpload") {
  2685. inv.setItem(inv, 11, air_item);
  2686. gosub("download_data_2");
  2687. }
  2688. goto("checkgame");
  2689. }
  2690. if(inv_name == "§cFuel") {
  2691. task_id = 1;
  2692. step = task.getStep(player, task_id);
  2693. if(step == 1 || step == 3 || step == 4) {
  2694. goto("checkgame");
  2695. }
  2696. if(item.getName(item) == "§rGet fuel") {
  2697. player_uuid = player.getUuid(player);
  2698. c = map.getOrDefault(fuel_counter, player_uuid, 0);
  2699. if(c == 7) {
  2700. c++;
  2701. }
  2702. inv.setItem(inv, c++, air_item);
  2703. inv.update(player);
  2704. map.add(fuel_counter, player_uuid, c);
  2705. if(c == 43) {
  2706. step = task.stepIncrease(player, task_id);
  2707. map.remove(fuel_counter, player_uuid);
  2708. removeTaskParticle(player, get_fuel_par_loc);
  2709. if(step == 1) {
  2710. addTaskParticle(player, upper_engine_par_loc);
  2711. giveTask(player, task_id, "Upper engine", "Fuel Engines", 1, 4, null);
  2712. sgoto_auto_close_inv(player_uuid);
  2713. } elseif(step == 3) {
  2714. addTaskParticle(player, lower_engine_par_loc);
  2715. giveTask(player, task_id, "Lower engine", "Fuel Engines", 3, 4, null);
  2716. sgoto_auto_close_inv(player_uuid);
  2717. }
  2718. }
  2719. goto("checkgame");
  2720. }
  2721. cancel = true;
  2722. goto("checkgame");
  2723. }
  2724. if(inv_name == "§cEngine") {
  2725. task_id = 1;
  2726. step = task.getStep(player, task_id);
  2727. if(step == 0 || step == 2 || step == 4) {
  2728. goto("checkgame");
  2729. }
  2730. if(item.getName(item) == "§rFill engine") {
  2731. player_uuid = player.getUuid(player);
  2732. c = map.getOrDefault(fuel_counter, player_uuid, 42);
  2733. if(c == 7) {
  2734. c--;
  2735. }
  2736. inv.setItem(inv, c--, read.item("minecraft:lime_terracotta"));
  2737. inv.update(player);
  2738. map.add(fuel_counter, player_uuid, c);
  2739. if(c == -1) {
  2740. map.remove(fuel_counter, player_uuid);
  2741. if(step == 1) {
  2742. removeTaskParticle(player, upper_engine_par_loc);
  2743. addTaskParticle(player, get_fuel_par_loc);
  2744. giveTask(player, task_id, "Storage", "Fuel Engines", 2, 4, null);
  2745. sgoto_auto_close_inv(player_uuid);
  2746. } elseif(step == 3) {
  2747. removeTaskParticle(player, lower_engine_par_loc);
  2748. giveTask(player, task_id, "Lower engine", "Fuel Engines", 4, 4, null);
  2749. sgoto_auto_close_inv(player_uuid);
  2750. }
  2751. step = task.stepIncrease(player, task_id);
  2752. }
  2753. goto("checkgame");
  2754. }
  2755. cancel = true;
  2756. }
  2757. goto("checkgame");
  2758. @score_evaluation
  2759. sort_array = map.sort(vote_count_map, false);
  2760. //Ausgabe der Votes
  2761. minigame.speakAll(gamename, "§0------------------------");
  2762. sort_array_size = array.getSize(sort_array);
  2763. for(i = 0; i < sort_array_size; i++) {
  2764. p_uuid = sort_array[i, 0];
  2765. value = sort_array[i, 1];
  2766. if(p_uuid == "skip") {
  2767. minigame.speakAll(gamename, concat("Skipped: ", text.number(value)));
  2768. } else {
  2769. minigame.speakAll(gamename, concat(amongus.getPlayerColorCode(p_uuid), player.getName(p_uuid), "§r ", text.number(value)));
  2770. }
  2771. }
  2772. //Auswertung der Votes
  2773. if(sort_array_size == 0) {
  2774. message = "Nobody voted (Skipped).";
  2775. minigame.speakAll(gamename, message);
  2776. minigame.titleAll("Voting ended", message, 20, 60, 20);
  2777. continueGame();
  2778. goto("checkgame");
  2779. } elseif(sort_array_size == 1) {
  2780. kick_uuid = sort_array[0, 0];
  2781. } else {
  2782. value_0 = sort_array[0, 1];
  2783. value_1 = sort_array[1, 1];
  2784. if(value_0 > value_1) {
  2785. kick_uuid = sort_array[0, 0];
  2786. } else {
  2787. message = "No one ejected (Tie).";
  2788. minigame.speakAll(gamename, message);
  2789. minigame.titleAll("Voting ended", message, 20, 60, 20);
  2790. continueGame();
  2791. goto("checkgame");
  2792. }
  2793. }
  2794. if(kick_uuid == "skip") {
  2795. message = "No one ejected (Skipped).";
  2796. minigame.speakAll(gamename, message);
  2797. minigame.titleAll("Voting ended", message, 20, 60, 20);
  2798. continueGame();
  2799. goto("checkgame");
  2800. }
  2801. //Vollstreckung
  2802. if(confirm_ejects) {
  2803. if(isImpostor(kick_uuid)) {
  2804. message = "§r was an §cimpostor§r.";
  2805. } else {
  2806. message = "§r was a §bcrewmate§r.";
  2807. }
  2808. } else {
  2809. message = "§r was ejected.";
  2810. }
  2811. message = concat(amongus.getPlayerColorCode(kick_uuid), player.getName(kick_uuid), message);
  2812. minigame.speakAll(gamename, message);
  2813. list.add(ghosts, kick_uuid);
  2814. kick_player = player.get(kick_uuid);
  2815. stacks.clearIndex(kick_player, 0);
  2816. stacks.clearIndex(kick_player, 1);
  2817. stacks.clearIndex(kick_player, 3);
  2818. stacks.clearIndex(kick_player, 4);
  2819. entity.addEffect(kick_player, "invisibility", 999999, 1, false);
  2820. amongus.removeEquip(kick_player);
  2821. minigame.titleAll("Voting ended", message, 20, 60, 20);
  2822. //Checkwin
  2823. imps_alive = 0;
  2824. crew_alive = 0;
  2825. iter = list.iterator(player_list);
  2826. while(hasNext(iter)) {
  2827. p_uuid = next(iter);
  2828. p = player.get(p_uuid);
  2829. if(!player.isGhost(p)) {
  2830. if(isImpostor(p)) {
  2831. imps_alive++;
  2832. } else {
  2833. crew_alive++;
  2834. }
  2835. }
  2836. }
  2837. if(imps_alive == 0) {
  2838. winners = "§bCrewmates";
  2839. goto("win");
  2840. }
  2841. if(imps_alive >= crew_alive) {
  2842. winners = "§cImpostors";
  2843. goto("win");
  2844. }
  2845. continueGame();
  2846. goto("checkgame");
  2847. @player_logout
  2848. @player_giveup
  2849. minigame.speakAll(gamename, concat(amongus.getPlayerColorCode(player), player.getName(player), " §rhas left the game."));
  2850. player.setGamemode(player, "survival");
  2851. script = script.getFromId(script_id);
  2852. minigame.kickplayer(script, player);
  2853. player.mute(player, false);
  2854. if(isImpostor(player)) {
  2855. list.remove(impostors_list_2, player_uuid);
  2856. }
  2857. //Building-Perms wieder geben
  2858. player_uuid = player.getUuid(player);
  2859. if(list.contains(removed_perms, player_uuid)) {
  2860. list.remove(removed_perms, player_uuid);
  2861. perm.registerPlayer(player_uuid, 1);
  2862. perm.registerPlayer(player_uuid, 15);
  2863. }
  2864. if(freeplay) {
  2865. removeDeadBodies();
  2866. removeCamBodies();
  2867. minigame.kickAllPlayers(script);
  2868. minigame.term(script, gamesignloc);
  2869. term();
  2870. }
  2871. //checkwin
  2872. imps_alive = 0;
  2873. crew_alive = 0;
  2874. iter = list.iterator(player_list);
  2875. while(hasNext(iter)) {
  2876. p_uuid = next(iter);
  2877. p = player.get(p_uuid);
  2878. if(!player.isGhost(p)) {
  2879. if(isImpostor(p)) {
  2880. imps_alive++;
  2881. } else {
  2882. crew_alive++;
  2883. }
  2884. }
  2885. }
  2886. if(imps_alive == 0) {
  2887. winners = "§bCrewmates";
  2888. goto("win");
  2889. }
  2890. if(imps_alive >= crew_alive) {
  2891. winners = "§cImpostors";
  2892. goto("win");
  2893. }
  2894. if(!player.isGhost(player)) {
  2895. amongus.removeFromAdminTable(player);
  2896. }
  2897. amount_all_tasks = (amount_short + amount_common + amount_long) * crew_alive;
  2898. pct = amount_done_tasks / amount_all_tasks;
  2899. boss.setPercent(pct);
  2900. iter = list.iterator(player_list);
  2901. while(hasNext(iter)) {
  2902. p_uuid = next(iter);
  2903. p = player.get(p_uuid);
  2904. boss.send(p, "UPDATE_PCT");
  2905. }
  2906. if(meeting) {
  2907. //Vote des leavenden Spielers entfernen
  2908. vote_uuid = map.get(vote_count_map_2, player_uuid);
  2909. if(vote_uuid != null) {
  2910. votes = map.get(vote_count_map, vote_uuid) - 1;
  2911. if(votes == 0) {
  2912. map.remove(vote_count_map, vote_uuid);
  2913. } else {
  2914. map.add(vote_count_map, vote_uuid, votes);
  2915. }
  2916. map.remove(vote_count_map_2, player_uuid);
  2917. }
  2918. //Alle Votes entfernen, die auf den leavenden Spieler lauten
  2919. iter = map.iterator(vote_count_map_2);
  2920. while(hasNext(iter)) {
  2921. element = next(iter);
  2922. vote_uuid = map.getValue(element);
  2923. if(vote_uuid == player_uuid) {
  2924. //Spieler neu voten lassen
  2925. voter_uuid = map.getKey(element);
  2926. remove(iter);
  2927. map.remove(vote_count_map_2, voter_uuid);
  2928. //Vote-Menu aktualisieren
  2929. index = list.getIndexOf(all_list, voter_uuid);
  2930. voted_slot = index * 4;
  2931. setItemInVoteInv(voted_slot, air_item);
  2932. }
  2933. }
  2934. //Vote-Menu aktualisieren
  2935. index = list.getIndexOf(all_list, player_uuid);
  2936. voted_slot = index * 4;
  2937. setItemInVoteInv(voted_slot, zombie_head);
  2938. }
  2939. goto("checkgame");
  2940. @living_pre_hurt
  2941. cancel = true;
  2942. goto("checkgame");
  2943. @player_data_tick
  2944. if(var == "Discussion Time") {
  2945. stacks.set(player, 4, "km:skill33");
  2946. tick_time = vote_time * 20; //s
  2947. status.addTimed(player, 2, tick_time, "Voting Time");
  2948. data.setTimer(player, "Voting Time", tick_time - 20);
  2949. vote_inv = getVoteInv(player);
  2950. inv.open(vote_inv, player, "§cVOTE");
  2951. data.setTimer(player, "sound.vote.end.10", tick_time - 200);
  2952. data.setTimer(player, "sound.vote.end.5", tick_time - 100);
  2953. data.setTimer(player, "sound.vote.end.4", tick_time - 80);
  2954. data.setTimer(player, "sound.vote.end.3", tick_time - 60);
  2955. data.setTimer(player, "sound.vote.end.2", tick_time - 40);
  2956. data.setTimer(player, "sound.vote.end.1", tick_time - 20);
  2957. goto("checkgame");
  2958. }
  2959. if(!meeting) {
  2960. goto("checkgame");
  2961. }
  2962. if(var == "Voting Time") {
  2963. goto("score_evaluation");
  2964. }
  2965. if(var == "sound.vote.end.10") {
  2966. sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
  2967. goto("checkgame");
  2968. }
  2969. if(var == "sound.vote.end.5") {
  2970. sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
  2971. goto("checkgame");
  2972. }
  2973. if(var == "sound.vote.end.4") {
  2974. sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
  2975. goto("checkgame");
  2976. }
  2977. if(var == "sound.vote.end.3") {
  2978. sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
  2979. goto("checkgame");
  2980. }
  2981. if(var == "sound.vote.end.2") {
  2982. sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
  2983. goto("checkgame");
  2984. }
  2985. if(var == "sound.vote.end.1") {
  2986. sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
  2987. goto("checkgame");
  2988. }
  2989. goto("checkgame");
  2990. @function_key
  2991. player_uuid = player.getUuid(player);
  2992. //cams
  2993. if(player.isOnCam(player)) {
  2994. cam_number = map.get(cam_map, player_uuid);
  2995. number_of_cams = set.getSize(cams_locs);
  2996. if(key == 1) {
  2997. cam_number--;
  2998. if(cam_number < 0) {
  2999. cam_number = number_of_cams - 1;
  3000. }
  3001. } elseif(key == 2) {
  3002. cam_number++;
  3003. if(cam_number >= number_of_cams) {
  3004. cam_number = 0;
  3005. }
  3006. } elseif(key == 9) {
  3007. cam.leave(player);
  3008. } else {
  3009. goto("checkgame");
  3010. }
  3011. map.add(cam_map, player_uuid, cam_number);
  3012. goto("checkgame");
  3013. }
  3014. //meeting
  3015. if(meeting) {
  3016. if(key == 5) {
  3017. if(data.getTimer(player, "Discussion Time") < 0) {
  3018. vote_inv = getVoteInv(player);
  3019. inv.open(vote_inv, player, "§cVOTE");
  3020. }
  3021. }
  3022. goto("checkgame");
  3023. }
  3024. //vents
  3025. if(list.contains(vent_list, player_uuid)) {
  3026. if(player.isGhost(player)) {
  3027. goto("checkgame");
  3028. }
  3029. //vent button 1
  3030. if(key == 5) {
  3031. vent_leave(player);
  3032. } elseif(key == 6) {
  3033. vent_loc = map.get(vent_map_4, player_uuid);
  3034. a = map.get($vent_map_3, vent_loc);
  3035. vent_loc_1 = a[1];
  3036. if(vent_loc_1 != null) {
  3037. vent_enter(player, vent_loc_1);
  3038. }
  3039. } elseif(key == 7) {
  3040. //vent button 2
  3041. vent_loc = map.get(vent_map_4, player_uuid);
  3042. a = map.get($vent_map_3, vent_loc);
  3043. vent_loc_2 = a[3];
  3044. if(vent_loc_2 != null) {
  3045. vent_enter(player, vent_loc_2);
  3046. }
  3047. }
  3048. goto("checkgame");
  3049. }
  3050. //report body
  3051. if(key == 1) {
  3052. if(player.isGhost(player)) {
  3053. goto("checkgame");
  3054. }
  3055. ent = player.getTargetEntity(player, 4, "net.minecraft.entity.monster.ZombieEntity");
  3056. if(ent == null) {
  3057. ent = entity.get(entity.getLocation(player), 4, "net.minecraft.entity.monster.ZombieEntity");
  3058. if(ent == null) {
  3059. msg.prefix(player, gamename, "No body detected.");
  3060. goto("checkgame");
  3061. }
  3062. }
  3063. found_player_uuid = map.get(report_map, ent);
  3064. reportBody(player, found_player_uuid);
  3065. goto("checkgame");
  3066. }
  3067. //call meeting
  3068. if(key == 2) {
  3069. if(player.isGhost(player)) {
  3070. goto("checkgame");
  3071. }
  3072. if(loc.distance(entity.getLocation(player), meeting_button_loc) > 3) {
  3073. msg.prefix(player, gamename, "Too far away.");
  3074. goto("checkgame");
  3075. }
  3076. if(amongus.isAlert()) {
  3077. msg.prefix(player, gamename, "No meetings allowed while sabotaged.");
  3078. goto("checkgame");
  3079. }
  3080. callMeeting(player);
  3081. goto("checkgame");
  3082. }
  3083. if(isCrewmate(player)) {
  3084. goto("checkgame");
  3085. }
  3086. if(key == 4) {
  3087. if(player.isGhost(player)) {
  3088. goto("checkgame");
  3089. }
  3090. //kill crewmate
  3091. cooldown = data.getTimer(player, "Kill Cooldown");
  3092. if(cooldown == null || cooldown == -1) {
  3093. //Schaut der Spieler einen anderen Spieler an?
  3094. p = player.getTargetEntity(player, 4, "net.minecraft.entity.player.PlayerEntity");
  3095. if(p != null) {
  3096. //Angeschauten Spieler töten
  3097. if(!player.isOnCam(p) && !player.isGhost(p)) {
  3098. if(isCrewmate(p)) {
  3099. killCrewmate(player, p);
  3100. goto("checkwin");
  3101. }
  3102. msg.prefix(player, gamename, concat("Not a crewmate."));
  3103. goto("checkgame");
  3104. }
  3105. }
  3106. //Schaut der Spieler einen Kamera-Human an?
  3107. human = player.getTargetEntity(player, 4, "me.km.entities.EntityHuman");
  3108. if(human != null) {
  3109. p_uuid = map.get(cam_map_4, human);
  3110. p = player.get(p_uuid);
  3111. //Angeschauten Spieler töten
  3112. cam.leave(p);
  3113. if(isCrewmate(p)) {
  3114. killCrewmate(player, p);
  3115. goto("checkwin");
  3116. }
  3117. msg.prefix(player, gamename, concat("Not a crewmate."));
  3118. goto("checkgame");
  3119. }
  3120. //Spieler nearby suchen und töten
  3121. nearest_player = null;
  3122. lowest_dist = 10;
  3123. player_loc = entity.getLocation(player);
  3124. iter = list.iterator(player_list);
  3125. while(hasNext(iter)) {
  3126. p_uuid = next(iter);
  3127. if(p_uuid == player_uuid) {
  3128. continue;
  3129. }
  3130. p = player.get(p_uuid);
  3131. if(player.isGhost(p) || player.isOnCam(p)) {
  3132. continue;
  3133. }
  3134. if(isImpostor(p)) {
  3135. continue;
  3136. }
  3137. p_loc = entity.getLocation(p);
  3138. dist = loc.distance(player_loc, p_loc);
  3139. if(dist < 4 && dist < lowest_dist) {
  3140. nearest_player = p;
  3141. lowest_dist = dist;
  3142. }
  3143. }
  3144. if(nearest_player != null) {
  3145. if(isCrewmate(nearest_player)) {
  3146. killCrewmate(player, nearest_player);
  3147. goto("checkwin");
  3148. }
  3149. msg.prefix(player, gamename, concat("Not a crewmate."));
  3150. goto("checkgame");
  3151. }
  3152. //Human nearby suchen und töten
  3153. nearest_human = null;
  3154. lowest_dist = 10;
  3155. near_list = entity.near(player, 4);
  3156. iter = list.iterator(near_list);
  3157. while(hasNext(iter)) {
  3158. ent = next(iter);
  3159. if(entity.getType(ent) != "human") {
  3160. continue;
  3161. }
  3162. p_uuid = map.get(cam_map_4, ent);
  3163. p = player.get(p_uuid);
  3164. if(isImpostor(p)) {
  3165. continue;
  3166. }
  3167. ent_loc = entity.getLocation(ent);
  3168. dist = loc.distance(player_loc, ent_loc);
  3169. if(dist < lowest_dist) {
  3170. nearest_human = ent;
  3171. lowest_dist = dist;
  3172. }
  3173. if(nearest_player != null) {
  3174. if(isCrewmate(nearest_player)) {
  3175. killCrewmate(player, nearest_player);
  3176. goto("checkwin");
  3177. }
  3178. msg.prefix(player, gamename, concat("Not a crewmate."));
  3179. goto("checkgame");
  3180. }
  3181. }
  3182. msg.prefix(player, gamename, "No player targeted.");
  3183. goto("checkgame");
  3184. } else {
  3185. msg.prefix(player, gamename, concat("Remaining kill cooldown: ", text.number(math.roundDown(cooldown / 20)), "s"));
  3186. }
  3187. goto("checkgame");
  3188. }
  3189. //enter vent
  3190. if(key == 5) {
  3191. if(player.isGhost(player)) {
  3192. goto("checkgame");
  3193. }
  3194. loc = player.getTarget(player, 5);
  3195. if(list.contains(all_vent_locs, loc)) {
  3196. cooldown = data.getTimer(player, "Kill Cooldown");
  3197. map.add(holded_kill_cooldown, player_uuid, cooldown);
  3198. amongus.removeEquip(player);
  3199. stacks.clearIndex(player, 3);
  3200. stacks.clearIndex(player, 7);
  3201. stacks.clearIndex(player, 8);
  3202. vent_enter(player, loc);
  3203. goto("checkgame");
  3204. }
  3205. player_loc = entity.getLocation(player);
  3206. iter = list.iterator(all_vent_center_locs);
  3207. while(hasNext(iter)) {
  3208. center_loc = next(iter);
  3209. if(loc.distance(player_loc, center_loc) < 2) {
  3210. vent_loc = map.get(vent_map_5, center_loc);
  3211. cooldown = data.getTimer(player, "Kill Cooldown");
  3212. map.add(holded_kill_cooldown, player_uuid, cooldown);
  3213. amongus.removeEquip(player);
  3214. stacks.clearIndex(player, 3);
  3215. stacks.clearIndex(player, 7);
  3216. stacks.clearIndex(player, 8);
  3217. vent_enter(player, vent_loc);
  3218. goto("checkgame");
  3219. }
  3220. }
  3221. msg.prefix(player, gamename, "No vent nearby.");
  3222. goto("checkgame");
  3223. }
  3224. //Keine Sabotagen während bestehender Sabotage möglich
  3225. if(amongus.isAlert()) {
  3226. goto("checkgame");
  3227. }
  3228. cooldown = data.getTimer(player, "Sabotage Cooldown");
  3229. if(cooldown != null && cooldown != -1) {
  3230. msg.prefix(player, gamename, concat("Remaining sabotage cooldown: ", text.number(math.roundDown(cooldown / 20)), "s"));
  3231. goto("checkgame");
  3232. }
  3233. //sabotage light
  3234. if(key == 6) {
  3235. sabotage_light();
  3236. goto("checkgame");
  3237. }
  3238. //sabotage reactor
  3239. if(key == 7) {
  3240. sabotage_reactor();
  3241. goto("checkgame");
  3242. }
  3243. //sabotage oxygen
  3244. if(key == 8) {
  3245. sabotage_oxygen();
  3246. goto("checkgame");
  3247. }
  3248. //sabotage communication
  3249. if(key == 9) {
  3250. sabotage_comms();
  3251. goto("checkgame");
  3252. }
  3253. goto("checkgame");
  3254. @player_toss
  3255. cancel = true;
  3256. player.giveItem(player, item);
  3257. inv.update(player);
  3258. goto("checkgame");
  3259. function setCrewmateIcons(player) {
  3260. stacks.clear(player);
  3261. stacks.set(player, 0, "km:skill32");
  3262. stacks.set(player, 1, "km:skill50");
  3263. }
  3264. function setImpostorIcons(player) {
  3265. stacks.clear(player);
  3266. stacks.set(player, 0, "km:skill32");
  3267. stacks.set(player, 1, "km:skill50");
  3268. stacks.set(player, 3, "km:skill48");
  3269. stacks.set(player, 4, "minecraft:iron_trapdoor");
  3270. stacks.set(player, 5, "km:skill47");
  3271. stacks.set(player, 6, "km:skill49");
  3272. stacks.set(player, 7, "km:skill46");
  3273. stacks.set(player, 8, "km:skill36");
  3274. }
  3275. function setImpostor(player) {
  3276. data.setTimer(player, "Kill Cooldown", $start_kill_cooldown * 20);
  3277. status.addTimed(player, 1, $start_kill_cooldown * 20, "Kill Cooldown");
  3278. player_uuid = player.getUuid(player);
  3279. map.add($roles, player_uuid, "impostor");
  3280. list.add($impostors_list, player_uuid);
  3281. list.add($impostors_list_2, player_uuid);
  3282. msg.prefix(player, $gamename, "You are §cImpostor!");
  3283. setImpostorIcons(player);
  3284. display.add(player, 0, "You are §cImpostor");
  3285. display.add(player, 1, "§cFake Tasks:");
  3286. }
  3287. function setCrewmate(player) {
  3288. map.add($roles, player.getUuid(player), "crewmate");
  3289. msg.prefix(player, $gamename, "You are §bCrewmate.");
  3290. setCrewmateIcons(player);
  3291. display.add(player, 0, "You are §bCrewmate");
  3292. }
  3293. function isImpostor(player_or_uuid) {
  3294. if(isPlayer(player_or_uuid)) {
  3295. player_or_uuid = player.getUuid(player_or_uuid);
  3296. }
  3297. role = map.get($roles, player_or_uuid);
  3298. if(role == "impostor") {
  3299. return true;
  3300. }
  3301. return false;
  3302. }
  3303. function isCrewmate(player_or_uuid) {
  3304. if(isPlayer(player_or_uuid)) {
  3305. player_or_uuid = player.getUuid(player_or_uuid);
  3306. }
  3307. role = map.get($roles, player_or_uuid);
  3308. if(role == "crewmate") {
  3309. return true;
  3310. }
  3311. return false;
  3312. }
  3313. function player.isGhost(player_or_uuid) {
  3314. if(isPlayer(player_or_uuid)) {
  3315. player_or_uuid = player.getUuid(player_or_uuid);
  3316. }
  3317. return list.contains($ghosts, player_or_uuid);
  3318. }
  3319. function tpAllMiddle(reporter) {
  3320. $vote_count_map = map.new(); //Wieviel Spieler haben einen Spieler gevoted
  3321. $vote_count_map_2 = map.new(); //Welcher Spieler hat für wen gevoted
  3322. $meeting = true;
  3323. $reactor_used = false;
  3324. removeDeadBodies();
  3325. amongus.clearAdminTable();
  3326. for(i = 0; i < list.getSize($player_list); i++) {
  3327. p_uuid = list.getIndex($player_list, i);
  3328. p = player.get(p_uuid);
  3329. createVoteInv(p, player.getUuid(reporter));
  3330. if(list.contains($vent_list, p_uuid)) {
  3331. vent_leave(p);
  3332. }
  3333. if(player.isOnCam(p)) {
  3334. cam.leave(p);
  3335. }
  3336. stacks.clear(p);
  3337. if(!player.isGhost(p)) {
  3338. entity.clearEffects(p);
  3339. entity.setName(p, player.getName(p));
  3340. }
  3341. entity.teleport(p, list.getIndex($spawn_locs, i));
  3342. time = $discuss_time * 20 + $vote_time * 20;
  3343. entity.addEffect(p, "jump_boost", time, 128, false);
  3344. player.setSpeed(p, 0);
  3345. inv.close(p);
  3346. status.addTimed(p, 2, $discuss_time * 20, "Discussion Time");
  3347. data.setTimer(p, "Discussion Time", $discuss_time * 20);
  3348. }
  3349. }
  3350. function fix_oxygen() {
  3351. if($oxygen_sabotaged) {
  3352. amongus.setAlert(false);
  3353. $oxygen_sabotaged = false;
  3354. minigame.displayRemoveAll(20);
  3355. setSaboCooldown(30);
  3356. sgoto(40, "scheduled_sabo_close");
  3357. }
  3358. }
  3359. function fix_light() {
  3360. amongus.setAlert(false);
  3361. $lights_sabotaged = false;
  3362. removeSaboParticles($fix_lights_par_loc_1, $fix_lights_par_loc_2);
  3363. iter = list.iterator($player_list);
  3364. while(hasNext(iter)) {
  3365. p_uuid = next(iter);
  3366. p = player.get(p_uuid);
  3367. display.remove(p, 20);
  3368. if(!player.isGhost(p)) {
  3369. if(!player.isOnCam(p)) {
  3370. entity.clearEffects(p);
  3371. }
  3372. }
  3373. }
  3374. setSaboCooldown(30);
  3375. switchLights(true);
  3376. sgoto(40, "scheduled_sabo_close");
  3377. }
  3378. function sabotage_oxygen() {
  3379. amongus.setAlert(true);
  3380. $oxygen_sabotaged = true;
  3381. $oxy_fixed_1 = false;
  3382. $oxy_fixed_2 = false;
  3383. $depletion_time = 30;
  3384. addSaboParticles($fix_o2_par_loc_1, $fix_o2_par_loc_2);
  3385. displaySabotage("§cO2/Admin: Oxygen Depleted in ", 0, 2, $depletion_time);
  3386. $oxy_code = math.random(10000, 99999);
  3387. sgoto(20, "oxygen_depletion");
  3388. iter = list.iterator($player_list);
  3389. while(hasNext(iter)) {
  3390. p_uuid = next(iter);
  3391. p = player.get(p_uuid);
  3392. title.setTime(p, 20, 60, 20);
  3393. title.setSub(p, "Oxygen Depletion");
  3394. title.send(p, "§cSabotage!!!");
  3395. }
  3396. sgoto(20, "crit_sabo_sound_loop");
  3397. }
  3398. @oxygen_depletion
  3399. if(!oxygen_sabotaged) {
  3400. goto("checkgame");
  3401. }
  3402. depletion_time--;
  3403. fixed = 0;
  3404. if(oxy_fixed_1) {
  3405. fixed++;
  3406. }
  3407. if(oxy_fixed_2) {
  3408. fixed++;
  3409. }
  3410. displaySabotage("§cO2/Admin: Oxygen Depleted in ", fixed, 2, depletion_time);
  3411. if(depletion_time == 0) {
  3412. if(freeplay) {
  3413. minigame.speakAll($gamename, "Normally the impostors would have just won because of the critical sabotage. Instead we just shut it off.");
  3414. removeSaboParticles(fix_o2_par_loc_1, fix_o2_par_loc_2);
  3415. fix_oxygen();
  3416. } else {
  3417. winners = "§cImpostors";
  3418. goto("win");
  3419. }
  3420. goto("checkgame");
  3421. }
  3422. sgoto(20, "oxygen_depletion");
  3423. goto("checkgame");
  3424. @crit_sabo_sound_loop
  3425. if(!amongus.isAlert()) {
  3426. goto("checkgame");
  3427. }
  3428. iter = list.iterator(player_list);
  3429. while(hasNext(iter)) {
  3430. p_uuid = next(iter);
  3431. p = player.get(p_uuid);
  3432. sound.spawnForPlayer(p, crit_sabo_sound, master_sound_category);
  3433. }
  3434. sgoto(20, "crit_sabo_sound_loop");
  3435. goto("checkgame");
  3436. function sabotage_reactor() {
  3437. amongus.setAlert(true);
  3438. $reactor_sabotaged = true;
  3439. $hold_reactor_1 = false;
  3440. $hold_reactor_2 = false;
  3441. addSaboParticles($fix_reactor_par_loc_1, $fix_reactor_par_loc_2);
  3442. $meltdown_time = 30;
  3443. displaySabotage("§cReactor: Reactor Meltdown in ", 0, 2, $meltdown_time);
  3444. sgoto(20, "meltdown");
  3445. iter = list.iterator($player_list);
  3446. while(hasNext(iter)) {
  3447. p_uuid = next(iter);
  3448. p = player.get(p_uuid);
  3449. title.setTime(p, 20, 60, 20);
  3450. title.setSub(p, "Reactor Meltdown");
  3451. title.send(p, "§cSabotage!!!");
  3452. }
  3453. sgoto(20, "crit_sabo_sound_loop");
  3454. }
  3455. @meltdown
  3456. if(!reactor_sabotaged) {
  3457. goto("checkgame");
  3458. }
  3459. meltdown_time--;
  3460. holded = 0;
  3461. if(hold_reactor_1) {
  3462. holded++;
  3463. }
  3464. if(hold_reactor_2) {
  3465. holded++;
  3466. }
  3467. displaySabotage("§cReactor: Reactor Meltdown in ", holded, 2, meltdown_time);
  3468. if(meltdown_time == 0) {
  3469. if(freeplay) {
  3470. minigame.speakAll($gamename, "Normally the impostors would have just won because of the critical sabotage. Instead we just shut it off.");
  3471. fix_meltdown();
  3472. } else {
  3473. winners = "§cImpostors";
  3474. goto("win");
  3475. }
  3476. goto("checkgame");
  3477. }
  3478. sgoto(20, "meltdown");
  3479. goto("checkgame");
  3480. function setSaboCooldown(sabotage_cooldown) {
  3481. iter = list.iterator($impostors_list_2);
  3482. while(hasNext(iter)) {
  3483. p_uuid = next(iter);
  3484. p = player.get(p_uuid);
  3485. data.setTimer(p, "Sabotage Cooldown", sabotage_cooldown * 20);
  3486. status.addTimed(p, 2, sabotage_cooldown * 20, "Sabotage Cooldown");
  3487. }
  3488. }
  3489. function fix_meltdown() {
  3490. $reactor_sabotaged = false;
  3491. amongus.setAlert(false);
  3492. removeSaboParticles($fix_reactor_par_loc_1, $fix_reactor_par_loc_2);
  3493. minigame.displayRemoveAll(20);
  3494. setSaboCooldown(30);
  3495. sgoto(40, "scheduled_sabo_close");
  3496. }
  3497. function fix_comms() {
  3498. $comms_sabotaged = false;
  3499. amongus.setAlert(false);
  3500. removeSaboParticles($fix_comms_par_loc, null);
  3501. minigame.displayRemoveAll(20);
  3502. setSaboCooldown(30);
  3503. showTasks();
  3504. sgoto(40, "scheduled_sabo_close");
  3505. }
  3506. function sabotage_comms() {
  3507. amongus.setAlert(true);
  3508. $comms_sabotaged = true;
  3509. addSaboParticles($fix_comms_par_loc, null);
  3510. $comms_fix_freq = math.random(1, 64);
  3511. while($comms_fix_freq == 32) {
  3512. $comms_fix_freq = math.random(1, 64);
  3513. }
  3514. displaySabotage("§cComms Sabotaged", 1, 1, null);
  3515. boss.setName("COMMS DISABLED");
  3516. boss.setPercent(0);
  3517. hideTasks();
  3518. iter = list.iterator($player_list);
  3519. while(hasNext(iter)) {
  3520. p_uuid = next(iter);
  3521. p = player.get(p_uuid);
  3522. boss.send(p, "UPDATE_NAME");
  3523. boss.send(p, "UPDATE_PCT");
  3524. }
  3525. }
  3526. function hideTasks() {
  3527. iter = list.iterator($player_list);
  3528. while(hasNext(iter)) {
  3529. p_uuid = next(iter);
  3530. p = player.get(p_uuid);
  3531. if(isCrewmate(p) || $freeplay) {
  3532. for(i = 2; i < 19; i++) {
  3533. display.remove(p, i);
  3534. }
  3535. }
  3536. }
  3537. }
  3538. function showTasks() {
  3539. boss.setPercent($amount_done_tasks / $amount_all_tasks);
  3540. boss.setName("TOTAL TASKS COMPLETED");
  3541. iter = list.iterator($player_list);
  3542. while(hasNext(iter)) {
  3543. player_uuid = next(iter);
  3544. player = player.get(player_uuid);
  3545. boss.send(player, "UPDATE_PCT");
  3546. boss.send(player, "UPDATE_NAME");
  3547. if(isCrewmate(player) || $freeplay) {
  3548. set = map.get($player_tasks, player_uuid);
  3549. set.iterator(set);
  3550. task_iter = set.iterator(set);
  3551. while(hasNext(task_iter)) {
  3552. task_id = next(task_iter);
  3553. a = map.get($all_tasks, task_id);
  3554. room = a[0];
  3555. description = a[1];
  3556. step = task.getStep(player, task_id);
  3557. number_2 = a[3];
  3558. time = null;
  3559. if(time != null) {
  3560. color = "§e";
  3561. } elseif(step == 0) {
  3562. color = "§r";
  3563. } elseif(step == number_2) {
  3564. color = "§a";
  3565. } else {
  3566. color = "§e";
  3567. }
  3568. if(step == 0) {
  3569. if(task_id == 2) {
  3570. r = map.get($download_map_3, player_uuid);
  3571. room = map.get($download_map_2, list.getIndex($download_list_3, r));
  3572. } elseif(task_id == 12) {
  3573. r = map.get($empty_garb_map_3, player_uuid);
  3574. if(r == 0) {
  3575. room = "Cafeteria";
  3576. } else {
  3577. room = "O2";
  3578. }
  3579. }
  3580. }
  3581. if(task_id == 10) {
  3582. my_list = map.get($wires_map_4, player_uuid);
  3583. if(step == 3) {
  3584. wire_loc = list.getIndex(my_list, 2);
  3585. } else {
  3586. wire_loc = list.getIndex(my_list, step);
  3587. }
  3588. room = map.get($wires_map_3, wire_loc);
  3589. } elseif(task_id == 14) {
  3590. r = map.get($divert_pow_map_3, player_uuid);
  3591. room_2 = map.get($divert_pow_map, r);
  3592. description = concat("Divert power to ", room_2);
  3593. if(step != 0) {
  3594. room = room_2;
  3595. }
  3596. }
  3597. if((number_2 == 1 && time == null) || time == 0) {
  3598. display.add(player, task_id + 1, concat(color, room, ": ", description));
  3599. } elseif(time != null) {
  3600. display.add(player, task_id + 1, concat(color, room, ": ", description, " (", text.number(time), ")"));
  3601. } else {
  3602. display.add(player, task_id + 1, concat(color, room, ": ", description, " (", text.number(step), "/", text.number(number_2), ")"));
  3603. }
  3604. }
  3605. }
  3606. }
  3607. }
  3608. function sabotage_light() {
  3609. amongus.setAlert(true);
  3610. $lights_sabotaged = true;
  3611. addSaboParticles($fix_lights_par_loc_1, $fix_lights_par_loc_2);
  3612. iter = list.iterator($player_list);
  3613. while(hasNext(iter)) {
  3614. p_uuid = next(iter);
  3615. p = player.get(p_uuid);
  3616. if(!player.isOnCam(p)) {
  3617. if(isCrewmate(p)) {
  3618. if(!player.isGhost(p)) {
  3619. entity.addEffect(p, "blindness", 999999, 7, false);
  3620. }
  3621. } else {
  3622. entity.addEffect(p, "night_vision", 999999, 0, false);
  3623. }
  3624. }
  3625. }
  3626. displaySabotage("§cElectrical: Fix Lights", 1, 1, null);
  3627. inv.setItem($lights_inv, 0, read.item("minecraft:red_stained_glass_pane", 1, "§rOff"));
  3628. for(i = 1; i < 5; i++) {
  3629. r = math.random(0, 1);
  3630. if(r == 0) {
  3631. inv.setItem($lights_inv, i, read.item("minecraft:green_stained_glass_pane", 1, "§rOn"));
  3632. } else {
  3633. inv.setItem($lights_inv, i, read.item("minecraft:red_stained_glass_pane", 1, "§rOff"));
  3634. }
  3635. }
  3636. switchLights(false);
  3637. }
  3638. function displaySabotage(text, number_1, number_2, time) {
  3639. if(time == null) {
  3640. if(number_2 == 1) {
  3641. minigame.displayAll(20, text);
  3642. } else {
  3643. minigame.displayAll(20, concat(text, " (", text.number(number_1), "/", text.number(number_2), ")"));
  3644. }
  3645. } else {
  3646. if(number_2 == 1) {
  3647. minigame.displayAll(20, text, text.number(time));
  3648. } else {
  3649. minigame.displayAll(20, concat(text, text.number(time), " (", text.number(number_1), "/", text.number(number_2), ")"));
  3650. }
  3651. }
  3652. }
  3653. function callMeeting(reporter) {
  3654. reporter_uuid = player.getUuid(reporter);
  3655. amount = map.get($meeting_amounts, reporter_uuid);
  3656. if(amount <= 0) {
  3657. msg.prefix(reporter, $gamename, "You have no emergency meetings left.");
  3658. return;
  3659. }
  3660. cooldown = data.getTimer(reporter, "Meeting Cooldown");
  3661. if(cooldown == null || cooldown == -1) {
  3662. tpAllMiddle(reporter);
  3663. reporter_name = player.getName(reporter);
  3664. color_code = amongus.getPlayerColorCode(reporter);
  3665. minigame.titleAll("§cEMERGENY MEETING", concat("called by ", color_code, reporter_name), 20, 60, 20);
  3666. minigame.speakAll($gamename, concat(color_code, reporter_name, " §rcalls an emergency meeting!"));
  3667. new_amount = amount - 1;
  3668. map.add($meeting_amounts, reporter_uuid, new_amount);
  3669. msg.prefix(reporter, $gamename, concat("You have §c", text.number(new_amount), "§r emergeny meetings left."));
  3670. } else {
  3671. msg.prefix(reporter, $gamename, concat("Remaining meeting cooldown: ", text.number(math.roundDown(cooldown / 20)), "s"));
  3672. }
  3673. }
  3674. function reportBody(reporter, found_player_uuid) {
  3675. tpAllMiddle(reporter);
  3676. reporter_name = player.getName(reporter);
  3677. found_player_name = player.getName(found_player_uuid);
  3678. minigame.titleAll("§cREPORT", concat(reporter_name, " found ", found_player_name), 20, 60, 20);
  3679. minigame.speakAll($gamename, concat(amongus.getPlayerColorCode(reporter), reporter_name, " §rfound the body of ", amongus.getPlayerColorCode(found_player_uuid), found_player_name, "."));
  3680. if(amongus.isAlert()) {
  3681. if($lights_sabotaged) {
  3682. switchLights(true);
  3683. }
  3684. if($oxygen_sabotaged) {
  3685. fix_oxygen();
  3686. }
  3687. if($reactor_sabotaged) {
  3688. fix_meltdown();
  3689. }
  3690. }
  3691. }
  3692. function continueGame() {
  3693. $meeting = false;
  3694. iter = list.iterator($player_list);
  3695. while(hasNext(iter)) {
  3696. p_uuid = next(iter);
  3697. p = player.get(p_uuid);
  3698. inv.close(p);
  3699. if(player.isGhost(p)) {
  3700. entity.addEffect(p, "jump_boost", 0, 128, false);
  3701. player.setSpeed(p, $move_speed * 1.5);
  3702. } else {
  3703. entity.setName(p, "");
  3704. entity.clearEffects(p);
  3705. player.setSpeed(p, $move_speed);
  3706. if(isImpostor(p) && !player.isGhost(p)) {
  3707. data.setTimer(p, "Kill Cooldown", $kill_cooldown * 20);
  3708. status.addTimed(p, 1, $kill_cooldown * 20, "Kill Cooldown");
  3709. setImpostorIcons(p);
  3710. } else {
  3711. setCrewmateIcons(p);
  3712. }
  3713. }
  3714. status.remove(p, 2);
  3715. data.setTimer(p, "Voting Time", -1);
  3716. data.setTimer(p, "Meeting Cooldown", $meeting_cooldown * 20);
  3717. status.addTimed(p, 0, $meeting_cooldown * 20, "Meeting Cooldown");
  3718. }
  3719. if($lights_sabotaged) {
  3720. sabotage_light();
  3721. }
  3722. }
  3723. function killCrewmate(killer, crewmate) {
  3724. loc = entity.getLocation(crewmate);
  3725. sound.spawnForPlayer(killer, $kill_sound, $master_sound_category);
  3726. sound.spawnForPlayer(crewmate, $kill_sound, $master_sound_category);
  3727. killer_name = player.getName(killer);
  3728. killer_color_code = amongus.getPlayerColorCode(killer);
  3729. msg.prefix(crewmate, $gamename, concat(killer_color_code, killer_name, "§r killed you."));
  3730. msg.prefix(killer, $gamename, concat("You killed ", amongus.getPlayerColorCode(crewmate), player.getName(crewmate), "§r."));
  3731. //Killer zu Mord-Location teleportieren
  3732. entity.teleport(killer, loc);
  3733. data.setTimer(killer, "Kill Cooldown", $kill_cooldown * 20);
  3734. status.addTimed(killer, 1, $kill_cooldown * 20, "Kill Cooldown");
  3735. //Crewmate zum Geist machen
  3736. entity.clearEffects(crewmate);
  3737. entity.addEffect(crewmate, "invisibility", 999999, 1, false);
  3738. crew_uuid = player.getUuid(crewmate);
  3739. list.add($ghosts, crew_uuid);
  3740. stacks.clear(crewmate);
  3741. amongus.removeEquip(crewmate);
  3742. title.setTime(crewmate, 20, 60, 20);
  3743. title.setSub(crewmate, concat("by ", killer_color_code, killer_name));
  3744. title.send(crewmate, "§cKILLED");
  3745. inv.close(crewmate);
  3746. sabotage.closedInv(crewmate);
  3747. player.setSpeed(crewmate, $move_speed * 1.5);
  3748. //Leiche an Mord-Location platzieren
  3749. ent = entity.spawn("zombie", loc, "{IsBaby:0}");
  3750. list.add($dead_bodies, ent);
  3751. map.add($report_map, ent, crew_uuid);
  3752. living.removeAi(ent);
  3753. entity.setName(ent, "");
  3754. living.setEquip(ent, "hand", $air_item);
  3755. entity.setSilent(ent, true);
  3756. color = amongus.getPlayerColor(crewmate);
  3757. amongus.forceEquip(ent, color);
  3758. }
  3759. function amongus.clearAdminTable() {
  3760. map.clear($admin_table_map);
  3761. map.clear($admin_table_map_2);
  3762. }
  3763. function amongus.removeFromAdminTable(player) {
  3764. player_uuid = player.getUuid(player);
  3765. room_id = map.get($admin_table_map, player_uuid);
  3766. if(room_id == null) {
  3767. return;
  3768. }
  3769. map.remove($admin_table_map, player_uuid);
  3770. map.add($admin_table_map_2, room_id, map.get($admin_table_map_2, room_id) - 1);
  3771. }
  3772. function removeCamBodies() {
  3773. iter = map.iterator($cam_map_3);
  3774. while(hasNext(iter)) {
  3775. element = next(iter);
  3776. entity.remove(map.getValue(element));
  3777. }
  3778. }
  3779. function removeDeadBodies() {
  3780. iter = list.iterator($dead_bodies);
  3781. while(hasNext(iter)) {
  3782. entity.remove(next(iter));
  3783. }
  3784. }
  3785. function registerTask(task_id, room, description, number_1, number_2) {
  3786. a = array.new(4);
  3787. a[0] = room;
  3788. a[1] = description;
  3789. a[2] = number_1;
  3790. a[3] = number_2;
  3791. map.add($all_tasks, task_id, a);
  3792. }
  3793. function giveTask(player, task_id, room, description, number_1, number_2, time) {
  3794. player_uuid = player.getUuid(player);
  3795. if(time != null) {
  3796. color = "§e";
  3797. } elseif(number_1 == 0) {
  3798. color = "§r";
  3799. } elseif(number_1 == number_2) {
  3800. sound.spawnForPlayer(player, $task_sound, $master_sound_category);
  3801. $amount_done_tasks++;
  3802. color = "§a";
  3803. if(!$comms_sabotaged) {
  3804. iter = list.iterator($player_list);
  3805. while(hasNext(iter)) {
  3806. p_uuid = next(iter);
  3807. p = player.get(p_uuid);
  3808. pct = $amount_done_tasks / $amount_all_tasks;
  3809. boss.setPercent(pct);
  3810. boss.send(p, "UPDATE_PCT");
  3811. if(pct == 1) {
  3812. sgoto(2, "crewmate_win");
  3813. }
  3814. }
  3815. }
  3816. } else {
  3817. color = "§e";
  3818. }
  3819. step = task.getStep(player, task_id);
  3820. if(step == 0) {
  3821. if(task_id == 1) {
  3822. addTaskParticle(player, $get_fuel_par_loc);
  3823. } elseif(task_id == 2) {
  3824. r = map.getOrDefault($download_map_3, player_uuid, math.random(0, 4));
  3825. map.add($download_map_3, player_uuid, r);
  3826. addTaskParticle(player, list.getIndex($download_list_4, r));
  3827. room = map.get($download_map_2, list.getIndex($download_list_3, r));
  3828. } elseif(task_id == 3) {
  3829. addTaskParticle(player, $prime_shields_par_loc);
  3830. } elseif(task_id == 4) {
  3831. addTaskParticle(player, $start_reactor_par_loc);
  3832. } elseif(task_id == 5) {
  3833. addTaskParticle(player, $unlock_manifolds_par_loc);
  3834. } elseif(task_id == 6) {
  3835. addTaskParticle(player, $chart_course_par_loc);
  3836. } elseif(task_id == 7) {
  3837. addTaskParticle(player, $steering_par_loc);
  3838. } elseif(task_id == 8 && time == null) {
  3839. addTaskParticle(player, $inspect_par_loc);
  3840. } elseif(task_id == 9) {
  3841. addTaskParticle(player, $calibrate_dist_par_loc);
  3842. } elseif(task_id == 11) {
  3843. addTaskParticle(player, $swipe_card_par_loc);
  3844. } elseif(task_id == 12) {
  3845. r = map.getOrDefault($empty_garb_map_3, player_uuid, math.random(0, 1));
  3846. map.add($empty_garb_map_3, player_uuid, r);
  3847. if(r == 0) {
  3848. addTaskParticle(player, $cafe_garb_par_loc);
  3849. room = "Cafeteria";
  3850. } else {
  3851. addTaskParticle(player, $o2_garb_par_loc);
  3852. room = "O2";
  3853. }
  3854. } elseif(task_id == 13) {
  3855. addTaskParticle(player, $clear_ast_par_loc);
  3856. } elseif(task_id == 15) {
  3857. addTaskParticle(player, $clean_o2_par_loc);
  3858. } elseif(task_id == 16) {
  3859. addTaskParticle(player, $scan_par_loc);
  3860. } elseif(task_id == 17) {
  3861. addTaskParticle(player, $ue_align_par_loc);
  3862. addTaskParticle(player, $le_align_par_loc);
  3863. }
  3864. }
  3865. if(task_id == 10) {
  3866. my_list = map.getOrDefault($wires_map_4, player_uuid, list.new());
  3867. if(step == 0) {
  3868. //Electrical > Storage > Admin > Navigation > Cafeteria > Security
  3869. //1.Wire
  3870. index_1 = math.random(0, 3);
  3871. wire_loc_1 = list.getIndex($wires_list_2, index_1);
  3872. list.add(my_list, wire_loc_1);
  3873. //2.Wire
  3874. index_2 = math.random(1 + index_1, 4);
  3875. wire_loc_2 = list.getIndex($wires_list_2, index_2);
  3876. while(list.contains(my_list, wire_loc_2)) {
  3877. index_2 = math.random(1 + index_1, 4);
  3878. wire_loc_2 = list.getIndex($wires_list_2, index_2);
  3879. }
  3880. list.add(my_list, wire_loc_2);
  3881. //3.Wire
  3882. index_3 = math.random(1 + index_2, 5);
  3883. wire_loc_3 = list.getIndex($wires_list_2, index_3);
  3884. while(list.contains(my_list, wire_loc_3)) {
  3885. index_3 = math.random(1 + index_2, 5);
  3886. wire_loc_3 = list.getIndex($wires_list_2, index_3);
  3887. }
  3888. list.add(my_list, wire_loc_3);
  3889. map.add($wires_map_4, player_uuid, my_list);
  3890. }
  3891. if(step < 3) {
  3892. wire_loc = list.getIndex(my_list, step);
  3893. room = map.get($wires_map_3, wire_loc);
  3894. addTaskParticle(player, map.get($wires_map_5, wire_loc));
  3895. if(step > 0) {
  3896. old_wire_loc = list.getIndex(my_list, step - 1);
  3897. removeTaskParticle(player, map.get($wires_map_5, old_wire_loc));
  3898. }
  3899. } else {
  3900. wire_loc = list.getIndex(my_list, 2);
  3901. removeTaskParticle(player, map.get($wires_map_5, wire_loc));
  3902. }
  3903. } elseif(task_id == 14) {
  3904. r = map.getOrDefault($divert_pow_map_3, player_uuid, math.random(22, 29));
  3905. map.add($divert_pow_map_3, player_uuid, r);
  3906. room_2 = map.get($divert_pow_map, r);
  3907. description = concat("Divert power to ", room_2);
  3908. if(step == 0) {
  3909. addTaskParticle(player, $elec_power_par_loc);
  3910. } else {
  3911. room = room_2;
  3912. }
  3913. }
  3914. if(!$comms_sabotaged) {
  3915. if((number_2 == 1 && time == null) || time == 0) {
  3916. display.add(player, task_id + 1, concat(color, room, " §8| ", color, description));
  3917. } elseif(time != null) {
  3918. display.add(player, task_id + 1, concat(color, room, " §8| ", color, description, " (", text.number(time), ")"));
  3919. } else {
  3920. display.add(player, task_id + 1, concat(color, room, " §8| ", color, description, " (", text.number(number_1), "/", text.number(number_2), ")"));
  3921. }
  3922. }
  3923. set = map.get($player_tasks, player_uuid);
  3924. if(set == null) {
  3925. set = set.new();
  3926. }
  3927. set.add(set, task_id);
  3928. map.add($player_tasks, player_uuid, set);
  3929. }
  3930. function sgoto_auto_close_inv(player_uuid) {
  3931. list.add($auto_close_list, player_uuid);
  3932. sgoto(40, "auto_close_inv");
  3933. }
  3934. @auto_close_inv
  3935. p_uuid = list.getIndex(auto_close_list, 0);
  3936. list.removeIndex(auto_close_list, 0);
  3937. if(list.contains(auto_close_list_2, p_uuid)) {
  3938. list.remove(auto_close_list_2, p_uuid);
  3939. } else {
  3940. inv.close(player.get(p_uuid));
  3941. }
  3942. goto("checkgame");
  3943. function hasTask(player, task_id) {
  3944. player_uuid = player.getUuid(player);
  3945. set = map.getOrDefault($player_tasks, player_uuid, set.new());
  3946. return set.contains(set, task_id);
  3947. }
  3948. function addAstDirection(id, x, y) {
  3949. a = array.new(2);
  3950. a[0] = x;
  3951. a[1] = y;
  3952. $ast_directions[id] = a;
  3953. }
  3954. function addAstStartPos(slot, dir_id_1, dir_id_2, dir_id_3) {
  3955. list.add($ast_start_pos, slot);
  3956. my_list = list.new();
  3957. list.add(my_list, dir_id_1);
  3958. list.add(my_list, dir_id_2);
  3959. list.add(my_list, dir_id_3);
  3960. map.add($ast_start_pos_dirs, slot, my_list);
  3961. }
  3962. function getAstDirection(slot) {
  3963. my_list = map.get($ast_start_pos_dirs, slot);
  3964. dir_id = list.getIndex(my_list, math.random(0, 2));
  3965. a = $ast_directions[dir_id];
  3966. return a;
  3967. }
  3968. @loop
  3969. iter = list.iterator(player_list);
  3970. while(hasNext(iter)) {
  3971. p_uuid = next(iter);
  3972. p = player.get(p_uuid);
  3973. player.setHunger(p, 4);
  3974. player.setSaturation(p, 0);
  3975. color = amongus.getPlayerColor(p);
  3976. if(player.isGhost(p)) {
  3977. amongus.removeEquip(p);
  3978. } else {
  3979. if(!list.contains(vent_list, p_uuid)) {
  3980. if(!player.isOnCam(p)) {
  3981. amongus.equip(p, color);
  3982. }
  3983. }
  3984. }
  3985. }
  3986. sgoto(20, "loop");
  3987. goto("checkgame");
  3988. @imp_par_loop
  3989. iter = list.iterator(impostors_list_2);
  3990. while(hasNext(iter)) {
  3991. p_uuid_1 = next(iter);
  3992. p_1 = player.get(p_uuid_1);
  3993. iter_2 = list.iterator(impostors_list_2);
  3994. while(hasNext(iter_2)) {
  3995. p_uuid_2 = next(iter_2);
  3996. p_2 = player.get(p_uuid_2);
  3997. if(!player.isGhost(p_2)) {
  3998. p_2_loc = entity.getLocation(p_2);
  3999. loc.add(p_2_loc, 0, 2.3, 0);
  4000. particle.spawnPlayer(p_2_loc, imp_par, p_1);
  4001. }
  4002. }
  4003. }
  4004. sgoto(5, "imp_par_loop");
  4005. goto("checkgame");
  4006. @download_data_2
  4007. player_uuid = player.getUuid(player);
  4008. c = 0;
  4009. inv.setItem(inv, c++, lime_glass);
  4010. map.add(download_counter, player_uuid, c);
  4011. inv.update(player);
  4012. list.add(download_list, player_uuid);
  4013. map.add(download_map, player_uuid, inv);
  4014. sgoto(20, "download_data");
  4015. goto("checkgame");
  4016. @download_data
  4017. task_id = 2;
  4018. player_uuid = list.getIndex(download_list, 0);
  4019. inv = map.get(download_map, player_uuid);
  4020. player = player.get(player_uuid);
  4021. list.removeIndex(download_list, 0);
  4022. c = map.get(download_counter, player_uuid);
  4023. if(list.contains(download_list_2, player_uuid)) {
  4024. goto("checkgame");
  4025. }
  4026. inv.setItem(inv, c++, lime_glass);
  4027. map.add(download_counter, player_uuid, c);
  4028. inv.update(player);
  4029. if(c < 9) {
  4030. list.add(download_list, player_uuid);
  4031. map.add(download_map, player_uuid, inv);
  4032. sgoto(20, "download_data");
  4033. } else {
  4034. inv.setItem(inv, 11, read.item("km:check_green", 1, "§rTask completed"));
  4035. map.remove(download_counter, player_uuid);
  4036. step = task.getStep(player, task_id);
  4037. step = task.stepIncrease(player, task_id);
  4038. if(step == 1) {
  4039. r = map.get(download_map_3, player_uuid);
  4040. removeTaskParticle(player, list.getIndex(download_list_4, r));
  4041. addTaskParticle(player, admin_upload_par_loc);
  4042. } else {
  4043. removeTaskParticle(player, admin_upload_par_loc);
  4044. }
  4045. giveTask(player, task_id, "Admin", "Upload Data", step, 2, null);
  4046. sgoto_auto_close_inv(player_uuid);
  4047. }
  4048. goto("checkgame");
  4049. @draw_pattern_1
  4050. player_uuid = list.getIndex(reactor_draw_list_1, 0);
  4051. list.removeIndex(reactor_draw_list_1, 0);
  4052. if(list.contains(reactor_block_list, player_uuid)) {
  4053. goto("checkgame");
  4054. }
  4055. reactor_array = reactor.get(player_uuid);
  4056. inv = reactor.getInv(reactor_array);
  4057. stage = reactor.getStage(reactor_array);
  4058. for(i = 0; i <= stage; i++) {
  4059. inv.setItem(inv, i, green_glass);
  4060. }
  4061. reactor.setRightSide(inv, black_glass);
  4062. player = player.get(player_uuid);
  4063. inv.update(player);
  4064. list.add(reactor_draw_list_2, player_uuid);
  4065. goto("draw_pattern_2");
  4066. @draw_pattern_2
  4067. player_uuid = list.getIndex(reactor_draw_list_2, 0);
  4068. list.removeIndex(reactor_draw_list_2, 0);
  4069. if(list.contains(reactor_block_list, player_uuid)) {
  4070. goto("checkgame");
  4071. }
  4072. reactor_array = reactor.get(player_uuid);
  4073. inv = reactor.getInv(reactor_array);
  4074. stage = reactor.getStage(reactor_array);
  4075. counter = reactor.getCounter(reactor_array);
  4076. pattern = reactor.getPattern(reactor_array);
  4077. player = player.get(player_uuid);
  4078. if(counter > stage) {
  4079. reactor.setCounter(reactor_array, 0);
  4080. reactor.setPhase(reactor_array, "click");
  4081. reactor.save(reactor_array, player);
  4082. reactor.setRightSide(inv, gray_glass);
  4083. goto("checkgame");
  4084. }
  4085. inv.setItem(inv, pattern[counter], blue_glass);
  4086. inv.update(player);
  4087. counter++;
  4088. reactor.setCounter(reactor_array, counter);
  4089. reactor.save(reactor_array, player);
  4090. if(counter < 6) {
  4091. list.add(reactor_draw_list_2, player_uuid);
  4092. list.add(reset_reactor_draw_list, player_uuid);
  4093. sgoto(10, "reset_reactor_draw");
  4094. sgoto(12, "draw_pattern_2");
  4095. }
  4096. goto("checkgame");
  4097. @reset_reactor_draw
  4098. player_uuid = list.getIndex(reset_reactor_draw_list, 0);
  4099. list.removeIndex(reset_reactor_draw_list, 0);
  4100. reactor_array = reactor.get(player_uuid);
  4101. inv = reactor.getInv(reactor_array);
  4102. counter = reactor.getCounter(reactor_array) - 1;
  4103. pattern = reactor.getPattern(reactor_array);
  4104. if(counter >= 0) {
  4105. inv.setItem(inv, pattern[counter], black_glass);
  4106. player = player.get(player_uuid);
  4107. inv.update(player);
  4108. }
  4109. goto("checkgame");
  4110. @reset_reactor_click
  4111. player_uuid = list.getIndex(reset_reactor_click_list, 0);
  4112. slot = list.getIndex(reset_reactor_click_list_2, 0);
  4113. list.removeIndex(reset_reactor_click_list, 0);
  4114. list.removeIndex(reset_reactor_click_list_2, 0);
  4115. if(list.contains(reactor_block_list, player_uuid)) {
  4116. goto("checkgame");
  4117. }
  4118. reactor_array = reactor.get(player_uuid);
  4119. inv = reactor.getInv(reactor_array);
  4120. inv.setItem(inv, slot, gray_glass);
  4121. player = player.get(player_uuid);
  4122. inv.update(player);
  4123. goto("checkgame");
  4124. @unblock_start_reactor
  4125. list.removeIndex(reactor_block_list, 0);
  4126. goto("checkgame");
  4127. @unblock_submit_scan
  4128. list.removeIndex(submit_scan_list_2, 0);
  4129. goto("checkgame");
  4130. @unblock_calib_dist
  4131. list.removeIndex(calibrate_dist_list_2, 0);
  4132. goto("checkgame");
  4133. @unblock_empty_garb
  4134. list.removeIndex(empty_garb_list_2, 0);
  4135. goto("checkgame");
  4136. @unblock_download
  4137. list.removeIndex(download_list_2, 0);
  4138. goto("checkgame");
  4139. @unblock_clear_ast
  4140. list.removeIndex(clear_ast_list_2, 0);
  4141. goto("checkgame");
  4142. @new_reactor
  4143. player_uuid = list.getIndex(reactor_false_click_list, 0);
  4144. list.removeIndex(reactor_false_click_list, 0);
  4145. reactor_array = reactor.get(player_uuid);
  4146. inv = reactor.getInv(reactor_array);
  4147. reactor.setHeader(inv, air_item);
  4148. reactor.setLeftSide(inv, black_glass);
  4149. reactor.setRightSide(inv, black_glass);
  4150. player = player.get(player_uuid);
  4151. inv.update(player);
  4152. reactor_array = array.new(5);
  4153. reactor.setInv(reactor_array, inv);
  4154. reactor.setStage(reactor_array, 0);
  4155. reactor.setCounter(reactor_array, 0);
  4156. reactor.setPattern(reactor_array);
  4157. reactor.save(reactor_array, player);
  4158. list.add(reactor_draw_list_1, player_uuid);
  4159. sgoto(20, "draw_pattern_1");
  4160. goto("checkgame");
  4161. @false_reactor_click
  4162. reactor.setHeader(inv, red_glass);
  4163. reactor.setRightSide(inv, red_glass);
  4164. inv.update(player);
  4165. list.add(reactor_block_list, player_uuid);
  4166. list.add(reactor_false_click_list, player_uuid);
  4167. sgoto(20, "unblock_start_reactor");
  4168. sgoto(40, "new_reactor");
  4169. goto("checkgame");
  4170. @false_manifolds_click
  4171. for(i = 0; i < 10; i++) {
  4172. inv.setItem(inv, i, read.item("minecraft:red_stained_glass_pane", item.getAmount(inv.getItem(inv, i))));
  4173. }
  4174. inv.update(player);
  4175. list.add(manifolds_list, inv);
  4176. list.add(manifolds_list_2, player);
  4177. sgoto(30, "redo_manifolds");
  4178. goto("checkgame");
  4179. @redo_manifolds
  4180. inv = list.getIndex(manifolds_list, 0);
  4181. player_uuid = player.getUuid(list.getIndex(manifolds_list_2, 0));
  4182. list.removeIndex(manifolds_list, 0);
  4183. list.removeIndex(manifolds_list_2, 0);
  4184. map.remove(manifolds_counter, player_uuid);
  4185. for(i = 0; i < 10; i++) {
  4186. inv.setItem(inv, i, read.item("minecraft:blue_stained_glass_pane", item.getAmount(inv.getItem(inv, i))));
  4187. }
  4188. goto("checkgame");
  4189. @countdown_sample
  4190. player_uuid = list.getIndex(sample_list, 0);
  4191. player = player.get(player_uuid);
  4192. time = list.getIndex(sample_list_2, 0) - 1;
  4193. list.removeIndex(sample_list, 0);
  4194. list.removeIndex(sample_list_2, 0);
  4195. inv = map.get(sample_map, player_uuid);
  4196. if(time == 58) {
  4197. inv.setItem(inv, 0, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4198. inv.setItem(inv, 5, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4199. inv.setItem(inv, 10, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4200. } elseif(time == 57) {
  4201. inv.setItem(inv, 1, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4202. inv.setItem(inv, 6, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4203. inv.setItem(inv, 11, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4204. } elseif(time == 56) {
  4205. inv.setItem(inv, 2, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4206. inv.setItem(inv, 7, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4207. inv.setItem(inv, 12, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4208. } elseif(time == 55) {
  4209. inv.setItem(inv, 3, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4210. inv.setItem(inv, 8, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4211. inv.setItem(inv, 13, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4212. } elseif(time == 54) {
  4213. inv.setItem(inv, 4, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4214. inv.setItem(inv, 9, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4215. inv.setItem(inv, 14, read.item("minecraft:blue_stained_glass_pane", 1, "§rSample"));
  4216. }
  4217. if(time == 0) {
  4218. inv.setItem(inv, 20, read.item("minecraft:gray_stained_glass_pane", 1, "§rSelect anomaly"));
  4219. r = math.random(0, 4);
  4220. inv.setItem(inv, r, read.item("minecraft:red_stained_glass_pane", 1, "§rSample"));
  4221. inv.setItem(inv, r + 5, read.item("minecraft:red_stained_glass_pane", 1, "§rSample"));
  4222. inv.setItem(inv, r + 10, read.item("minecraft:red_stained_glass_pane", 1, "§rSample"));
  4223. for(i = 15; i < 20; i++) {
  4224. inv.setItem(inv, i, read.item("minecraft:green_stained_glass_pane", 1, "§rSelect sample"));
  4225. }
  4226. giveTask(player, 8, "MedBay", "Inspect Sample", 0, 1, 0);
  4227. goto("checkgame");
  4228. }
  4229. giveTask(player, 8, "MedBay", "Inspect Sample", 0, 1, time);
  4230. inv.setItem(inv, 20, read.item("minecraft:gray_stained_glass_pane", time, "§rGo grab a coffee"));
  4231. list.add(sample_list, player_uuid);
  4232. list.add(sample_list_2, time);
  4233. sgoto(20, "countdown_sample");
  4234. goto("checkgame");
  4235. @calibrate_dist
  4236. p_uuid = list.getIndex(calibrate_dist_list, 0);
  4237. list.removeIndex(calibrate_dist_list, 0);
  4238. if(list.contains(calibrate_dist_list_2, p_uuid)) {
  4239. goto("checkgame");
  4240. }
  4241. a = map.get(calibrate_dist_map, p_uuid);
  4242. inv = a[1];
  4243. index = a[3];
  4244. stage = a[4];
  4245. inv.setItem(inv, calibrate_dist_array[index++], air_item);
  4246. if(index == 12) {
  4247. index = 0;
  4248. }
  4249. a[3] = index;
  4250. if(stage == 0) {
  4251. inv.setItem(inv, calibrate_dist_array[index], yellow_glass);
  4252. } elseif(stage == 1) {
  4253. inv.setItem(inv, calibrate_dist_array[index], blue_glass);
  4254. } elseif(stage == 2) {
  4255. inv.setItem(inv, calibrate_dist_array[index], cyan_glass);
  4256. }
  4257. if(stage < 3) {
  4258. map.add(calibrate_dist_map, p_uuid, a);
  4259. list.add(calibrate_dist_list, p_uuid);
  4260. sgoto(7, "calibrate_dist");
  4261. }
  4262. goto("checkgame");
  4263. @empty_garb
  4264. p_uuid = list.getIndex(empty_garb_list, 0);
  4265. list.removeIndex(empty_garb_list, 0);
  4266. c = map.get(empty_garb_map, p_uuid);
  4267. inv = map.get(empty_garb_map_2, p_uuid);
  4268. if(list.contains(empty_garb_list_2, p_uuid)) {
  4269. goto("checkgame");
  4270. }
  4271. for(slot = 42; slot > 6; slot--) {
  4272. if(slot == 35) {
  4273. continue;
  4274. } elseif(slot > 35) {
  4275. inv.setItem(inv, slot, inv.getItem(inv, slot - 8));
  4276. } else {
  4277. inv.setItem(inv, slot, inv.getItem(inv, slot - 7));
  4278. }
  4279. }
  4280. p = player.get(p_uuid);
  4281. if(++c == 5) {
  4282. step = task.stepIncrease(p, 12);
  4283. if(step == 1) {
  4284. addTaskParticle(p, stor_garb_par_loc);
  4285. r = map.get(empty_garb_map_3, player_uuid);
  4286. if(r == 0) {
  4287. removeTaskParticle(p, cafe_garb_par_loc);
  4288. } else {
  4289. removeTaskParticle(p, o2_garb_par_loc);
  4290. }
  4291. } else {
  4292. removeTaskParticle(p, stor_garb_par_loc);
  4293. }
  4294. inv.setItem(inv, 35, read.item("km:check_green", 1, "§rTask completed"));
  4295. map.remove(empty_garb_map, p_uuid);
  4296. giveTask(p, 12, "Storage", "Empty Garbage", step, 2, null);
  4297. sgoto_auto_close_inv(p_uuid);
  4298. } else {
  4299. map.add(empty_garb_map, p_uuid, c);
  4300. map.add(empty_garb_map_2, p_uuid, inv);
  4301. list.add(empty_garb_list, p_uuid);
  4302. sgoto(20, "empty_garb");
  4303. }
  4304. inv.update(p);
  4305. goto("checkgame");
  4306. @clear_ast
  4307. p_uuid = list.getIndex(clear_ast_list, 0);
  4308. list.removeIndex(clear_ast_list, 0);
  4309. if(list.contains(clear_ast_list_2, p_uuid)) {
  4310. goto("checkgame");
  4311. }
  4312. inv = map.get(clear_ast_map_3, p_uuid);
  4313. my_list = map.get(clear_ast_map, p_uuid);
  4314. iter = list.iterator(my_list);
  4315. while(hasNext(iter)) {
  4316. a = next(iter);
  4317. slot = a[1];
  4318. x_dir = a[2];
  4319. y_dir = a[3];
  4320. reached_end = a[4];
  4321. speed = a[5];
  4322. speed_counter = a[6];
  4323. if(speed_counter == speed) {
  4324. inv.setItem(inv, slot, air_item);
  4325. if(reached_end) {
  4326. remove(iter);
  4327. continue;
  4328. }
  4329. slot += x_dir;
  4330. slot += (y_dir * 9);
  4331. a[1] = slot;
  4332. if(list.contains(ast_start_pos, slot)) {
  4333. a[4] = true;
  4334. }
  4335. inv.setItem(inv, slot, read.item("minecraft:bedrock", 1, "§rAsteroid"));
  4336. a[6] = 0;
  4337. } else {
  4338. a[6] = speed_counter + 1;
  4339. }
  4340. }
  4341. c = map.get(clear_ast_map_2, p_uuid) + 1;
  4342. if(c == 3 && !list.contains(clear_ast_list_3, p_uuid)) {
  4343. c = 0;
  4344. //new asteroid
  4345. a = array.new(7);
  4346. slot = list.getIndex(ast_start_pos, math.random(0, 25));
  4347. a[1] = slot;
  4348. inv.setItem(inv, slot, read.item("minecraft:bedrock", 1, "§rAsteroid"));
  4349. b = getAstDirection(slot);
  4350. a[2] = b[0]; //x_dir
  4351. a[3] = b[1]; //y_dir
  4352. a[4] = false; //reached end
  4353. a[5] = math.random(1, 2); //speed
  4354. a[6] = 0; //speed counter
  4355. list.add(my_list, a);
  4356. }
  4357. inv.update(player.get(p_uuid));
  4358. map.add(clear_ast_map, p_uuid, my_list);
  4359. map.add(clear_ast_map_2, p_uuid, c);
  4360. list.add(clear_ast_list, p_uuid);
  4361. sgoto(5, "clear_ast");
  4362. goto("checkgame");
  4363. function assignSeat(player) {
  4364. for(i = 0; i < 10; i++) {
  4365. if($seat_array[i] == null) {
  4366. entity.teleport(player, $lobbyspawnloc);
  4367. player_uuid = player.getUuid(player);
  4368. $seat_array[i] = player_uuid;
  4369. map.add($seat_map_index, player_uuid, i);
  4370. list.add($seat_list_join, player_uuid);
  4371. sgoto(10, "lobby_join_seat");
  4372. return;
  4373. }
  4374. }
  4375. }
  4376. @lobby_join_seat
  4377. player_uuid = list.getIndex(seat_list_join, 0);
  4378. list.removeIndex(seat_list_join, 0);
  4379. i = map.get(seat_map_index, player_uuid);
  4380. loc = list.getIndex(seat_locs, i);
  4381. ent = entity.spawn("km:nobody", loc.mod(loc, 0.5, 0, 0.5), "{NoGravity:true}");
  4382. map.add(seat_map, player_uuid, ent);
  4383. player = player.get(player_uuid);
  4384. if(player != null) {
  4385. entity.mount(player, ent);
  4386. list.add(seat_list_leave, player_uuid);
  4387. sgoto(60, "lobby_leave_seat");
  4388. }
  4389. goto("simplelobby");
  4390. @lobby_leave_seat
  4391. player_uuid = list.getIndex(seat_list_leave, 0);
  4392. list.removeIndex(seat_list_leave, 0);
  4393. leaveSeat(player_uuid);
  4394. goto("simplelobby");
  4395. function leaveSeat(player_or_uuid) {
  4396. if(isPlayer(player_or_uuid)) {
  4397. player_uuid = player.getUuid(player_or_uuid);
  4398. } else {
  4399. player_uuid = player_or_uuid;
  4400. }
  4401. for(i = 0; i < 10; i++) {
  4402. if($seat_array[i] == player_uuid) {
  4403. $seat_array[i] = null;
  4404. ent = map.get($seat_map, player_uuid);
  4405. if(ent != null) {
  4406. entity.remove(ent);
  4407. map.remove($seat_map, player_uuid);
  4408. }
  4409. }
  4410. }
  4411. }
  4412. @submit_scan
  4413. p_uuid = list.getIndex(submit_scan_list, 0);
  4414. list.removeIndex(submit_scan_list, 0);
  4415. if(list.contains(submit_scan_list_2, p_uuid)) {
  4416. goto("checkgame");
  4417. }
  4418. c = map.get(submit_scan_map, p_uuid);
  4419. inv = map.get(submit_scan_map_2, p_uuid);
  4420. p = player.get(p_uuid);
  4421. if(c == 0) {
  4422. inv.setItem(inv, 1, lime_glass);
  4423. inv.setItem(inv, 2, lime_glass);
  4424. inv.setItem(inv, 3, lime_glass);
  4425. inv.setItem(inv, 4, lime_glass);
  4426. inv.setItem(inv, 5, lime_glass);
  4427. } elseif(c == 1) {
  4428. inv.setItem(inv, 0, read.item("minecraft:black_stained_glass_pane", 1, concat("§rID: ", text.toUpperCase(amongus.getPlayerColor(p), "P0"))));
  4429. inv.setItem(inv, 1, air_item);
  4430. inv.setItem(inv, 2, air_item);
  4431. inv.setItem(inv, 3, air_item);
  4432. inv.setItem(inv, 4, air_item);
  4433. inv.setItem(inv, 5, air_item);
  4434. inv.setItem(inv, 7, lime_glass);
  4435. inv.setItem(inv, 8, lime_glass);
  4436. inv.setItem(inv, 10, lime_glass);
  4437. inv.setItem(inv, 11, lime_glass);
  4438. inv.setItem(inv, 31, green_glass);
  4439. } elseif(c == 2) {
  4440. inv.setItem(inv, 7, air_item);
  4441. inv.setItem(inv, 8, air_item);
  4442. inv.setItem(inv, 10, air_item);
  4443. inv.setItem(inv, 11, air_item);
  4444. inv.setItem(inv, 13, lime_glass);
  4445. inv.setItem(inv, 14, lime_glass);
  4446. inv.setItem(inv, 16, lime_glass);
  4447. inv.setItem(inv, 17, lime_glass);
  4448. } elseif(c == 3) {
  4449. inv.setItem(inv, 6, read.item("minecraft:black_stained_glass_pane", 1, "§rHT: 3' 6''"));
  4450. inv.setItem(inv, 13, air_item);
  4451. inv.setItem(inv, 14, air_item);
  4452. inv.setItem(inv, 16, air_item);
  4453. inv.setItem(inv, 17, air_item);
  4454. inv.setItem(inv, 19, lime_glass);
  4455. inv.setItem(inv, 20, lime_glass);
  4456. inv.setItem(inv, 22, lime_glass);
  4457. inv.setItem(inv, 23, lime_glass);
  4458. inv.setItem(inv, 32, green_glass);
  4459. } elseif(c == 4) {
  4460. inv.setItem(inv, 19, air_item);
  4461. inv.setItem(inv, 20, air_item);
  4462. inv.setItem(inv, 22, air_item);
  4463. inv.setItem(inv, 23, air_item);
  4464. inv.setItem(inv, 25, lime_glass);
  4465. inv.setItem(inv, 26, lime_glass);
  4466. inv.setItem(inv, 28, lime_glass);
  4467. inv.setItem(inv, 29, lime_glass);
  4468. } elseif(c == 5) {
  4469. inv.setItem(inv, 12, read.item("minecraft:black_stained_glass_pane", 1, "§rWT: 92 lbs"));
  4470. inv.setItem(inv, 25, air_item);
  4471. inv.setItem(inv, 26, air_item);
  4472. inv.setItem(inv, 28, air_item);
  4473. inv.setItem(inv, 29, air_item);
  4474. inv.setItem(inv, 19, lime_glass);
  4475. inv.setItem(inv, 20, lime_glass);
  4476. inv.setItem(inv, 22, lime_glass);
  4477. inv.setItem(inv, 23, lime_glass);
  4478. inv.setItem(inv, 33, green_glass);
  4479. } elseif(c == 6) {
  4480. inv.setItem(inv, 19, air_item);
  4481. inv.setItem(inv, 20, air_item);
  4482. inv.setItem(inv, 22, air_item);
  4483. inv.setItem(inv, 23, air_item);
  4484. inv.setItem(inv, 13, lime_glass);
  4485. inv.setItem(inv, 14, lime_glass);
  4486. inv.setItem(inv, 16, lime_glass);
  4487. inv.setItem(inv, 17, lime_glass);
  4488. } elseif(c == 7) {
  4489. inv.setItem(inv, 18, read.item("minecraft:black_stained_glass_pane", 1, concat("§rC: ", text.toUpperCase(amongus.getPlayerColor(p)))));
  4490. inv.setItem(inv, 13, air_item);
  4491. inv.setItem(inv, 14, air_item);
  4492. inv.setItem(inv, 16, air_item);
  4493. inv.setItem(inv, 17, air_item);
  4494. inv.setItem(inv, 7, lime_glass);
  4495. inv.setItem(inv, 8, lime_glass);
  4496. inv.setItem(inv, 10, lime_glass);
  4497. inv.setItem(inv, 11, lime_glass);
  4498. inv.setItem(inv, 34, green_glass);
  4499. } elseif(c == 8) {
  4500. inv.setItem(inv, 7, air_item);
  4501. inv.setItem(inv, 8, air_item);
  4502. inv.setItem(inv, 10, air_item);
  4503. inv.setItem(inv, 11, air_item);
  4504. inv.setItem(inv, 1, lime_glass);
  4505. inv.setItem(inv, 2, lime_glass);
  4506. inv.setItem(inv, 3, lime_glass);
  4507. inv.setItem(inv, 4, lime_glass);
  4508. inv.setItem(inv, 5, lime_glass);
  4509. } elseif(c == 9) {
  4510. inv.setItem(inv, 24, read.item("minecraft:black_stained_glass_pane", 1, "§rBT: O-"));
  4511. inv.setItem(inv, 1, air_item);
  4512. inv.setItem(inv, 2, air_item);
  4513. inv.setItem(inv, 3, air_item);
  4514. inv.setItem(inv, 4, air_item);
  4515. inv.setItem(inv, 5, air_item);
  4516. inv.setItem(inv, 35, green_glass);
  4517. } else {
  4518. inv.setItem(inv, 30, read.item("km:check_green", 1, "§rTask completed"));
  4519. removeTaskParticle(p, scan_par_loc);
  4520. step = task.stepIncrease(p, 16);
  4521. giveTask(p, 16, "MedBay", "Submit Scan", 1, 1, null);
  4522. sgoto_auto_close_inv(p_uuid);
  4523. goto("checkgame");
  4524. }
  4525. inv.update(p);
  4526. map.add(submit_scan_map, p_uuid, c + 1);
  4527. list.add(submit_scan_list, p_uuid);
  4528. sgoto(20, "submit_scan");
  4529. goto("checkgame");
  4530. function set_engine(player, inv, direction) {
  4531. player_uuid = player.getUuid(player);
  4532. pos = map.get($align_engine_map, player_uuid);
  4533. if(direction == "up") {
  4534. new_pos = pos + 1;
  4535. } elseif(direction == "down") {
  4536. new_pos = pos - 1;
  4537. } else {
  4538. new_pos = pos;
  4539. }
  4540. if(new_pos < 0 || new_pos > 10) {
  4541. return false;
  4542. }
  4543. map.add($align_engine_map, player_uuid, new_pos);
  4544. //remove old pattern
  4545. temp_list = $align_engine_array[pos];
  4546. iter = list.iterator(temp_list);
  4547. while(hasNext(iter)) {
  4548. inv.setItem(inv, next(iter), $air_item);
  4549. }
  4550. //set new pattern
  4551. temp_list = $align_engine_array[new_pos];
  4552. iter = list.iterator(temp_list);
  4553. while(hasNext(iter)) {
  4554. slot = next(iter);
  4555. if(slot < 18 || slot > 26) {
  4556. inv.setItem(inv, slot, $red_glass);
  4557. } else {
  4558. inv.setItem(inv, slot, $green_glass);
  4559. }
  4560. }
  4561. if(new_pos == 5) {
  4562. return true;
  4563. }
  4564. return false;
  4565. }
  4566. function cam.enter(player) {
  4567. entity.clearEffects(player);
  4568. entity.addEffect(player, "invisibility", 999999, 1, false);
  4569. entity.addEffect(player, "night_vision", 999999, 0, false);
  4570. entity.setGravity(player, false);
  4571. player_uuid = player.getUuid(player);
  4572. list.add($cam_list, player_uuid);
  4573. stacks.set(player, 0, "km:arrow_left");
  4574. stacks.set(player, 1, "km:arrow_right");
  4575. stacks.set(player, 8, "km:cross_red");
  4576. if(!player.isGhost(player)) {
  4577. amongus.removeEquip(player);
  4578. }
  4579. if(isImpostor(player)) {
  4580. stacks.clearIndex(player, 3);
  4581. stacks.clearIndex(player, 4);
  4582. stacks.clearIndex(player, 5);
  4583. stacks.clearIndex(player, 6);
  4584. stacks.clearIndex(player, 7);
  4585. cooldown = data.getTimer(player, "Kill Cooldown");
  4586. map.add($holded_kill_cooldown, player_uuid, cooldown);
  4587. }
  4588. if($cam_loop == false) {
  4589. $cam_loop = true;
  4590. sgoto(10, "cam_tp_loop");
  4591. }
  4592. }
  4593. function cam.leave(player) {
  4594. player_uuid = player.getUuid(player);
  4595. list.remove($cam_list, player_uuid);
  4596. map.remove($cam_map, player_uuid);
  4597. ent = map.get($cam_map_3, player_uuid);
  4598. if(ent != null) {
  4599. map.remove($cam_map_3, ent);
  4600. map.remove($cam_map_4, ent);
  4601. entity.remove(ent);
  4602. }
  4603. entity.clearEffects(player);
  4604. entity.setGravity(player, true);
  4605. entity.teleport(player, map.get($cam_map_2, player_uuid));
  4606. if(list.getSize($cam_list) == 0) {
  4607. $cam_loop = false;
  4608. }
  4609. if(player.isGhost(player)) {
  4610. entity.addEffect(player, "invisibility", 999999, 1, false);
  4611. stacks.clear(player);
  4612. } else {
  4613. color = amongus.getPlayerColor(player);
  4614. amongus.equip(player, color);
  4615. setCrewmateIcons(player);
  4616. if(isImpostor(player)) {
  4617. setImpostorIcons(player);
  4618. } else {
  4619. stacks.clearIndex(player, 8);
  4620. }
  4621. if($lights_sabotaged) {
  4622. if(isCrewmate(player)) {
  4623. entity.addEffect(player, "blindness", 999999, 7, false);
  4624. } else {
  4625. entity.addEffect(player, "night_vision", 999999, 0, false);
  4626. }
  4627. }
  4628. }
  4629. }
  4630. function player.isOnCam(player) {
  4631. player_uuid = player.getUuid(player);
  4632. return list.contains($cam_list, player_uuid);
  4633. }
  4634. @cam_tp_loop
  4635. show_cam_pars = false;
  4636. iter = list.iterator(cam_list);
  4637. while(hasNext(iter)) {
  4638. p_uuid = next(iter);
  4639. p = player.get(p_uuid);
  4640. cam_number = map.get(cam_map, p_uuid);
  4641. tp_loc = list.getIndex(cams_locs_tp, cam_number);
  4642. entity.teleport(p, tp_loc);
  4643. if(isImpostor(p)) {
  4644. cooldown = map.getOrDefault(holded_kill_cooldown, player_uuid, -1);
  4645. if(cooldown != -1) {
  4646. data.setTimer(p, "Kill Cooldown", cooldown);
  4647. status.addTimed(p, 1, cooldown, "Kill Cooldown");
  4648. }
  4649. }
  4650. if(!player.isGhost(p)) {
  4651. show_cam_pars = true;
  4652. }
  4653. }
  4654. if(show_cam_pars) {
  4655. iter = list.iterator(cams_par_locs);
  4656. while(hasNext(iter)) {
  4657. particle.spawn(next(iter), cam_par);
  4658. }
  4659. }
  4660. if(cam_loop) {
  4661. sgoto(10, "cam_tp_loop");
  4662. }
  4663. goto("checkgame");
  4664. function vent_enter(player, vent_loc) {
  4665. tp_loc = map.get($vent_map, vent_loc);
  4666. entity.teleport(player, tp_loc);
  4667. entity.addEffect(player, "invisibility", 999999, 1, false);
  4668. player_uuid = player.getUuid(player);
  4669. map.add($vent_map_2, player_uuid, tp_loc);
  4670. map.add($vent_map_4, player_uuid, vent_loc);
  4671. a = map.get($vent_map_3, vent_loc);
  4672. icon_1 = a[0];
  4673. icon_2 = a[2];
  4674. if(icon_1 == null) {
  4675. stacks.clearIndex(player, 5);
  4676. } else {
  4677. stacks.set(player, 5, icon_1);
  4678. }
  4679. if(!list.contains($vent_list, player_uuid)) {
  4680. list.add($vent_list, player_uuid);
  4681. }
  4682. if(icon_2 == null) {
  4683. stacks.clearIndex(player, 6);
  4684. } else {
  4685. stacks.set(player, 6, icon_2);
  4686. }
  4687. if($vent_loop == false) {
  4688. $vent_loop = true;
  4689. sgoto(10, "vent_tp_loop");
  4690. }
  4691. }
  4692. function vent_leave(player) {
  4693. player_uuid = player.getUuid(player);
  4694. list.remove($vent_list, player_uuid);
  4695. map.remove($vent_map_2, player_uuid);
  4696. map.remove($vent_map_4, player_uuid);
  4697. entity.clearEffects(player);
  4698. if($lights_sabotaged) {
  4699. entity.addEffect(player, "night_vision", 999999, 0, false);
  4700. }
  4701. if(list.getSize($vent_list) == 0) {
  4702. $vent_loop = false;
  4703. }
  4704. color = amongus.getPlayerColor(player);
  4705. amongus.equip(player, color);
  4706. setImpostorIcons(player);
  4707. }
  4708. @vent_tp_loop
  4709. iter = list.iterator(vent_list);
  4710. while(hasNext(iter)) {
  4711. p_uuid = next(iter);
  4712. p = player.get(p_uuid);
  4713. tp_loc = map.get(vent_map_2, p_uuid);
  4714. entity.teleport(p, tp_loc);
  4715. if(isImpostor(p)) {
  4716. cooldown = map.getOrDefault(holded_kill_cooldown, player_uuid, -1);
  4717. if(cooldown != -1) {
  4718. data.setTimer(p, "Kill Cooldown", cooldown);
  4719. status.addTimed(p, 1, cooldown, "Kill Cooldown");
  4720. }
  4721. }
  4722. }
  4723. if(vent_loop) {
  4724. sgoto(10, "vent_tp_loop");
  4725. }
  4726. goto("checkgame");
  4727. @space_loop
  4728. loc_iter = list.iterator(space_locs);
  4729. while(hasNext(loc_iter)) {
  4730. particle.spawn(next(loc_iter), space_par);
  4731. }
  4732. sgoto(50, "space_loop");
  4733. goto("checkgame");
  4734. @task_part_loop
  4735. iter = list.iterator(player_list);
  4736. while(hasNext(iter)) {
  4737. p_uuid = next(iter);
  4738. p = player.get(p_uuid);
  4739. my_list = map.get(task_part_map, p_uuid);
  4740. if(my_list != null) {
  4741. loc_iter = list.iterator(my_list);
  4742. while(hasNext(loc_iter)) {
  4743. particle.spawnPlayer(next(loc_iter), task_par, p, 1, 0, 0.05, 0.05, 0.05);
  4744. }
  4745. }
  4746. }
  4747. sgoto(10, "task_part_loop");
  4748. goto("checkgame");
  4749. function addSaboParticles(location1, location2) {
  4750. list.add($sabo_par_list, location1);
  4751. if(location2 != null) {
  4752. list.add($sabo_par_list, location2);
  4753. }
  4754. sgoto(10, "sabo_par_loop");
  4755. }
  4756. function removeSaboParticles(location1, location2) {
  4757. list.remove($sabo_par_list, location1);
  4758. if(location2 != null) {
  4759. list.remove($sabo_par_list, location2);
  4760. }
  4761. }
  4762. @sabo_par_loop
  4763. if(!amongus.isAlert()) {
  4764. goto("checkgame");
  4765. }
  4766. loc_iter = list.iterator(sabo_par_list);
  4767. while(hasNext(loc_iter)) {
  4768. particle.spawn(next(loc_iter), sabo_par);
  4769. }
  4770. sgoto(10, "sabo_par_loop");
  4771. goto("checkgame");
  4772. function addTaskParticle(player, location) {
  4773. if(isCrewmate(player) || $freeplay) {
  4774. player_uuid = player.getUuid(player);
  4775. my_list = map.get($task_part_map, player_uuid);
  4776. if(my_list == null) {
  4777. my_list = list.new();
  4778. map.add($task_part_map, player_uuid, my_list);
  4779. }
  4780. list.add(my_list, location);
  4781. }
  4782. }
  4783. function removeTaskParticle(player, location) {
  4784. player_uuid = player.getUuid(player);
  4785. my_list = map.get($task_part_map, player_uuid);
  4786. if(my_list == null) {
  4787. my_list = list.new();
  4788. map.add($task_part_map, player_uuid, my_list);
  4789. }
  4790. list.remove(my_list, location);
  4791. }
  4792. function reactor.setHeader(inv, item) {
  4793. for(i = 0; i < 5; i++) {
  4794. inv.setItem(inv, i, item);
  4795. }
  4796. }
  4797. function reactor.setLeftSide(inv, item) {
  4798. inv.setItem(inv, 5, item);
  4799. inv.setItem(inv, 6, item);
  4800. inv.setItem(inv, 7, item);
  4801. inv.setItem(inv, 11, item);
  4802. inv.setItem(inv, 12, item);
  4803. inv.setItem(inv, 13, item);
  4804. inv.setItem(inv, 17, item);
  4805. inv.setItem(inv, 18, item);
  4806. inv.setItem(inv, 19, item);
  4807. }
  4808. function reactor.setRightSide(inv, item) {
  4809. inv.setItem(inv, 8, item);
  4810. inv.setItem(inv, 9, item);
  4811. inv.setItem(inv, 10, item);
  4812. inv.setItem(inv, 14, item);
  4813. inv.setItem(inv, 15, item);
  4814. inv.setItem(inv, 16, item);
  4815. inv.setItem(inv, 20, item);
  4816. inv.setItem(inv, 21, item);
  4817. inv.setItem(inv, 22, item);
  4818. }
  4819. function reactor.get(player_or_uuid) {
  4820. if(isPlayer(player_or_uuid)) {
  4821. player_or_uuid = player.getUuid(player_or_uuid);
  4822. }
  4823. reactor_array = map.get($start_reactor_map, player_or_uuid);
  4824. return reactor_array;
  4825. }
  4826. function reactor.save(reactor_array, player) {
  4827. player_uuid = player.getUuid(player);
  4828. map.add($start_reactor_map, player_uuid, reactor_array);
  4829. }
  4830. function reactor.setInv(reactor_array, inv) {
  4831. reactor_array[0] = inv;
  4832. }
  4833. function reactor.getInv(reactor_array) {
  4834. return reactor_array[0];
  4835. }
  4836. function reactor.setStage(reactor_array, stage) {
  4837. reactor_array[1] = stage;
  4838. }
  4839. function reactor.getStage(reactor_array) {
  4840. return reactor_array[1];
  4841. }
  4842. function reactor.setCounter(reactor_array, counter) {
  4843. reactor_array[2] = counter;
  4844. }
  4845. function reactor.getCounter(reactor_array) {
  4846. return reactor_array[2];
  4847. }
  4848. function reactor.setPattern(reactor_array) {
  4849. pattern = array.new(5);
  4850. for(i = 0; i < 5; i++) {
  4851. r = math.random(1, 9);
  4852. if(r < 4) {
  4853. r += 4;
  4854. } elseif(r < 7) {
  4855. r += 7;
  4856. } else {
  4857. r += 10;
  4858. }
  4859. pattern[i] = r;
  4860. }
  4861. reactor_array[3] = pattern;
  4862. }
  4863. function reactor.getPattern(reactor_array) {
  4864. return reactor_array[3];
  4865. }
  4866. function reactor.setPhase(reactor_array, phase) {
  4867. reactor_array[4] = phase;
  4868. }
  4869. function reactor.getPhase(reactor_array) {
  4870. return reactor_array[4];
  4871. }
  4872. function sabotage.holdReactor(inv, hold) {
  4873. if(hold) {
  4874. item = $lime_glass;
  4875. } else {
  4876. item = $red_glass;
  4877. }
  4878. for(i = 0; i < 54; i++) {
  4879. inv.setItem(inv, i, item);
  4880. }
  4881. }
  4882. function switchLights(boolean) {
  4883. if(boolean) {
  4884. item = "minecraft:sea_lantern";
  4885. } else {
  4886. item = "minecraft:smooth_stone";
  4887. }
  4888. iter = list.iterator($lights_locs);
  4889. while(hasNext(iter)) {
  4890. block.set(next(iter), item);
  4891. }
  4892. }
  4893. @draw_comms
  4894. player_uuid = list.getIndex(comms_state_list, 0);
  4895. list.removeIndex(comms_state_list, 0);
  4896. if(!comms_sabotaged) {
  4897. goto("checkgame");
  4898. }
  4899. inv = map.get(comms_inv_map, player_uuid);
  4900. if(inv == null) {
  4901. goto("checkgame");
  4902. }
  4903. comms_state = map.get(comms_state_map, player_uuid);
  4904. counter = map.getOrDefault(comms_counter_map, player_uuid, 0);
  4905. if(comms_state == 0) {
  4906. //worst
  4907. for(i = 26; i >= 9; i--) {
  4908. inv.setItem(inv, i, inv.getItem(inv, i - 1));
  4909. }
  4910. if(counter == 1) {
  4911. counter = 0;
  4912. } else {
  4913. inv.setItem(inv, 9, red_glass);
  4914. counter++;
  4915. }
  4916. } elseif(comms_state == 1) {
  4917. //close
  4918. for(i = 26; i >= 0; i--) {
  4919. inv.setItem(inv, i, inv.getItem(inv, i - 1));
  4920. }
  4921. if(counter == 3) {
  4922. inv.setItem(inv, 0, yellow_glass);
  4923. inv.setItem(inv, 18, air_item);
  4924. counter = 0;
  4925. } elseif(counter == 2) {
  4926. inv.setItem(inv, 9, yellow_glass);
  4927. counter++;
  4928. } else {
  4929. counter++;
  4930. }
  4931. } elseif(comms_state == 2) {
  4932. //correct
  4933. for(i = 35; i >= 0; i--) {
  4934. inv.setItem(inv, i, inv.getItem(inv, i - 1));
  4935. }
  4936. if(counter == 5) {
  4937. inv.setItem(inv, 0, lime_glass);
  4938. counter = 0;
  4939. } elseif(counter == 4) {
  4940. inv.setItem(inv, 9, lime_glass);
  4941. inv.setItem(inv, 27, air_item);
  4942. counter++;
  4943. } elseif(counter == 2) {
  4944. inv.setItem(inv, 9, air_item);
  4945. inv.setItem(inv, 27, lime_glass);
  4946. counter++;
  4947. } elseif(counter == 0) {
  4948. inv.setItem(inv, 9, lime_glass);
  4949. inv.setItem(inv, 27, air_item);
  4950. counter++;
  4951. } else {
  4952. counter++;
  4953. }
  4954. }
  4955. map.add(comms_counter_map, player_uuid, counter);
  4956. inv.update(player.get(player_uuid));
  4957. list.add(comms_state_list, player_uuid);
  4958. sgoto(5, "draw_comms");
  4959. goto("checkgame");
  4960. function comms.drawCorrect(inv, player) {
  4961. player_uuid = player.getUuid(player);
  4962. map.add($comms_state_map, player_uuid, 2);
  4963. map.remove($comms_counter_map, player_uuid);
  4964. for(i = 0; i < 36; i++) {
  4965. inv.setItem(inv, i, $air_item);
  4966. }
  4967. inv.setItem(inv, 0, $lime_glass);
  4968. inv.setItem(inv, 6, $lime_glass);
  4969. inv.setItem(inv, 10, $lime_glass);
  4970. inv.setItem(inv, 14, $lime_glass);
  4971. inv.setItem(inv, 16, $lime_glass);
  4972. inv.setItem(inv, 20, $lime_glass);
  4973. inv.setItem(inv, 22, $lime_glass);
  4974. inv.setItem(inv, 26, $lime_glass);
  4975. inv.setItem(inv, 30, $lime_glass);
  4976. inv.update(player);
  4977. }
  4978. function comms.drawClose(inv, player) {
  4979. player_uuid = player.getUuid(player);
  4980. map.add($comms_state_map, player_uuid, 1);
  4981. map.remove($comms_counter_map, player_uuid);
  4982. for(i = 0; i < 36; i++) {
  4983. inv.setItem(inv, i, $air_item);
  4984. }
  4985. inv.setItem(inv, 0, $yellow_glass);
  4986. inv.setItem(inv, 4, $yellow_glass);
  4987. inv.setItem(inv, 8, $yellow_glass);
  4988. inv.setItem(inv, 10, $yellow_glass);
  4989. inv.setItem(inv, 12, $yellow_glass);
  4990. inv.setItem(inv, 14, $yellow_glass);
  4991. inv.setItem(inv, 16, $yellow_glass);
  4992. inv.setItem(inv, 20, $yellow_glass);
  4993. inv.setItem(inv, 24, $yellow_glass);
  4994. inv.update(player);
  4995. }
  4996. function comms.drawWorst(inv, player) {
  4997. player_uuid = player.getUuid(player);
  4998. map.add($comms_state_map, player_uuid, 0);
  4999. map.remove($comms_counter_map, player_uuid);
  5000. for(i = 0; i < 9; i++) {
  5001. inv.setItem(inv, i, $air_item);
  5002. }
  5003. for(i = 27; i < 36; i++) {
  5004. inv.setItem(inv, i, $air_item);
  5005. }
  5006. for(i = 9; i < 27; i = i + 2) {
  5007. inv.setItem(inv, i, $air_item);
  5008. }
  5009. for(i = 10; i < 27; i = i + 2) {
  5010. inv.setItem(inv, i, $red_glass);
  5011. }
  5012. inv.update(player);
  5013. }
  5014. @scheduled_fix_comms
  5015. player_uuid = list.getIndex(comms_fix_list, 0);
  5016. list.removeIndex(comms_fix_list, 0);
  5017. time = map.get(comms_fix_map, player_uuid);
  5018. if(time == null) {
  5019. goto("checkgame");
  5020. }
  5021. if(time.getMillis() - time <= 2000) {
  5022. fix_comms();
  5023. }
  5024. goto("checkgame");
  5025. function sabotage.openedInv(player) {
  5026. list.add($sabo_list, player.getUuid(player));
  5027. }
  5028. function sabotage.closedInv(player) {
  5029. list.remove($sabo_list, player.getUuid(player));
  5030. }
  5031. function sabotage.closeInvs() {
  5032. iter = list.iterator($sabo_list);
  5033. while(hasNext(iter)) {
  5034. inv.close(player.get(next(iter)));
  5035. }
  5036. }
  5037. @scheduled_sabo_close
  5038. sabotage.closeInvs();
  5039. goto("checkgame");
  5040. function task.stepIncrease(player, task_id) {
  5041. player_uuid = player.getUuid(player);
  5042. map = map.get($task_steps, player_uuid);
  5043. if(map == null) {
  5044. map = map.new();
  5045. }
  5046. step = map.getOrDefault(map, task_id, 0) + 1;
  5047. map.add(map, task_id, step);
  5048. map.add($task_steps, player_uuid, map);
  5049. return step;
  5050. }
  5051. function task.getStep(player, task_id) {
  5052. map = map.get($task_steps, player.getUuid(player));
  5053. if(map == null) {
  5054. return 0;
  5055. }
  5056. return map.getOrDefault(map, task_id, 0);
  5057. }
  5058. function task.resetSteps(player) {
  5059. map.add($task_steps, player.getUuid(player), map.new());
  5060. }
  5061. function amongus.setPlayerColor(player, color) {
  5062. player_uuid = player.getUuid(player);
  5063. map.add($player_colors, player_uuid, color);
  5064. }
  5065. function amongus.getPlayerColor(player_or_uuid) {
  5066. if(isPlayer(player_or_uuid)) {
  5067. player_or_uuid = player.getUuid(player_or_uuid);
  5068. }
  5069. return map.get($player_colors, player_or_uuid);
  5070. }
  5071. function amongus.getPlayerColorCode(player_or_uuid) {
  5072. color = amongus.getPlayerColor(player_or_uuid);
  5073. return map.getOrDefault($color_code_map, color, "§r");
  5074. }
  5075. function amongus.isUsedPlayerColor(color) {
  5076. iter = map.iterator($player_colors);
  5077. while(hasNext(iter)) {
  5078. element = next(iter);
  5079. value = map.getValue(element);
  5080. if(value == color) {
  5081. return true;
  5082. }
  5083. }
  5084. return false;
  5085. }
  5086. function amongus.removeEquip(player) {
  5087. living.setEquip(player, "head", $air_item);
  5088. living.setEquip(player, "chest", $air_item);
  5089. living.setEquip(player, "legs", $air_item);
  5090. living.setEquip(player, "feet", $air_item);
  5091. }
  5092. function amongus.forceEquip(entity, color) {
  5093. color_code = map.get($cloth_code_map, color);
  5094. item = read.item(concat("{id:\"minecraft:leather_helmet\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5095. item.hide(item, "attributes");
  5096. living.setEquip(entity, "head", item);
  5097. item = read.item(concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5098. item.hide(item, "attributes");
  5099. living.setEquip(entity, "chest", item);
  5100. item = read.item(concat("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5101. item.hide(item, "attributes");
  5102. living.setEquip(entity, "legs", item);
  5103. item = read.item(concat("{id:\"minecraft:leather_boots\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5104. item.hide(item, "attributes");
  5105. living.setEquip(entity, "feet", item);
  5106. }
  5107. function amongus.equip(entity, color) {
  5108. color_code = map.get($cloth_code_map, color);
  5109. if(item.getType(living.getEquip(entity, "head")) == "minecraft:air") {
  5110. item = read.item(concat("{id:\"minecraft:leather_helmet\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5111. item.hide(item, "attributes");
  5112. living.setEquip(entity, "head", item);
  5113. }
  5114. if(item.getType(living.getEquip(entity, "chest")) == "minecraft:air") {
  5115. item = read.item(concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5116. item.hide(item, "attributes");
  5117. living.setEquip(entity, "chest", item);
  5118. }
  5119. if(item.getType(living.getEquip(entity, "legs")) == "minecraft:air") {
  5120. item = read.item(concat("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5121. item.hide(item, "attributes");
  5122. living.setEquip(entity, "legs", item);
  5123. }
  5124. if(item.getType(living.getEquip(entity, "feet")) == "minecraft:air") {
  5125. item = read.item(concat("{id:\"minecraft:leather_boots\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
  5126. item.hide(item, "attributes");
  5127. living.setEquip(entity, "feet", item);
  5128. }
  5129. }
  5130. function createVoteInv(player, reporter_uuid) {
  5131. //inv = inv.new("232202322 232202322 232202322 232202322 232202322 032200000");
  5132. inv = inv.new("232202322232202322232202322232202322232202322032200000");
  5133. index = 1;
  5134. iter = list.iterator($all_list);
  5135. while(hasNext(iter)) {
  5136. p_uuid = next(iter);
  5137. p_name = player.getName(p_uuid);
  5138. head = player.getHead(p_uuid, p_name);
  5139. if(player.isGhost(p_uuid)) {
  5140. item.setName(head, concat("§r", amongus.getPlayerColorCode(p_uuid), p_name));
  5141. inv.setItem(inv, index - 1, $zombie_head);
  5142. } else {
  5143. item.setName(head, concat("§rVote for ", amongus.getPlayerColorCode(p_uuid), p_name));
  5144. if(p_uuid == reporter_uuid) {
  5145. item.setAmount(head, 2);
  5146. }
  5147. }
  5148. inv.setItem(inv, index, head);
  5149. index = index + 4;
  5150. }
  5151. inv.setItem(inv, 40, read.item("km:return_green", 1, "§rSkip Vote"));
  5152. map.add($vote_inv_map, player.getUuid(player), inv);
  5153. }
  5154. function getVoteInv(player) {
  5155. return map.get($vote_inv_map, player.getUuid(player));
  5156. }
  5157. function setItemInVoteInv(slot, item) {
  5158. iter = list.iterator($player_list);
  5159. while(hasNext(iter)) {
  5160. p = player.get(next(iter));
  5161. inv = getVoteInv(p);
  5162. inv.setItem(inv, slot, item);
  5163. }
  5164. }
  5165. function amongus.isAlert() {
  5166. return $alert;
  5167. }
  5168. function amongus.setAlert(bool) {
  5169. $alert = bool;
  5170. }
  5171. function addVentIcons(vent_loc, icon_1, vent_tp_loc_1, icon_2, vent_tp_loc_2) {
  5172. a = array.new(4);
  5173. a[0] = icon_1;
  5174. a[1] = vent_tp_loc_1;
  5175. a[2] = icon_2;
  5176. a[3] = vent_tp_loc_2;
  5177. map.add($vent_map_3, vent_loc, a);
  5178. }
  5179. @crewmate_win
  5180. winners = "§bCrewmates";
  5181. goto("win");
  5182. @checkwin
  5183. imps_alive = 0;
  5184. crew_alive = 0;
  5185. iter = list.iterator(player_list);
  5186. while(hasNext(iter)) {
  5187. p_uuid = next(iter);
  5188. p = player.get(p_uuid);
  5189. if(!player.isGhost(p)) {
  5190. if(isImpostor(p)) {
  5191. imps_alive++;
  5192. } else {
  5193. crew_alive++;
  5194. }
  5195. }
  5196. }
  5197. if(imps_alive == 0) {
  5198. winners = "§bCrewmates";
  5199. goto("win");
  5200. }
  5201. if(imps_alive >= crew_alive) {
  5202. winners = "§cImpostors";
  5203. goto("win");
  5204. }
  5205. goto("checkgame");
  5206. @win
  5207. imp_string = "";
  5208. iter = list.iterator(impostors_list);
  5209. while(hasNext(iter)) {
  5210. p_uuid = next(iter);
  5211. p_name = player.getName(p_uuid);
  5212. string = concat(amongus.getPlayerColorCode(p_uuid), p_name);
  5213. if(imp_string == "") {
  5214. imp_string = string;
  5215. } else {
  5216. imp_string = concat(imp_string, ", ", string);
  5217. }
  5218. }
  5219. iter = list.iterator(player_list);
  5220. while(hasNext(iter)) {
  5221. p_uuid = next(iter);
  5222. p = player.get(p_uuid);
  5223. msg.prefix(p, $gamename, concat("The ", winners, "§r have won the game."));
  5224. msg.prefix(p, $gamename, concat("§4Impostors: §r", imp_string));
  5225. inv.close(p);
  5226. player.mute(p, false);
  5227. }
  5228. //Building-Perms wieder geben
  5229. for(i = 0; i < list.getSize(removed_perms); i++) {
  5230. player_uuid = list.getIndex(removed_perms, i);
  5231. perm.registerPlayer(player_uuid, 1);
  5232. perm.registerPlayer(player_uuid, 15);
  5233. }
  5234. script = script.getFromId(script_id);
  5235. minigame.kickAllPlayers(script);
  5236. minigame.term(script, gamesignloc);
  5237. term();