1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719 |
- /*
- --- Version 2 ---
- //PERMS
- Hats
- Sabotage: Door Closing
- Visual Tasks
- Stay in lobby after win
- rauswerf animation. tp auf tisch. float effect.
- setting: full vision/blindness (darkness effect? 1.19)
- */
- @game_core
- event.load("entity_dismount");
- event.load("snuvi_click");
- event.load("player_drop");
- player_colors = map.new();
- minigame.setSpecificLobbyHandling(true);
- minigame.setNoLobbyTeleport(true);
- minigame.setPlayerResetInCore(false);
- minigame.setManualStart(true);
- gamename = "§cAmong Us";
- game_short = "among_us";
- rankingtable = "among_us_ranks";
- item_arrow_left = customitem.create("ARROW_LEFT", 1, null, null);
- item_arrow_right = customitem.create("ARROW_RIGHT", 1, null, null);
- item_arrow_up = customitem.create("ARROW_UP", 1, null, null);
- item_arrow_down = customitem.create("ARROW_DOWN", 1, null, null);
-
- sabotage_menu = inv.new("222200000", text.new("§cSABOTAGE"));
- inv.setItem(sabotage_menu, 0, item.create("REDSTONE_LAMP", 1, "§fSabotage Light", null));
- inv.setItem(sabotage_menu, 1, item.create("END_CRYSTAL", 1, "§fSabotage Reactor", null));
- inv.setItem(sabotage_menu, 2, item.create("OAK_SAPLING", 1, "§fSabotage Oxygen", null));
- inv.setItem(sabotage_menu, 3, item.create("PAPER", 1, "§fSabotage Communication", null));
- settings_inv = inv.new("222222222222222222222222222222222222222222222222222222", text.new("§cSettings"));
- for(i = 0; i < 9; i++) {
- inv.setItem(settings_inv, i, item_arrow_up);
- }
- inv.setItem(settings_inv, 9, customitem.create("GEAR", 1, string.concat("§rImpostors: ", string.number(amount_impostors)), null));
- inv.setItem(settings_inv, 10, customitem.create("GEAR", 1, string.concat("§rShort Tasks: ", string.number(amount_short)), null));
- inv.setItem(settings_inv, 11, customitem.create("GEAR", 1, string.concat("§rCommon Tasks: ", string.number(amount_common)), null));
- inv.setItem(settings_inv, 12, customitem.create("GEAR", 1, string.concat("§rLong Tasks: ", string.number(amount_long)), null));
- inv.setItem(settings_inv, 13, customitem.create("GEAR", 1, string.concat("§rAmount Meetings: ", string.number(amount_meetings)), null));
- inv.setItem(settings_inv, 14, customitem.create("GEAR", 1, string.concat("§rMeeting Cooldown: ", string.number(meeting_cooldown)), null));
- inv.setItem(settings_inv, 15, customitem.create("GEAR", 1, string.concat("§rDiscussion Time: ", string.number(discuss_time)), null));
- inv.setItem(settings_inv, 16, customitem.create("GEAR", 1, string.concat("§rVoting Time: ", string.number(vote_time)), null));
- inv.setItem(settings_inv, 17, customitem.create("GEAR", 1, string.concat("§rSpeed: ", string.number(move_speed)), null));
- for(i = 18; i < 27; i++) {
- inv.setItem(settings_inv, i, item_arrow_down);
- }
- for(i = 27; i < 29; i++) {
- inv.setItem(settings_inv, i, item_arrow_up);
- }
- inv.setItem(settings_inv, 36, customitem.create("GEAR", 1, string.concat("§rKill Cooldown: ", string.number(kill_cooldown)), null));
- inv.setItem(settings_inv, 37, customitem.create("GEAR", 1, string.concat("§rConfirm Ejects: ", confirm_ejects), null));
- //inv.setItem(settings_inv, 38, customitem.create("GEAR", 1, string.concat("§r: ", string.number()), null));
- //inv.setItem(settings_inv, 39, customitem.create("GEAR", 1, string.concat("§r: ", string.number()), null));
- //inv.setItem(settings_inv, 40, customitem.create("GEAR", 1, string.concat("§r: ", string.number()), null));
- //inv.setItem(settings_inv, 41, customitem.create("GEAR", 1, string.concat("§r: ", string.number()), null));
- //inv.setItem(settings_inv, 42, customitem.create("GEAR", 1, string.concat("§r: ", string.number()), null));
- //inv.setItem(settings_inv, 43, customitem.create("GEAR", 1, string.concat("§r: ", string.number()), null));
- //inv.setItem(settings_inv, 44, customitem.create("GEAR", 1, string.concat("§r: ", string.number()), null));
- for(i = 45; i < 47; i++) {
- inv.setItem(settings_inv, i, item_arrow_down);
- }
- color_list = list.new();
- list.add(color_list, "dark_gray");
- list.add(color_list, "cyan");
- list.add(color_list, "red");
- list.add(color_list, "blue");
- list.add(color_list, "orange");
- list.add(color_list, "green");
- list.add(color_list, "gray");
- list.add(color_list, "white");
- list.add(color_list, "pink");
- list.add(color_list, "purple");
- list.add(color_list, "yellow");
- list.add(color_list, "lime");
- cloth_code_map = map.new();
- map.add(cloth_code_map, "dark_gray", 4673362);
- map.add(cloth_code_map, "cyan", 1481884);
- map.add(cloth_code_map, "red", 11546150);
- map.add(cloth_code_map, "blue", 3949738);
- map.add(cloth_code_map, "orange", 16351261);
- map.add(cloth_code_map, "green", 6192150);
- map.add(cloth_code_map, "gray", 10329495);
- map.add(cloth_code_map, "white", 16383998);
- map.add(cloth_code_map, "pink", 15961002);
- map.add(cloth_code_map, "purple", 8991416);
- map.add(cloth_code_map, "yellow", 16701501);
- map.add(cloth_code_map, "lime", 8439583);
- color_code_map = map.new();
- map.add(color_code_map, "dark_gray", "§8");
- map.add(color_code_map, "cyan", "§b");
- map.add(color_code_map, "red", "§c");
- map.add(color_code_map, "blue", "§9");
- map.add(color_code_map, "orange", "§6");
- map.add(color_code_map, "green", "§2");
- map.add(color_code_map, "gray", "§7");
- map.add(color_code_map, "white", "§f");
- map.add(color_code_map, "pink", "§d");
- map.add(color_code_map, "purple", "§5");
- map.add(color_code_map, "yellow", "§e");
- map.add(color_code_map, "lime", "§a");
- prev_cam_item = customitem.create("ARROW_LEFT", 1, "§fPrevious cam", null);
- next_cam_item = customitem.create("ARROW_RIGHT", 1, "§fNext cam", null);
- leave_cam_item = customitem.create("CROSS_RED", 1, "§fLeave cam", null);
- leave_vent_item = customitem.create("CROSS_RED", 1, "§fLeave vent", null);
- kill_item = item.create("IRON_SWORD", 1, "§fKill", null);
- item.addFlag(kill_item, "HIDE_ATTRIBUTES");
- sabotage_item = customitem.create("GEAR", 1, "§fSabotage", null);
- open_vote_menu_item = customitem.create("CROSS_GREEN", 1, "§fOpen vote menu", null);
- color_choose_item = item.create("RED_CONCRETE", 1, "§fChoose color", null);
- color_choose_inv = inv.new("222222222222000000", text.new("§cChoose your color"));
- index = 0;
- iter = iterator(color_list);
- while(hasNext(iter)) {
- color_name = next(iter);
- cloth_code = map.get(cloth_code_map, color_name);
- color_name = string.upperFirstLetter(color_name);
- item = read.item(string.concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", cloth_code, ",Name:'{\"text\":\"§r", color_name, "\"}'}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- inv.setItem(color_choose_inv, index++, item);
- }
- minigame.initStart();
- minigame.setLobbyCounter(5);
- goto("simplelobby");
- @specificLobbyHandling
- if(event == "minigame_join") {
- resetplayer(player);
- assignSeat(player);
- if(lobby_leader == null) {
- lobby_leader = player.getUuid(player);
- settings_item = customitem.create("GEAR", 1, "§fSettings", null);
- player.giveItem(player, settings_item);
- }
- sb.add(player, 99, string.concat("Lobby-Leader: §a", player.getName(lobby_leader)));
- sb.add(player, 98, gamename);
- sb.add(player, 97, string.concat("Impostors: §a", string.number(amount_impostors)));
- sb.add(player, 96, string.concat("Short Tasks: §a", string.number(amount_short)));
- sb.add(player, 95, string.concat("Common Tasks: §a", string.number(amount_common)));
- sb.add(player, 94, string.concat("Long Tasks: §a", string.number(amount_long)));
- sb.add(player, 93, string.concat("Amount Meetings: §a", string.number(amount_meetings)));
- sb.add(player, 92, string.concat("Meeting Cooldown: §a", string.number(meeting_cooldown), " s"));
- sb.add(player, 91, string.concat("Discussion Time: §a", string.number(discuss_time), " s"));
- sb.add(player, 90, string.concat("Voting Time: §a", string.number(vote_time), " s"));
- sb.add(player, 89, string.concat("Speed: §a", string.number(move_speed)));
- sb.add(player, 88, string.concat("Kill Cooldown: §a", string.number(kill_cooldown), " s"));
- sb.add(player, 87, string.concat("Confirm Ejects: §a", confirm_ejects));
- sb.add(player, 86, sb.getSpacer());
- player.giveItem(player, color_choose_item);
- player.setSpeed(player, move_speed);
- player.setHunger(player, 20);
- player.setSaturation(player, 100);
- return;
- }
- if(event == "player_drop") {
- cancel = true;
- return;
- }
- if(event == "block_click") {
- if(action != "RIGHT_CLICK_BLOCK" && action != "RIGHT_CLICK_AIR") {
- return;
- }
- if(block != null && block.getLocation(block) == start_sign_loc) {
- if(player.getUuid(player) != lobby_leader) {
- msg.prefix(player, gamename, "You are not the Lobby-Leader.");
- return;
- }
- if(!minigame.canStartIndiv()) {
- msg.prefix(player, gamename, "You need to be alone for singleplayer. For multiplayer more than 2 players are needed.");
- return;
- }
- goto("startcountdown");
- }
- item = living.getHand(player);
- if(item == settings_item) {
- if(player.getUuid(player) != lobby_leader) {
- return;
- }
- inv.open(settings_inv, player);
- return;
- }
- if(item == color_choose_item) {
- inv.open(color_choose_inv, player);
- return;
- }
- return;
- }
- if(event == "snuvi_click") {
- title_string = string.text(inv_title);
- if(title_string == "§cSettings") {
- //amount_impostors
- if(inv_slot == 0 || inv_slot == 9 || inv_slot == 18) {
- if(inv_slot == 0 || inv_slot == 9) {
- if(amount_impostors < amount_impostors_max) {
- amount_impostors++;
- }
- } elseif(inv_slot == 18) {
- if(amount_impostors > amount_impostors_min) {
- amount_impostors--;
- }
- }
- minigame.displayAll(97, string.concat("Impostors: §a", string.number(amount_impostors)));
- inv.setItem(settings_inv, 9, customitem.create("GEAR", 1, string.concat("§rImpostors: ", string.number(amount_impostors)), null));
- return;
- }
- //short_tasks
- if(inv_slot == 1 || inv_slot == 10 || inv_slot == 19) {
- if(inv_slot == 1 || inv_slot == 10) {
- if(amount_short < amount_short_max) {
- amount_short++;
- }
- } elseif(inv_slot == 19) {
- if(amount_short > amount_short_min) {
- amount_short--;
- }
- }
- minigame.displayAll(96, string.concat("Short Tasks: §a", string.number(amount_short)));
- inv.setItem(settings_inv, 10, customitem.create("GEAR", 1, string.concat("§rShort Tasks: ", string.number(amount_short)), null));
- return;
- }
- //common_tasks
- if(inv_slot == 2 || inv_slot == 11 || inv_slot == 20) {
- if(inv_slot == 2 || inv_slot == 11) {
- if(amount_common < amount_common_max) {
- amount_common++;
- }
- } elseif(inv_slot == 20) {
- if(amount_common > amount_common_min) {
- amount_common--;
- }
- }
- minigame.displayAll(95, string.concat("Common Tasks: §a", string.number(amount_common)));
- inv.setItem(settings_inv, 11, customitem.create("GEAR", 1, string.concat("§rCommon Tasks: ", string.number(amount_common)), null));
- return;
- }
- //long_tasks
- if(inv_slot == 3 || inv_slot == 12 || inv_slot == 21) {
- if(inv_slot == 3 || inv_slot == 12) {
- if(amount_long < amount_long_max) {
- amount_long++;
- }
- } elseif(inv_slot == 21) {
- if(amount_long > amount_long_min) {
- amount_long--;
- }
- }
- minigame.displayAll(94, string.concat("Long Tasks: §a", string.number(amount_long)));
- inv.setItem(settings_inv, 12, customitem.create("GEAR", 1, string.concat("§rLong Tasks: ", string.number(amount_long)), null));
- return;
- }
- //amount_meetings
- if(inv_slot == 4 || inv_slot == 13 || inv_slot == 22) {
- if(inv_slot == 4 || inv_slot == 13) {
- if(amount_meetings < amount_meetings_max) {
- amount_meetings++;
- }
- } elseif(inv_slot == 22) {
- if(amount_meetings > amount_meetings_min) {
- amount_meetings--;
- }
- }
- minigame.displayAll(93, string.concat("Amount Meetings: §a", string.number(amount_meetings)));
- inv.setItem(settings_inv, 13, customitem.create("GEAR", 1, string.concat("§rAmount Meetings: ", string.number(amount_meetings)), null));
- return;
- }
- //meeting_cooldown
- if(inv_slot == 5 || inv_slot == 14 || inv_slot == 23) {
- if(inv_slot == 5 || inv_slot == 14) {
- if(meeting_cooldown < meeting_cooldown_max) {
- meeting_cooldown += 5;
- }
- } elseif(inv_slot == 23) {
- if(meeting_cooldown > meeting_cooldown_min) {
- meeting_cooldown -= 5;
- }
- }
- minigame.displayAll(92, string.concat("Meeting Cooldown: §a", string.number(meeting_cooldown), " s"));
- inv.setItem(settings_inv, 14, customitem.create("GEAR", 1, string.concat("§rMeeting Cooldown: ", string.number(meeting_cooldown)), null));
- return;
- }
- //discuss_time
- if(inv_slot == 6 || inv_slot == 15 || inv_slot == 24) {
- if(inv_slot == 6 || inv_slot == 15) {
- if(discuss_time < discuss_time_max) {
- discuss_time += 5;
- }
- } elseif(inv_slot == 24) {
- if(discuss_time > discuss_time_min) {
- discuss_time -= 5;
- }
- }
- minigame.displayAll(91, string.concat("Discussion Time: §a", string.number(discuss_time), " s"));
- inv.setItem(settings_inv, 15, customitem.create("GEAR", 1, string.concat("§rDiscussion Time: ", string.number(discuss_time)), null));
- return;
- }
- //vote_time
- if(inv_slot == 7 || inv_slot == 16 || inv_slot == 25) {
- if(inv_slot == 7 || inv_slot == 16) {
- if(vote_time < vote_time_max) {
- vote_time += 5;
- }
- } elseif(inv_slot == 25) {
- if(vote_time > vote_time_min) {
- vote_time -= 5;
- }
- }
- minigame.displayAll(90, string.concat("Voting Time: §a", string.number(vote_time), " s"));
- inv.setItem(settings_inv, 16, customitem.create("GEAR", 1, string.concat("§rVoting Time: ", string.number(vote_time)), null));
- return;
- }
- //move_speed
- if(inv_slot == 8 || inv_slot == 17 || inv_slot == 26) {
- if(inv_slot == 8 || inv_slot == 17) {
- if(move_speed < move_speed_max) {
- move_speed += 0.25;
- }
- } elseif(inv_slot == 26) {
- if(move_speed > move_speed_min) {
- move_speed -= 0.25;
- }
- }
- iter = iterator(minigame.getPlayers(script_id));
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- player.setSpeed(p, move_speed);
- }
- minigame.displayAll(89, string.concat("Speed: §a", string.number(move_speed)));
- inv.setItem(settings_inv, 17, customitem.create("GEAR", 1, string.concat("§rSpeed: ", string.number(move_speed)), null));
- return;
- }
- //kill_cooldown
- if(inv_slot == 27 || inv_slot == 36 || inv_slot == 45) {
- if(inv_slot == 27 || inv_slot == 36) {
- if(kill_cooldown < kill_cooldown_max) {
- kill_cooldown++;
- }
- } elseif(inv_slot == 45) {
- if(kill_cooldown > kill_cooldown_min) {
- kill_cooldown--;
- }
- }
- minigame.displayAll(88, string.concat("Kill Cooldown: §a", string.number(kill_cooldown), " s"));
- inv.setItem(settings_inv, 36, customitem.create("GEAR", 1, string.concat("§rKill Cooldown: ", string.number(kill_cooldown)), null));
- return;
- }
- //confirm_ejects
- if(inv_slot == 28 || inv_slot == 37 || inv_slot == 46) {
- if(confirm_ejects) {
- confirm_ejects = false;
- } else {
- confirm_ejects = true;
- }
- minigame.displayAll(87, string.concat("Confirm Ejects: §a", confirm_ejects));
- inv.setItem(settings_inv, 37, customitem.create("GEAR", 1, string.concat("§rConfirm Ejects: ", confirm_ejects), null));
- return;
- }
- return;
- }
- if(title_string == "§cChoose your color") {
- clicked_item = inv.getItem(inv, inv_slot);
- item_name = string.text(item.getName(clicked_item));
- if(string.startsWith(item_name, "§cUsed", 0)) {
- return;
- }
- color = amongus.getPlayerColor(player);
- if(color != null) {
- item.setName(inv.getItem(inv, list.getIndexOf(color_list, color)), text.new(string.concat("§r", string.upperFirstLetter(color))));
- }
- new_color = string.removeFormat(string.toLowerCase(item_name));
- cloth_color = map.get(cloth_code_map, new_color);
- amongus.setPlayerColor(player, new_color);
- item.setName(clicked_item, text.new(string.concat("§cUsed by ", player.getName(player))));
- amongus.equip(player, new_color);
- }
- return;
- }
- if(event == "entity_dismount") {
- if(isPlayer(entity)) {
- leaveSeat(entity);
- }
- return;
- }
- if(event == "player_quit" || event == "player_giveup") {
- leaveSeat(player);
- if(lobby_leader == player.getUuid(player)) {
- list = minigame.getPlayers(script_id);
- if(list.getSize(list) != 0) {
- lobby_leader = list.getIndex(list, 0);
- }
- }
- }
- return;
- @finalstart
- player_list = minigame.getPlayers(script_id);
- air_item = item.getAir();
- lime_glass = item.create("lime_stained_glass_pane", 1, "", null);
- green_glass = item.create("green_stained_glass_pane", 1, "", null);
- red_glass = item.create("red_stained_glass_pane", 1, "", null);
- gray_glass = item.create("gray_stained_glass_pane", 1, "", null);
- black_glass = item.create("black_stained_glass_pane", 1, "", null);
- yellow_glass = item.create("yellow_stained_glass_pane", 1, "", null);
- blue_glass = item.create("blue_stained_glass_pane", 1, "", null);
- cyan_glass = item.create("cyan_stained_glass_pane", 1, "", null);
- light_gray_glass = item.create("light_gray_stained_glass_pane", 1, "", null);
- item.addFlag(light_gray_glass, "HIDE_DESTROYS");
- gosub("init_map_specific");
- progress_bar = boss.create("TOTAL TASKS COMPLETED", "GREEN", "SOLID");
- boss.setProgress(progress_bar, 0);
- meeting_bar = boss.create("Discussion Time", "WHITE", "SOLID"); //Bossbar für Discussion + Voting
- boss.setProgress(meeting_bar, 0);
- sabotage_cooldown_bar = boss.create("Sabotage Cooldown", "PURPLE", "SOLID");
- boss.setProgress(sabotage_cooldown_bar, 0);
- wooden_trapdoors_tag = block.getTag("minecraft:wooden_trapdoors");
- shulker_tag = block.getTag("minecraft:shulker_boxes");
- master_sound_category = sound.getCategory("MASTER");
- kill_sound = sound.get("minecraft:entity.slime.hurt");
- task_sound = sound.get("minecraft:block.note_block.chime");
- vote_sound = sound.get("minecraft:block.note_block.pling");
- vote_ends_sound = sound.get("minecraft:block.note_block.bell");
- crit_sabo_sound = sound.get("minecraft:block.note_block.bell");
- all_list = list.new(); //All players (Ingame + Ghost + Left)
- vote_inv_map = map.new();
- sabo_par_list = list.new();
- ghosts = list.new();
- dead_bodies = list.new();
- roles = map.new();
- player_tasks = map.new();
- task_steps = map.new();
- all_tasks = map.new();
- auto_close_list = list.new();
- auto_close_list_2 = list.new();
- task_part_map = map.new();
- admin_table_map = map.new(); //In welchem Raum befindet sich ein Spieler? (Geister ausgenommen)
- admin_table_map_2 = map.new(); //Wie viele Spieler befinden sich in einem Raum? (Geister ausgenommen)
- impostors_list = list.new(); //Impostors (Ingame + Ghost + Left)
- impostors_list_2 = list.new(); //Impostors (Ingame + Ghost)
- impostors_list_3 = list.new(); //Impostors (Ingame)
- imp_kill_bars = map.new(); //UUID -> Kill Bossbar
- holded_kill_cooldown = map.new();
- report_map = map.new();
- meeting_amounts = map.new();
- removed_perms = list.new(); //Spieler-Uuids, denen Building-Perms entfernt wurden
- gravity_list = list.new();
- short_tasks = list.new();
- list.addAll(short_tasks, 1, 3, 5, 6, 7, 9, 14, 15, 17);
- common_tasks = list.new();
- list.addAll(common_tasks, 10, 11);
- long_tasks = list.new();
- list.addAll(long_tasks, 2, 4, 8, 12, 13, 16);
- amount_done_tasks = 0;
- sabo_list = list.new();
- comms_state_list = list.new();
- comms_fix_list = list.new();
- comms_fix_map = map.new();
- comms_state_map = map.new();
- comms_counter_map = map.new();
- comms_inv_map = map.new();
- oxygen_map = map.new();
- vent_list = list.new();
- vent_map_2 = map.new();
- vent_map_4 = map.new();
- vent_loop = false;
- cam_list = list.new();
- cam_map = map.new();
- cam_map_2 = map.new();
- cam_map_3 = map.new();
- cam_map_4 = map.new();
- align_engine_map = map.new(); //Position des Engine-Outputs für jeden Spieler
- align_engine_map_2 = map.new(); //Dient zur Zuordnung zur Engine-Location bei korrekt ausgerichtetem Engine-Output
- align_le_engine_set = set.new(); //Spieler, die Align-Engine bei Lower-Engine gemacht haben
- align_ue_engine_set = set.new(); //Spieler, die Align-Engine bei Upper-Engine gemacht haben
- submit_scan_list = list.new();
- submit_scan_list_2 = list.new();
- submit_scan_map = map.new();
- submit_scan_map_2 = map.new();
- ast_directions = array.new(8);
- ast_start_pos = list.new();
- ast_start_pos_dirs = map.new();
- clear_ast_list = list.new();
- clear_ast_list_2 = list.new();
- clear_ast_list_3 = list.new();
- clear_ast_map = map.new();
- clear_ast_map_2 = map.new();
- clear_ast_map_3 = map.new();
- fuel_counter = map.new();
- download_counter = map.new();
- download_map = map.new();
- download_map_3 = map.new();
- download_list = list.new();
- download_list_2 = list.new();
- chart_course_counter = map.new();
- chart_course_pattern = map.new();
- manifolds_counter = map.new();
- manifolds_list = list.new();
- manifolds_list_2 = list.new();
- reactor_draw_list_1 = list.new();
- reactor_draw_list_2 = list.new();
- reset_reactor_draw_list = list.new();
- reactor_block_list = list.new();
- reset_reactor_click_list = list.new();
- reset_reactor_click_list_2 = list.new();
- reactor_false_click_list = list.new();
- start_reactor_map = map.new();
- sample_list = list.new();
- sample_list_2 = list.new();
- empty_garb_list = list.new();
- empty_garb_list_2 = list.new();
- empty_garb_map = map.new();
- empty_garb_map_2 = map.new();
- empty_garb_map_3 = map.new();
- sample_map = map.new();
- calibrate_dist_list = list.new();
- calibrate_dist_list_2 = list.new();
- calibrate_dist_map = map.new();
- wires_map = map.new();
- wires_map_2 = map.new();
- wires_map_4 = map.new();
- swipe_card_map = map.new();
- divert_pow_map_3 = map.new();
- clean_o2_map = map.new();
- align_engine_array = array.new(11);
- temp_list = list.new();
- list.addAll(temp_list, 34, 42);
- align_engine_array[0] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 25, 32, 33, 39, 40);
- align_engine_array[1] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 24, 25, 30, 31, 32, 36, 37, 38);
- align_engine_array[2] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 23, 24, 25, 28, 29, 30, 31, 36);
- align_engine_array[3] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 22, 23, 24, 25, 27, 28, 29, 30);
- align_engine_array[4] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 18, 19, 20, 21, 22, 23, 24, 25);
- align_engine_array[5] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 9, 10, 11, 12, 22, 23, 24, 25);
- align_engine_array[6] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 0, 10, 11, 12, 13, 23, 24, 25);
- align_engine_array[7] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 0, 1, 2, 12, 13, 14, 24, 25);
- align_engine_array[8] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 3, 4, 14, 15, 25);
- align_engine_array[9] = temp_list;
- temp_list = list.new();
- list.addAll(temp_list, 6, 16);
- align_engine_array[10] = temp_list;
- calibrate_dist_array = array.new(12);
- calibrate_dist_array[0] = 14;
- calibrate_dist_array[1] = 13;
- calibrate_dist_array[2] = 12;
- calibrate_dist_array[3] = 20;
- calibrate_dist_array[4] = 29;
- calibrate_dist_array[5] = 38;
- calibrate_dist_array[6] = 48;
- calibrate_dist_array[7] = 49;
- calibrate_dist_array[8] = 50;
- calibrate_dist_array[9] = 42;
- calibrate_dist_array[10] = 33;
- calibrate_dist_array[11] = 24;
- wires_list = list.new();
- list.add(wires_list, item.create("blue_stained_glass_pane", 1, "§rBlue Wire", null));
- list.add(wires_list, item.create("green_stained_glass_pane", 1, "§rGreen Wire", null));
- list.add(wires_list, item.create("red_stained_glass_pane", 1, "§rRed Wire", null));
- list.add(wires_list, item.create("yellow_stained_glass_pane", 1, "§rYellow Wire", null));
- garb_items = list.new();
- list.add(garb_items, item.new(material.get("diamond")));
- list.add(garb_items, item.new(material.get("dead_bush")));
- list.add(garb_items, item.new(material.get("rotten_flesh")));
- list.add(garb_items, item.new(material.get("totem_of_undying")));
- list.add(garb_items, item.new(material.get("bone")));
- list.add(garb_items, item.new(material.get("bone_meal")));
- addAstDirection(0, 1, 0); //rechts
- addAstDirection(1, -1, 0); //links
- addAstDirection(2, 0, -1); //oben
- addAstDirection(3, 0, 1); //unten
- addAstDirection(4, 1, -1); //rechts oben
- addAstDirection(5, -1, 1); //links unten
- addAstDirection(6, 1, 1); //rechts unten
- addAstDirection(7, -1, -1); //links oben
- addAstStartPos(0, 6, 6, 6);
- addAstStartPos(1, 3, 5, 6);
- addAstStartPos(2, 3, 5, 6);
- addAstStartPos(3, 3, 5, 6);
- addAstStartPos(4, 3, 5, 6);
- addAstStartPos(5, 3, 5, 6);
- addAstStartPos(6, 3, 5, 6);
- addAstStartPos(7, 3, 5, 6);
- addAstStartPos(8, 5, 5, 5);
- addAstStartPos(9, 0, 4, 6);
- addAstStartPos(17, 1, 5, 7);
- addAstStartPos(18, 0, 4, 6);
- addAstStartPos(26, 1, 5, 7);
- addAstStartPos(27, 0, 4, 6);
- addAstStartPos(35, 1, 5, 7);
- addAstStartPos(36, 0, 4, 6);
- addAstStartPos(44, 1, 5, 7);
- addAstStartPos(45, 4, 4, 4);
- addAstStartPos(46, 2, 4, 7);
- addAstStartPos(47, 2, 4, 7);
- addAstStartPos(48, 2, 4, 7);
- addAstStartPos(49, 2, 4, 7);
- addAstStartPos(50, 2, 4, 7);
- addAstStartPos(51, 2, 4, 7);
- addAstStartPos(52, 2, 4, 7);
- addAstStartPos(53, 7, 7, 7);
- asteroid_item = item.create("BEDROCK", 1, "§rAsteroid", null);
- oak_leaves = item.create("OAK_LEAVES", 1, null, null);
- spruce_leaves = item.create("SPRUCE_LEAVES", 1, null, null);
- birch_leaves = item.create("BIRCH_LEAVES", 1, null, null);
- jungle_leaves = item.create("JUNGLE_LEAVES", 1, null, null);
- acacia_leaves = item.create("ACACIA_LEAVES", 1, null, null);
- dark_oak_leaves = item.create("DARK_OAK_LEAVES", 1, null, null);
- zombie_head = item.create("zombie_head", 1, "", null);
- zombie_head_mat = material.get("ZOMBIE_HEAD");
- player_head_mat = material.get("PLAYER_HEAD");
- redstone_lamp_mat = material.get("REDSTONE_LAMP");
- redstone_torch_mat = material.get("REDSTONE_TORCH");
- stone_button_mat = material.get("STONE_BUTTON");
- gunpowder_mat = material.get("GUNPOWDER");
- lever_mat = material.get("LEVER");
- oak_leaves_mat = material.get("OAK_LEAVES");
- light_gray_glass_mat = material.get("LIGHT_GRAY_STAINED_GLASS_PANE");
- lime_glass_mat = material.get("LIME_STAINED_GLASS_PANE");
- red_glass_mat = material.get("RED_STAINED_GLASS_PANE");
- green_glass_mat = material.get("GREEN_STAINED_GLASS_PANE");
- blue_glass_mat = material.get("BLUE_STAINED_GLASS_PANE");
- black_glass_mat = material.get("BLACK_STAINED_GLASS_PANE");
- space_par = particle.get("END_ROD");
- task_par = particle.get("COMPOSTER");
- cam_par = particle.get("SPELL_WITCH");
- sabo_par = particle.get("SPELL_WITCH");
- imp_par = particle.get("SPELL_WITCH");
- cam_loop = false;
- meeting = false;
- amongus.setAlert(false);
- lights_sabotaged = false;
- comms_sabotaged = false;
- reactor_sabotaged = false;
- oxygen_sabotaged = false;
- reactor_used = false;
- lights_inv = inv.new("202020202", text.new("§cFix Lights"));
- reactor_inv_1 = inv.new("222222222222222222222222222222222222222222222222222222", text.new("§cPRESS TO STOP MELTDOWN"));
- reactor_inv_2 = inv.new("222222222222222222222222222222222222222222222222222222", text.new("§cPRESS TO STOP MELTDOWN"));
- sabotage.holdReactor(reactor_inv_1, false);
- sabotage.holdReactor(reactor_inv_2, false);
- reactor_hold_list_1 = list.new();
- reactor_hold_list_2 = list.new();
- common_tasks_2 = list.new();
- for(i = 0; i < amount_common; i++) {
- index = math.random(0, list.getSize(common_tasks) - 1);
- id = list.getIndex(common_tasks, index);
- list.add(common_tasks_2, id);
- }
- registerTask(1, 97, "STO", "Fuel Engines", 4);
- registerTask(2, 96, "[Room]", "Download Data", 2);
- registerTask(3, 95, "SHI", "Prime Shields", 1);
- registerTask(4, 94, "REA", "Start Reactor", 1);
- registerTask(5, 93, "REA", "Unlock Manifolds", 1);
- registerTask(6, 92, "NAV", "Chart Course", 1);
- registerTask(7, 91, "NAV", "Stabilize Steering", 1);
- registerTask(8, 90, "MED", "Inspect Sample", 1);
- registerTask(9, 89, "ELE", "Calibrate Distributor", 1);
- registerTask(10, 88, "CAF", "Fix Wiring", 3);
- registerTask(11, 87, "ADM", "Swipe Card", 1);
- registerTask(12, 86, "CAF", "Empty Garbage", 2);
- registerTask(13, 85, "WEA", "Clear Asteroids", 20);
- registerTask(14, 84, "ELE", "Divert Power to [Room]", 2);
- registerTask(15, 83, "O2", "Clean O2 Filter", 1);
- registerTask(16, 82, "MED", "Submit Scan", 1);
- registerTask(17, 81, "UE/LE", "Align Engine", 2);
- player_list_size = list.getSize(player_list);
- if(player_list_size < 6) {
- amount_impostors = 1;
- }
- imps = set.new();
- for(i = 0; i < amount_impostors; i++) {
- index = math.random(0, player_list_size - 1);
- while(set.contains(imps, index)) {
- index = math.random(0, player_list_size - 1);
- }
- set.add(imps, index);
- }
- if(player_list_size == 1) {
- amount_all_tasks = 17;
- amount_all_tasks_per_player = amount_all_tasks;
- freeplay = true;
- minigame.setSingleplayer();
- } else {
- amount_crew = player_list_size - amount_impostors;
- amount_all_tasks_per_player = amount_short + amount_common + amount_long;
- amount_all_tasks = amount_all_tasks_per_player * amount_crew;
- freeplay = false;
- }
- for(i = 0; i < player_list_size; i++) {
- p_uuid = list.getIndex(player_list, i);
- p = player.get(p_uuid);
- if(amount_impostors > 1) {
- msg.prefix(p, gamename, string.concat("There are §c", string.number(amount_impostors), " Impostors §ramong us."));
- } else {
- msg.prefix(p, gamename, string.concat("There is §c", string.number(amount_impostors), " Impostor §ramong us."));
- }
- entity.teleport(p, list.getIndex(spawn_locs, i));
- sound.spawnForPlayer(p, pling_sound, sound_category_ambient);
- player.setGamemode(p, "SURVIVAL");
- player.setFly(p, false);
- }
- for(h = 0; h < player_list_size; h++) {
- p_uuid = list.getIndex(player_list, h);
- p = player.get(p_uuid);
- list.add(all_list, p_uuid);
- boss.addPlayer(progress_bar, p);
- data.setTimer(p, "Meeting Cooldown", $meeting_cooldown * 20);
- player.setSpeed(p, move_speed);
- map.add(meeting_amounts, p_uuid, amount_meetings);
- player.clearInventory(p);
- player.giveItem(p, item.new(material.get("MAP")));
- inv.close(p);
- player.gameMute(p, true);
- living.setInvisible(p, true);
- //Building-Perms entfernen
- if(perm.has("plot.bypass", p)) {
- //PERMS perm.unregisterPlayer(p_uuid, 1);
- //PERMS perm.unregisterPlayer(p_uuid, 15);
- list.add(removed_perms, p_uuid);
- }
- //Farbe zuweisen bzw. erneut forcen
- color = amongus.getPlayerColor(p);
- if(color == null) {
- iter = iterator(color_list);
- while(hasNext(iter)) {
- color = next(iter);
- if(!amongus.isUsedPlayerColor(color)) {
- amongus.setPlayerColor(p, color);
- amongus.equip(p, color);
- break;
- }
- }
- } else {
- amongus.equip(p, color);
- }
-
- sb.clearGame(p);
- sb.add(p, 79, sb.getSpacer());
- if(freeplay) {
- setSpeedrunner(p);
- giveTask(p, 1, "STO", "Fuel Engines", 0, 4, null);
- giveTask(p, 2, "[Room]", "Download Data", 0, 2, null);
- giveTask(p, 3, "SHI", "Prime Shields", 0, 1, null);
- giveTask(p, 4, "REA", "Start Reactor", 0, 1, null);
- giveTask(p, 5, "REA", "Unlock Manifolds", 0, 1, null);
- giveTask(p, 6, "NAV", "Chart Course", 0, 1, null);
- giveTask(p, 7, "NAV", "Stabilize Steering", 0, 1, null);
- giveTask(p, 8, "MED", "Inspect Sample", 0, 1, null);
- giveTask(p, 9, "ELE", "Calibrate Distributor", 0, 1, null);
- giveTask(p, 10, "CAF", "Fix Wiring", 0, 3, null);
- giveTask(p, 11, "ADM", "Swipe Card", 0, 1, null);
- giveTask(p, 12, "CAF", "Empty Garbage", 0, 2, null);
- giveTask(p, 13, "WEA", "Clear Asteroids", 0, 20, null);
- giveTask(p, 14, "ELE", "Divert Power to [Room]", 0, 2, null);
- giveTask(p, 15, "O2", "Clean O2 Filter", 0, 1, null);
- giveTask(p, 16, "MED", "Submit Scan", 0, 1, null);
- giveTask(p, 17, "UE/LE", "Align Engine", 0, 2, null);
- } else {
- if(set.contains(imps, h)) {
- setImpostor(p);
- } else {
- setCrewmate(p);
- }
- for(i = 0; i < list.getSize(common_tasks_2); i++) {
- id = list.getIndex(common_tasks_2, i);
- a = map.get(all_tasks, id);
- giveTask(p, id, a[0], a[1], a[2], a[3], null);
- }
- i = 0;
- while(i != amount_short) {
- index = math.random(0, list.getSize(short_tasks) - 1);
- id = list.getIndex(short_tasks, index);
- if(hasTask(p, id)) {
- continue;
- }
- i++;
- a = map.get(all_tasks, id);
- giveTask(p, id, a[0], a[1], a[2], a[3], null);
- }
- i = 0;
- while(i != amount_long) {
- index = math.random(0, list.getSize(long_tasks) - 1);
- id = list.getIndex(long_tasks, index);
- if(hasTask(p, id)) {
- continue;
- }
- i++;
- a = map.get(all_tasks, id);
- giveTask(p, id, a[0], a[1], a[2], a[3], null);
- }
- }
- }
- if(freeplay) {
- starttime = time.getMillis();
- } else {
- imp_string = "";
- iter = iterator(impostors_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p_name = player.getName(p_uuid);
- if(imp_string == "") {
- imp_string = p_name;
- } else {
- imp_string = string.concat(imp_string, ", ", amongus.getPlayerColorCode(p_uuid), p_name);
- }
- }
- for(i = 0; i < list.getSize(impostors_list); i++) {
- p_uuid = list.getIndex(impostors_list, i);
- p = player.get(p_uuid);
- map.remove(player_tasks, p_uuid);
- msg.prefix(p, gamename, string.concat("§4Impostors: §r", imp_string));
- }
- }
- setSaboCooldown(default_sabo_cooldown);
- event.unload("entity_dismount");
- event.load("chat");
- event.load("player_move");
- event.load("inv_click");
- event.load("inv_close");
- event.load("player_data_tick");
- sgoto(10, "space_loop");
- sgoto(10, "task_part_loop");
- sgoto(5, "imp_par_loop");
- sbtoggle = false;
- if(amount_all_tasks_per_player > 8) {
- sbtoggle = true;
- sgoto(100, "scoreboard_toggler");
- }
- switchLights(true);
- goto("loop");
- @checkgame
- wait();
- if(event == "entity_damage") {
- if(isPlayer(entity)) {
- //damaged entity is a player
- damaged_player = entity;
- if(player.hasMinigameId(damaged_player, script_id)) {
- cancel = true;
- }
- attacker = player.getFromDamageSource(damage_source);
- if(attacker == null) {
- goto("checkgame");
- }
- if(!isPlayer(attacker)) {
- goto("checkgame");
- }
- if(!player.hasMinigameId(attacker, script_id)) {
- goto("checkgame");
- }
- if(!isImpostor(attacker)) {
- goto("checkgame");
- }
- //kill crewmate
- item = living.getHand(attacker);
- if(item != kill_item) {
- goto("checkgame");
- }
- cooldown = data.getTimer(attacker, "Kill Cooldown");
- if(cooldown == null || cooldown == -1) {
- if(!player.isOnCam(damaged_player) && !player.isGhost(damaged_player)) {
- if(isCrewmate(damaged_player)) {
- killCrewmate(attacker, damaged_player);
- goto("checkwin");
- }
- msg.prefix(attacker, gamename, "Not a crewmate.");
- goto("checkgame");
- }
- } else {
- msg.prefix(attacker, gamename, string.concat("Remaining kill cooldown: ", string.number(math.roundDown(cooldown / 20)), "s"));
- }
- goto("checkgame");
- }
- //damaged entity is not a player
- attacker = player.getFromDamageSource(damage_source);
- if(attacker == null) {
- goto("checkgame");
- }
- if(player.hasMinigameId(attacker, script_id)) {
- cancel = true;
- }
- //report body
- if(entity.getType(entity) == "zombie") {
- if(player.isGhost(attacker)) {
- goto("checkgame");
- }
- found_player_uuid = map.get(report_map, entity);
- if(found_player_uuid == null) {
- entity.remove(entity);
- msg.prefix(attacker, gamename, "Defect entity removed.");
- goto("checkgame");
- }
- reportBody(attacker, found_player_uuid);
- }
- //kill crewmate at cam
- if(isCitizen(entity)) {
- item = living.getHand(attacker);
- if(item != kill_item) {
- goto("checkgame");
- }
- cooldown = data.getTimer(attacker, "Kill Cooldown");
- if(cooldown == null || cooldown == -1) {
- p_uuid = map.get(cam_map_4, entity);
- if(p_uuid == null) {
- citizen.destroy(entity);
- msg.prefix(attacker, gamename, "Defect entity removed.");
- goto("checkgame");
- }
- p = player.get(p_uuid);
- if(isCrewmate(p)) {
- cam.leave(p);
- killCrewmate(attacker, p);
- goto("checkwin");
- }
- msg.prefix(attacker, gamename, "Not a crewmate.");
- } else {
- msg.prefix(attacker, gamename, string.concat("Remaining kill cooldown: ", string.number(math.roundDown(cooldown / 20)), "s"));
- }
- }
- goto("checkgame");
- }
- if(player.hasMinigameId(player, script_id)) {
- ignoreGoto(event);
- }
- goto("checkgame");
- @chat
- cancel = true;
- if(player.isGhost(player)) {
- iter = iterator(ghosts);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- if(!list.contains(player_list, p_uuid)) {
- continue;
- }
- p = player.get(p_uuid);
- msg.prefix(p, string.concat("Ghost ", amongus.getPlayerColorCode(player), player.getName(player)), message);
- }
- goto("checkgame");
- }
- if(meeting) {
- minigame.speakAll(string.concat(amongus.getPlayerColorCode(player), player.getName(player)), message);
- }
- goto("checkgame");
- @player_move
- player_uuid = player.getUuid(player);
- player.action(player, text.new(map.getOrDefault(move_id_map, id, "")));
- if(player.isOnCam(player)) {
- goto("checkgame");
- }
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- old_room_id = map.getOrDefault(admin_table_map, player_uuid, "");
- if(old_room_id != id) {
- map.add(admin_table_map, player_uuid, id);
- //Neuer Raum
- amount_players = map.getOrDefault(admin_table_map_2, id, 0) + 1;
- map.add(admin_table_map_2, id, amount_players);
- amongus.updateAdminTable(id, amount_players);
- //Alter Raum
- amount_players = map.getOrDefault(admin_table_map_2, old_room_id, 0) - 1;
- map.add(admin_table_map_2, old_room_id, amount_players);
- amongus.updateAdminTable(old_room_id, amount_players);
- }
- goto("checkgame");
- function amongus.setMeeting(bool) {
- $meeting = bool;
- }
- function amongus.isMeeting() {
- return $meeting;
- }
- function amongus.manageEffects(player) {
- living.clearEffects(player);
- if(amongus.isMeeting()) {
- time = $discuss_time * 20 + $vote_time * 20;
- living.addEffect(player, "JUMP", time, 128, false);
- living.addEffect(player, "SLOW", time, 6, false);
- return;
- }
- if(player.isGhost(player)) {
- living.addEffect(player, "NIGHT_VISION", 999999, 0, false);
- return;
- }
- if(player.isOnCam(player)) {
- living.addEffect(player, "NIGHT_VISION", 999999, 0, false);
- return;
- }
- if($lights_sabotaged) {
- if(isImpostor(player)) {
- living.addEffect(player, "NIGHT_VISION", 999999, 0, false);
- } else {
- living.addEffect(player, "BLINDNESS", 999999, 0, false);
- }
- return;
- }
- }
- function amongus.updateAdminTable(room_id, amount_players) {
- if(amount_players == 0) {
- if(room_id == $move_id_le) {
- inv.setItem($admin_table_inv, 37, item.create("blue_stained_glass_pane", 1, "§rLower Engine", null));
- } elseif(room_id == $move_id_sec) {
- inv.setItem($admin_table_inv, 20, item.create("blue_stained_glass_pane", 1, "§rSecurity", null));
- } elseif(room_id == $move_id_ue) {
- inv.setItem($admin_table_inv, 1, item.create("blue_stained_glass_pane", 1, "§rUpper Engine", null));
- } elseif(room_id == $move_id_reac) {
- inv.setItem($admin_table_inv, 18, item.create("blue_stained_glass_pane", 1, "§rReactor", null));
- } elseif(room_id == $move_id_o2) {
- inv.setItem($admin_table_inv, 15, item.create("blue_stained_glass_pane", 1, "§rO2", null));
- } elseif(room_id == $move_id_navi) {
- inv.setItem($admin_table_inv, 26, item.create("blue_stained_glass_pane", 1, "§rNavigation", null));
- } elseif(room_id == $move_id_weap) {
- inv.setItem($admin_table_inv, 7, item.create("blue_stained_glass_pane", 1, "§rWeapons", null));
- } elseif(room_id == $move_id_shie) {
- inv.setItem($admin_table_inv, 43, item.create("blue_stained_glass_pane", 1, "§rShields", null));
- } elseif(room_id == $move_id_comm) {
- inv.setItem($admin_table_inv, 51, item.create("blue_stained_glass_pane", 1, "§rCommunications", null));
- } elseif(room_id == $move_id_stor1 || room_id == $move_id_stor2) {
- inv.setItem($admin_table_inv, 41, item.create("blue_stained_glass_pane", 1, "§rStorage", null));
- } elseif(room_id == $move_id_elec1 || room_id == $move_id_elec2) {
- inv.setItem($admin_table_inv, 30, item.create("blue_stained_glass_pane", 1, "§rElectrical", null));
- } elseif(room_id == $move_id_med1 || room_id == $move_id_med2) {
- inv.setItem($admin_table_inv, 12, item.create("blue_stained_glass_pane", 1, "§rMedBay", null));
- } elseif(room_id == $move_id_cafe) {
- inv.setItem($admin_table_inv, 5, item.create("blue_stained_glass_pane", 1, "§rCafeteria", null));
- } elseif(room_id == $move_id_admin) {
- inv.setItem($admin_table_inv, 24, item.create("blue_stained_glass_pane", 1, "§rAdmin", null));
- }
- } else {
- if(room_id == move_id_le) {
- inv.setItem($admin_table_inv, 37, item.create("sticky_piston", amount_players, "§rLower Engine", null));
- } elseif(room_id == $move_id_sec) {
- inv.setItem($admin_table_inv, 20, item.create("observer", amount_players, "§rSecurity", null));
- } elseif(room_id == $move_id_ue) {
- inv.setItem($admin_table_inv, 1, item.create("sticky_piston", amount_players, "§rUpper Engine", null));
- } elseif(room_id == $move_id_reac) {
- inv.setItem($admin_table_inv, 18, item.create("tnt", amount_players, "§rReactor", null));
- } elseif(room_id == $move_id_o2) {
- inv.setItem($admin_table_inv, 15, item.create("kelp", amount_players, "§rO2", null));
- } elseif(room_id == $move_id_navi) {
- inv.setItem($admin_table_inv, 26, item.create("compass", amount_players, "§rNavigation", null));
- } elseif(room_id == $move_id_weap) {
- sword_item = item.create("golden_sword", amount_players, "§rWeapons", null);
- item.addFlag(sword_item, "HIDE_ATTRIBUTES");
- inv.setItem($admin_table_inv, 7, sword_item);
- } elseif(room_id == $move_id_shie) {
- inv.setItem($admin_table_inv, 43, item.create("shield", amount_players, "§rShields", null));
- } elseif(room_id == $move_id_comm) {
- inv.setItem($admin_table_inv, 51, item.create("end_rod", amount_players, "§rCommunications", null));
- } elseif(room_id == $move_id_stor1 || room_id == $move_id_stor2) {
- inv.setItem($admin_table_inv, 41, item.create("red_shulker_box", amount_players, "§rStorage", null));
- } elseif(room_id == $move_id_elec1 || room_id == $move_id_elec2) {
- inv.setItem($admin_table_inv, 30, item.create("redstone", amount_players, "§rElectrical", null));
- } elseif(room_id == $move_id_med1 || room_id == $move_id_med2) {
- inv.setItem($admin_table_inv, 12, customitem.create("PLUS_RED", amount_players, "§rMedBay", null));
- } elseif(room_id == $move_id_cafe) {
- inv.setItem($admin_table_inv, 5, item.create("cake", amount_players, "§rCafeteria", null));
- } elseif(room_id == $move_id_admin) {
- inv.setItem($admin_table_inv, 24, item.create("lectern", amount_players, "§rAdmin", null));
- }
- }
- }
- @block_click
- if(slot.isOffHand(hand)) {
- goto("checkgame");
- }
- if(action != "RIGHT_CLICK_BLOCK" && action != "RIGHT_CLICK_AIR") {
- goto("checkgame");
- }
- if(block != null) {
- if(block.hasTag(block, shulker_tag)) {
- cancel = true;
- goto("checkgame");
- }
- if(block.hasTag(block, wooden_trapdoors_tag)) {
- cancel = true;
- goto("checkgame");
- }
- }
- player_uuid = player.getUuid(player);
- item = living.getHand(player);
- //sabotage
- if(item == sabotage_item) {
- inv.open(sabotage_menu, player);
- goto("checkgame");
- }
- //vents
- if(list.contains(vent_list, player_uuid)) {
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- //leave vent
- if(item == leave_vent_item) {
- vent_leave(player);
- }
- //vent button 1
- inv_slot = getInvSlotFromItem(player, item);
- if(inv_slot == 6) {
- vent_loc = map.get(vent_map_4, player_uuid);
- a = map.get($vent_map_3, vent_loc);
- vent_loc_1 = a[1];
- if(vent_loc_1 != null) {
- vent_enter(player, vent_loc_1);
- }
- } elseif(inv_slot == 7) {
- //vent button 2
- vent_loc = map.get(vent_map_4, player_uuid);
- a = map.get($vent_map_3, vent_loc);
- vent_loc_2 = a[3];
- if(vent_loc_2 != null) {
- vent_enter(player, vent_loc_2);
- }
- }
- goto("checkgame");
- }
- //cams
- if(player.isOnCam(player)) {
- cam_number = map.get(cam_map, player_uuid);
- number_of_cams = set.getSize(cams_locs);
- if(item == prev_cam_item) {
- cam_number--;
- if(cam_number < 0) {
- cam_number = number_of_cams - 1;
- }
- } elseif(item == next_cam_item) {
- cam_number++;
- if(cam_number >= number_of_cams) {
- cam_number = 0;
- }
- } elseif(item == leave_cam_item) {
- cam.leave(player);
- } else {
- goto("checkgame");
- }
- map.add(cam_map, player_uuid, cam_number);
- goto("checkgame");
- }
- //meeting
- if(meeting) {
- if(item == open_vote_menu_item) {
- if(data.getTimer(player, "Discussion Time") < 0) {
- vote_inv = getVoteInv(player);
- inv.open(vote_inv, player);
- }
- }
- goto("checkgame");
- }
- //ONLY RIGHT_CLICK_BLOCK
- if(action != "RIGHT_CLICK_BLOCK") {
- goto("checkgame");
- }
- block_loc = block.getLocation(block);
- //enter vent
- if(list.contains(all_vent_locs, block_loc)) {
- if(isCrewmate(player)) {
- goto("checkgame");
- }
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- cooldown = data.getTimer(player, "Kill Cooldown");
- map.add(holded_kill_cooldown, player_uuid, cooldown);
- vent_enter(player, block_loc);
- goto("checkgame");
- }
- if(set.contains(cams_locs, block_loc)) {
- cam_number = 0;
- player_uuid = player.getUuid(player);
- map.add(cam_map, player_uuid, cam_number);
- player_loc = entity.getLocation(player);
- map.add(cam_map_2, player_uuid, player_loc);
- if(!player.isGhost(player)) {
- ent = citizen.spawn(player_loc, player.getName(player));
- map.add(cam_map_3, player_uuid, ent);
- map.add(cam_map_4, ent, player_uuid);
- citizen.setName(ent, "");
- citizen.showNameplate(ent, false);
- color = amongus.getPlayerColor(player);
- amongus.equipCitizen(ent, color, player);
- }
- cam.enter(player);
- goto("checkgame");
- }
- if(set.contains(med_scan_locs, block_loc)) {
- task_id = 16;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- if(loc.distance(entity.getLocation(player), block_loc) > 3) {
- msg.prefix(player, gamename, "Get closer.");
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- inv = inv.new("000000000000000000000000000000000000000000000000000000", text.new("§cSubmit Scan"));
- for(i = 0; i < 54; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.setItem(inv, 13, player.getHead(player_uuid, player.getName(player)));
- color = amongus.getPlayerColor(player);
- color_code = map.get(cloth_code_map, color);
- item = read.item(string.concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- inv.setItem(inv, 22, item);
- item = read.item(string.concat("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- inv.setItem(inv, 31, item);
- item = read.item(string.concat("{id:\"minecraft:leather_boots\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- inv.setItem(inv, 40, item);
- inv.open(inv, player);
- list.add(submit_scan_list, player_uuid);
- map.add(submit_scan_map, player_uuid, 0);
- map.add(submit_scan_map_2, player_uuid, inv);
- sgoto(20, "submit_scan");
- goto("checkgame");
- }
- if(set.contains(clear_ast_locs, block_loc)) {
- task_id = 13;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 20) {
- goto("checkgame");
- }
- //inv = inv.new("222222222 222222222 222222222 222222222 222222222 222222222");
- inv = inv.new("222222222222222222222222222222222222222222222222222222", text.new("§cClear Asteroids"));
- a = array.new(7);
- a[0] = inv;
- slot = list.getIndex(ast_start_pos, math.random(0, 25));
- a[1] = slot;
- inv.setItem(inv, slot, asteroid_item);
- inv.open(inv, player);
- b = getAstDirection(slot);
- a[2] = b[0]; //x_dir
- a[3] = b[1]; //y_dir
- a[4] = false; //reached end
- a[5] = math.random(1, 2); //speed
- a[6] = 0; //speed counter
- my_list = list.new();
- list.add(my_list, a);
- player_uuid = player.getUuid(player);
- map.add(clear_ast_map, player_uuid, my_list);
- map.add(clear_ast_map_2, player_uuid, 0);
- map.add(clear_ast_map_3, player_uuid, inv);
- if(list.getSize(clear_ast_list) == 0) {
- sgoto(5, "clear_ast");
- }
- list.add(clear_ast_list, player_uuid);
- goto("checkgame");
- }
- if(set.contains(inspect_sample_locs, block_loc)) {
- task_id = 8;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- inv = map.get(sample_map, player_uuid);
- if(inv == null) {
- sample = item.create("white_stained_glass_pane", 1, "§rSample", null);
- //inv = inv.new("000000000 000000000 000000000 000000000 202020202 000000002");
- inv = inv.new("000000000000000000000000000000000000202020202000000002", text.new("§cInspect Sample"));
- for(i = 0; i < 54; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- h = 0;
- for(i = 0; i < 3; i++) {
- inv.setItem(inv, 0 + h, sample);
- inv.setItem(inv, 2 + h, sample);
- inv.setItem(inv, 4 + h, sample);
- inv.setItem(inv, 6 + h, sample);
- inv.setItem(inv, 8 + h, sample);
- h += 9;
- }
- select_sample = item.create("gray_stained_glass_pane", 1, "§rSelect sample", null);
- inv.setItem(inv, 36, select_sample);
- inv.setItem(inv, 38, select_sample);
- inv.setItem(inv, 40, select_sample);
- inv.setItem(inv, 42, select_sample);
- inv.setItem(inv, 44, select_sample);
- inv.setItem(inv, 53, item.create("green_stained_glass_pane", 1, "§rPress to start", null));
- }
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == admin_table_loc) {
- if(comms_sabotaged) {
- msg.prefix(player, gamename, "Communications disabled.");
- goto("checkgame");
- }
- inv.open(admin_table_inv, player);
- goto("checkgame");
- }
- if(block_loc == ue_align_loc || block_loc == le_align_loc) {
- task_id = 17;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 2) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- if(block_loc == ue_align_loc && set.contains(align_ue_engine_set, player_uuid)) {
- goto("checkgame");
- }
- if(block_loc == le_align_loc && set.contains(align_le_engine_set, player_uuid)) {
- goto("checkgame");
- }
- //inv = inv.new("000000002 000000000 000000000 000000000 000000002");
- inv = inv.new("000000002000000000000000000000000000000000002", text.new("§cAlign Engine"));
- for(i = 18; i < 27; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.setItem(inv, 8, item_arrow_up);
- inv.setItem(inv, 44, item_arrow_down);
- inv.setItem(inv, 26, green_glass);
- inv.open(inv, player);
- pos = math.random(0, 10);
- while(pos == 5) {
- pos = math.random(0, 10);
- }
- map.add(align_engine_map, player_uuid, pos);
- map.add(align_engine_map_2, player_uuid, block_loc);
- set_engine(player, inv, null);
- goto("checkgame");
- }
- if(block_loc == clean_o2_loc) {
- task_id = 15;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- //inv = inv.new("022222222 022222222 222222222 222222222 022222222 022222222");
- inv = inv.new("022222222022222222222222222222222222022222222022222222", text.new("§cClean O2 Filter"));
- for(i = 1; i < 54; i++) {
- if(i == 9 || i == 36 || i == 45) {
- continue;
- }
- inv.setItem(inv, i, light_gray_glass);
- }
- for(i = 0; i < 6; i++) {
- slot = math.random(1, 53);
- while(slot % 9 == 0 || inv.getItem(inv, slot) != light_gray_glass) {
- slot = math.random(1, 53);
- }
- inv.setItem(inv, slot, item.create("oak_leaves", 1, null, null));
- if(slot < 18) {
- if(item.getType(inv.getItem(inv, slot + 9)) == light_gray_glass_mat) {
- inv.setItem(inv, slot + 9, item_arrow_down);
- continue;
- }
- }
- if(slot > 36) {
- if(item.getType(inv.getItem(inv, slot - 9)) == light_gray_glass_mat) {
- inv.setItem(inv, slot - 9, item_arrow_up);
- continue;
- }
- }
- if(item.getType(inv.getItem(inv, slot - 1)) == light_gray_glass_mat) {
- inv.setItem(inv, slot - 1, item_arrow_left);
- }
- }
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == elec_power_loc) {
- task_id = 14;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step != 0) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 000000000 000000000 000000000 222222220 000000000");
- inv = inv.new("000000000000000000000000000000000000222222220000000000", text.new("§cDivert Power"));
- gunpowder = item.create("GUNPOWDER", 1, null, null);
- inv.setItem(inv, 4, gunpowder);
- for(i = 11; i < 16; i++) {
- inv.setItem(inv, i, gunpowder);
- }
- for(i = 19; i < 26; i++) {
- inv.setItem(inv, i, gunpowder);
- }
- for(i = 27; i < 36; i++) {
- inv.setItem(inv, i, gunpowder);
- }
- for(i = 36; i < 45; i++) {
- inv.setItem(inv, i, item.create("LEVER", 1, map.get(divert_pow_map, i), null));
- }
- r = map.get(divert_pow_map_3, player.getUuid(player));
- inv.setItem(inv, r, item.create("REDSTONE_TORCH", 1, map.get(divert_pow_map, r), null));
- inv.open(inv, player);
- goto("checkgame");
- }
- r = map.get(divert_pow_map_3, player.getUuid(player));
- if(r != null && block_loc == map.get(divert_pow_map_2, r)) {
- task_id = 14;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step != 1) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 000000000 000000000 000020000 002002002 220000220");
- inv = inv.new("002200002220200220020202002222222220002002002220000220", text.new("§cDivert Power"));
- gunpowder = item.create("gunpowder", 1, null, null);
- redstone = item.create("redstone", 1, null, null);
- inv.setItem(inv, 2, redstone);
- inv.setItem(inv, 3, redstone);
- inv.setItem(inv, 8, gunpowder);
- inv.setItem(inv, 9, redstone);
- inv.setItem(inv, 10, redstone);
- inv.setItem(inv, 12, redstone);
- inv.setItem(inv, 15, gunpowder);
- inv.setItem(inv, 16, gunpowder);
- inv.setItem(inv, 19, redstone);
- inv.setItem(inv, 21, redstone);
- inv.setItem(inv, 23, gunpowder);
- inv.setItem(inv, 26, gunpowder);
- inv.setItem(inv, 27, redstone);
- inv.setItem(inv, 28, redstone);
- inv.setItem(inv, 29, redstone);
- inv.setItem(inv, 30, redstone);
- inv.setItem(inv, 31, item.create("stone_button", 1, "§rConnect Grids", null));
- inv.setItem(inv, 32, gunpowder);
- inv.setItem(inv, 33, gunpowder);
- inv.setItem(inv, 34, gunpowder);
- inv.setItem(inv, 38, redstone);
- inv.setItem(inv, 41, gunpowder);
- inv.setItem(inv, 44, gunpowder);
- inv.setItem(inv, 45, redstone);
- inv.setItem(inv, 46, redstone);
- inv.setItem(inv, 51, gunpowder);
- inv.setItem(inv, 52, gunpowder);
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == cafe_garb_loc || block_loc == o2_garb_loc) {
- cancel = true;
- task_id = 12;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step != 0) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- r = map.get(empty_garb_map_3, player_uuid);
- if(r == 0 && block_loc == o2_garb_loc) {
- goto("checkgame");
- }
- if(r == 1 && block_loc == cafe_garb_loc) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 000000000 000000000 000000000 000000002 000000000");
- inv = inv.new("000000000000000000000000000000000000000000002000000000", text.new("§cEmpty Garbage"));
- for(i = 1; i < 8; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- i = 10;
- for(row = 1; row < 6; row++) {
- for(col = 0; col < 7; col++) {
- r = math.random(1, 6);
- if(r == 1) {
- leaves_item = oak_leaves;
- } elseif(r == 2) {
- leaves_item = spruce_leaves;
- } elseif(r == 3) {
- leaves_item = birch_leaves;
- } elseif(r == 4) {
- leaves_item = jungle_leaves;
- } elseif(r == 5) {
- leaves_item = acacia_leaves;
- } else {
- leaves_item = dark_oak_leaves;
- }
- inv.setItem(inv, i, leaves_item);
- i++;
- }
- i += 2;
- }
- inv.setItem(inv, 44, customitem.create("ARROW_DOWN", 1, "§rEmpty Garbage", null));
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == stor_garb_loc) {
- cancel = true;
- task_id = 12;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step != 1) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 000000000 000000000 000000000 000000002 000000000");
- inv = inv.new("000000000000000000000000000000000000000000002000000000", text.new("§cEmpty Garbage"));
- for(i = 1; i < 8; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- i = 10;
- for(row = 1; row < 6; row++) {
- for(col = 0; col < 7; col++) {
- r = math.random(1, 6);
- if(r == 1) {
- leaves_item = oak_leaves;
- } elseif(r == 2) {
- leaves_item = spruce_leaves;
- } elseif(r == 3) {
- leaves_item = birch_leaves;
- } elseif(r == 4) {
- leaves_item = jungle_leaves;
- } elseif(r == 5) {
- leaves_item = acacia_leaves;
- } else {
- leaves_item = dark_oak_leaves;
- }
- inv.setItem(inv, i, leaves_item);
- i++;
- }
- i += 2;
- }
- list.shuffle(garb_items);
- inv.setItem(inv, math.random(10, 16), list.getIndex(garb_items, 0));
- inv.setItem(inv, math.random(19, 25), list.getIndex(garb_items, 1));
- inv.setItem(inv, math.random(37, 43), list.getIndex(garb_items, 2));
- inv.setItem(inv, 44, customitem.create("ARROW_DOWN", 1, "§rEmpty Garbage", null));
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == swipe_card_loc) {
- task_id = 11;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 002222200 000000000");
- inv = inv.new("000000000003333320000000000", text.new("§cSwipe Card"));
- for(i = 11; i < 16; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == calibrate_dist_loc) {
- task_id = 9;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 000000000 000000000 000000000 000000002 000000000");
- inv = inv.new("000000000000000000000000000000000000000000002000000000", text.new("§cCalibrate Distributor"));
- for(i = 0; i < 54; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.setItem(inv, 3, customitem.create("CROSS_RED", 1, null, null));
- inv.setItem(inv, 4, customitem.create("CROSS_RED", 1, null, null));
- inv.setItem(inv, 5, customitem.create("CROSS_RED", 1, null, null));
- for(i = 0; i < 12; i++) {
- inv.setItem(inv, calibrate_dist_array[i], black_glass);
- }
- inv.setItem(inv, 34, yellow_glass);
- inv.setItem(inv, 35, yellow_glass);
- inv.setItem(inv, 44, customitem.create("MINUS_GREEN", 1, "§rPress", null));
- inv.open(inv, player);
- start_index = math.random(0, 8);
- a = array.new(5);
- player_uuid = player.getUuid(player);
- a[0] = player_uuid;
- a[1] = inv;
- a[2] = start_index;
- a[3] = start_index; //index
- a[4] = 0; //stage
- list.add(calibrate_dist_list, player_uuid);
- map.add(calibrate_dist_map, player_uuid, a);
- sgoto(7, "calibrate_dist");
- goto("checkgame");
- }
- if(block_loc == steering_loc) {
- task_id = 7;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- //inv = inv.new("222222222 222222222 222222222 222222222 222222222");
- inv = inv.new("222222222222222222222222222222222222222222222", text.new("§cStabilize Steering"));
- for(i = 0; i < 45; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.setItem(inv, 22, customitem.create("PLUS_RED", 1, null, null));
- r = math.random(0, 3);
- if(r == 0) {
- slot = 6;
- slot_left = 5;
- slot_right = 7;
- slot_down = 15;
- slot_up = -1;
- } elseif(r == 1) {
- slot = 9;
- slot_left = -1;
- slot_right = 10;
- slot_down = 18;
- slot_up = 0;
- } elseif(r == 2) {
- slot = 28;
- slot_left = 27;
- slot_right = 29;
- slot_down = 37;
- slot_up = 19;
- } else {
- slot = 35;
- slot_left = 34;
- slot_right = -1;
- slot_down = 44;
- slot_up = 26;
- }
- if(slot_left != -1) {
- inv.setItem(inv, slot_left, item_arrow_left);
- }
- if(slot_right != -1) {
- inv.setItem(inv, slot_right, item_arrow_right);
- }
- if(slot_up != -1) {
- inv.setItem(inv, slot_up, item_arrow_up);
- }
- if(slot_down != -1) {
- inv.setItem(inv, slot_down, item_arrow_down);
- }
- inv.setItem(inv, slot, customitem.create("PLUS_RED", 1, null, null));
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == chart_course_loc) {
- task_id = 6;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- a = array.new(9);
- r = math.random(0, 2);
- inv = inv.new("222222222222222222222222222222222222222222222222222222", text.new("§cChart Course"));
- if(r == 0) {
- a[0] = 27;
- a[1] = 19;
- a[2] = 29;
- a[3] = 39;
- a[4] = 31;
- a[5] = 23;
- a[6] = 15;
- a[7] = 25;
- a[8] = 35;
- } elseif(r == 1) {
- a[0] = 18;
- a[1] = 28;
- a[2] = 38;
- a[3] = 30;
- a[4] = 22;
- a[5] = 32;
- a[6] = 42;
- a[7] = 34;
- a[8] = 26;
- } else {
- a[0] = 36;
- a[1] = 28;
- a[2] = 20;
- a[3] = 21;
- a[4] = 13;
- a[5] = 23;
- a[6] = 33;
- a[7] = 25;
- a[8] = 26;
- }
- for(i = 0; i < 54; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- for(i = 0; i < 9; i++) {
- inv.setItem(inv, a[i], black_glass);
- }
- player_uuid = player.getUuid(player);
- map.add(chart_course_pattern, player_uuid, a);
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == unlock_manifolds_loc) {
- task_id = 5;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- //inv = inv.new("002222200 002222200");
- inv = inv.new("002222200002222200", text.new("§cUnlock Manifolds"));
- list = list.new();
- for(i = 0; i < 10; i++) {
- list.add(list, item.create("BLUE_STAINED_GLASS_PANE", i + 1, null, null));
- }
- list.shuffle(list);
- a = 2;
- for(i = 0; i < 10; i++) {
- inv.setItem(inv, a++, list.getIndex(list, i));
- if(a == 7) {
- a = 11;
- }
- }
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == start_reactor_loc) {
- task_id = 4;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- if(reactor_used) {
- msg.prefix(player, gamename, "Another player already starts the reactor.");
- goto("checkgame");
- }
- reactor_used = true;
- reactor_array = reactor.get(player);
- if(reactor_array == null) {
- //inv = inv.new("000000000 000000000 000002220 000002220 000002220 000000000");
- inv = inv.new("000000000000000000000002220000002220000002220000000000", text.new("§cStart Reactor"));
- for(i = 0; i < 54; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- reactor_array = array.new(5);
- reactor.setInv(reactor_array, inv);
- reactor.setStage(reactor_array, 0);
- reactor.setPattern(reactor_array);
- } else {
- inv = reactor.getInv(reactor_array);
- }
- reactor.setCounter(reactor_array, 0);
- reactor.setPhase(reactor_array, "draw");
- reactor.save(reactor_array, player);
- reactor.setHeader(inv, light_gray_glass);
- reactor.setLeftSide(inv, black_glass);
- reactor.setRightSide(inv, black_glass);
- inv.open(inv, player);
- list.add(reactor_draw_list_1, player.getUuid(player));
- sgoto(20, "draw_pattern_1");
- goto("checkgame");
- }
- if(block_loc == prime_shields_loc) {
- task_id = 3;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 000222000 002222200 002222200 000222000 000000000");
- inv = inv.new("000000000000222000002222200002222200000222000000000000", text.new("§cPrime Shields"));
- for(i = 12; i < 42; i++) {
- r = math.random(0, 1);
- if(r == 0) {
- inv.setItem(inv, i, green_glass);
- } else {
- inv.setItem(inv, i, red_glass);
- }
- if(i == 14) {
- i = 19;
- } elseif(i == 24) {
- i = 28;
- } elseif(i == 33) {
- i = 38;
- }
- }
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == fix_o2_loc_1 || block_loc == fix_o2_loc_2) {
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- if(oxygen_sabotaged) {
- if(block_loc == fix_o2_loc_1) {
- map.add(oxygen_map, player.getUuid(player), fix_o2_loc_1);
- if(oxy_fixed_1) {
- goto("checkgame");
- }
- } elseif(block_loc == fix_o2_loc_2) {
- map.add(oxygen_map, player.getUuid(player), fix_o2_loc_2);
- if(oxy_fixed_2) {
- goto("checkgame");
- }
- }
- //oxygen_inv = inv.new("000000000 000000000 000222000 000222000 000222000 000222000");
- oxygen_inv = inv.new("000000000000000000000222000000222000000222000000222000", text.new("§cENTER CODE"));
- inv.setItem(oxygen_inv, 8, item.create("PAPER", 1, string.concat("§f", string.number(oxy_code)), null));
- inv.setItem(oxygen_inv, 21, customitem.create("DIGIT_0", 1, "§f0", null));
- inv.setItem(oxygen_inv, 22, customitem.create("DIGIT_1", 1, "§f1", null));
- inv.setItem(oxygen_inv, 23, customitem.create("DIGIT_2", 1, "§f2", null));
- inv.setItem(oxygen_inv, 30, customitem.create("DIGIT_3", 1, "§f3", null));
- inv.setItem(oxygen_inv, 31, customitem.create("DIGIT_4", 1, "§f4", null));
- inv.setItem(oxygen_inv, 32, customitem.create("DIGIT_5", 1, "§f5", null));
- inv.setItem(oxygen_inv, 39, customitem.create("DIGIT_6", 1, "§f6", null));
- inv.setItem(oxygen_inv, 40, customitem.create("DIGIT_7", 1, "§f7", null));
- inv.setItem(oxygen_inv, 41, customitem.create("DIGIT_8", 1, "§f8", null));
- inv.setItem(oxygen_inv, 48, customitem.create("CROSS_RED", 1, null, null));
- inv.setItem(oxygen_inv, 49, customitem.create("DIGIT_9", 1, "§f9", null));
- inv.setItem(oxygen_inv, 50, customitem.create("CHECK_GREEN", 1, null, null));
- inv.open(oxygen_inv, player);
- sabotage.openedInv(player);
- }
- goto("checkgame");
- }
- if(block_loc == fix_reactor_loc_1 || block_loc == fix_reactor_loc_2) {
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- if(reactor_sabotaged) {
- if(block_loc == fix_reactor_loc_1) {
- sabotage.openedInv(player);
- inv.open(reactor_inv_1, player);
- list.add(reactor_hold_list_1, player.getUuid(player));
- goto("checkgame");
- }
- if(block_loc == fix_reactor_loc_2) {
- sabotage.openedInv(player);
- inv.open(reactor_inv_2, player);
- list.add(reactor_hold_list_2, player.getUuid(player));
- }
- }
- goto("checkgame");
- }
- if(block_loc == fix_comms_loc) {
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- if(comms_sabotaged) {
- player_uuid = player.getUuid(player);
- inv = inv.new("000000000000000000000000000000000000000000000000202000", text.new("§cFix Communications"));
- inv.setItem(inv, 48, customitem.create("ARROW_LEFT", 1, null, null));
- inv.setItem(inv, 49, item.create("BLACK_STAINED_GLASS_PANE", 32, null, null));
- inv.setItem(inv, 50, customitem.create("ARROW_RIGHT", 1, null, null));
- inv.open(inv, player);
- sabotage.openedInv(player);
- diff = math.abs(32 - comms_fix_freq);
- if(diff == 0) {
- comms.drawCorrect(inv, player);
- } elseif(diff < 4) {
- comms.drawClose(inv, player);
- } else {
- comms.drawWorst(inv, player);
- }
- map.add(comms_inv_map, player_uuid, inv);
- if(!list.contains(comms_state_list, player_uuid)) {
- list.add(comms_state_list, player_uuid);
- sgoto(5, "draw_comms");
- }
- }
- goto("checkgame");
- }
- if(block_loc == fix_lights_loc_1 || block_loc == fix_lights_loc_2) {
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- if(lights_sabotaged) {
- sabotage.openedInv(player);
- inv.open(lights_inv, player);
- }
- goto("checkgame");
- }
- if(block_loc == meeting_button_loc) {
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- if(amongus.isAlert()) {
- msg.prefix(player, gamename, "No meetings allowed while sabotaged.");
- goto("checkgame");
- }
- if(!meeting) {
- callMeeting(player);
- }
- goto("checkgame");
- }
- block_type = block.getType(block);
- if(block_type == lever_mat) {
- cancel = true;
- }
- if(block_type == redstone_lamp_mat) {
- task_id = 10;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 3) {
- goto("checkgame");
- }
- my_list = map.get(wires_map_4, player.getUuid(player));
- if(block_loc != list.getIndex(my_list, step)) {
- goto("checkgame");
- }
- //inv = inv.new("000000000 002202200 002202200 002202200 002202200 000000000");
- inv = inv.new("000000000002202200002202200002202200002202200000000000", text.new("§cFix Wiring"));
- for(i = 0; i < 54; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.setItem(inv, 12, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- inv.setItem(inv, 14, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- inv.setItem(inv, 21, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- inv.setItem(inv, 23, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- inv.setItem(inv, 30, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- inv.setItem(inv, 32, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- inv.setItem(inv, 39, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- inv.setItem(inv, 41, customitem.create("CROSS_RED", 1, "§rDisconnected", null));
- list.shuffle(wires_list);
- inv.setItem(inv, 11, list.getIndex(wires_list, 0));
- inv.setItem(inv, 20, list.getIndex(wires_list, 1));
- inv.setItem(inv, 29, list.getIndex(wires_list, 2));
- inv.setItem(inv, 38, list.getIndex(wires_list, 3));
- list.shuffle(wires_list);
- inv.setItem(inv, 15, list.getIndex(wires_list, 0));
- inv.setItem(inv, 24, list.getIndex(wires_list, 1));
- inv.setItem(inv, 33, list.getIndex(wires_list, 2));
- inv.setItem(inv, 42, list.getIndex(wires_list, 3));
- inv.open(inv, player);
- goto("checkgame");
- }
- if(list.contains(download_list_3, block_loc) || block_loc == admin_upload_loc) {
- cancel = true;
- task_id = 2;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(block_loc == admin_upload_loc) {
- if(step != 1) {
- goto("checkgame");
- }
- //Upload
- inv = inv.new("000000000000000000000020000", text.new("§cUpload Data"));
- for(i = 0; i < 9; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.setItem(inv, 9, item.create("birch_trapdoor", 1, "§rMy Laptop", null));
- inv.setItem(inv, 17, item.create("redstone_torch", 1, "§rHeadquarters", null));
- inv.setItem(inv, 22, customitem.create("ARROW_UP", 1, "§rUpload", null));
- inv.open(inv, player);
- goto("checkgame");
- }
- if(step != 0) {
- goto("checkgame");
- }
- r = map.get(download_map_3, player.getUuid(player));
- down_loc = list.getIndex(download_list_3, r);
- if(down_loc != block_loc) {
- goto("checkgame");
- }
- //Download
- inv = inv.new("000000000000000000000020000", text.new("§cDownload Data"));
- for(i = 0; i < 9; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- inv.setItem(inv, 9, item.create("CHEST", 1, map.get(download_map_2, block_loc), null));
- inv.setItem(inv, 17, item.create("BIRCH_TRAPDOOR", 1, "§rMy Laptop", null));
- inv.setItem(inv, 22, customitem.create("ARROW_DOWN", 1, "§rDownload", null));
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == get_fuel_loc) {
- task_id = 1;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 1 || step == 3 || step == 4) {
- goto("checkgame");
- }
- lime_terra_item = item.create("LIME_TERRACOTTA", 1, null, null);
- //inv = inv.new(000000002 000000000 000000000 000000000 000000000 000000000);
- inv = inv.new("000000002000000000000000000000000000000000000000000000", text.new("§cFuel"));
- player_uuid = player.getUuid(player);
- c = map.getOrDefault(fuel_counter, player_uuid, 0);
- for(row = 0; row < 6; row++) {
- for(col = 0; col < 7; col++) {
- i = row * 9 + col;
- inv.setItem(inv, i, lime_terra_item);
- }
- }
- inv.setItem(inv, 8, customitem.create("ARROW_DOWN", 1, "§rGet fuel", null));
- inv.open(inv, player);
- goto("checkgame");
- }
- if(block_loc == upper_engine_loc || block_loc == lower_engine_loc) {
- task_id = 1;
- cancel = true;
- if(!hasTask(player, task_id)) {
- goto("checkgame");
- }
- step = task.getStep(player, task_id);
- if(step == 0 || step == 2 || step == 4) {
- goto("checkgame");
- }
- if(step == 1 && block_loc != upper_engine_loc) {
- goto("checkgame");
- }
- if(step == 3 && block_loc != lower_engine_loc) {
- goto("checkgame");
- }
- //inv = inv.new(000000002 000000000 000000000 000000000 000000000 000000000);
- inv = inv.new("000000002000000000000000000000000000000000000000000000", text.new("§cEngine"));
- for(row = 0; row < 6; row++) {
- for(col = 0; col < 7; col++) {
- i = row * 9 + col;
- inv.setItem(inv, i, light_gray_glass);
- }
- }
- inv.setItem(inv, 8, customitem.create("ARROW_UP", 1, "§rFill engine", null));
- inv.open(inv, player);
- goto("checkgame");
- }
- goto("checkgame");
- @inv_click
- if(inv_slot >= 36 && inv_slot <= 39) {
- cancel = true;
- }
- goto("checkgame");
- @inv_close
- player_uuid = player.getUuid(player);
- if(list.contains(auto_close_list, player_uuid)) {
- list.add(auto_close_list_2, player_uuid);
- }
- if(amongus.isAlert()) {
- sabotage.closedInv(player);
- }
- if(reactor_sabotaged) {
- if(inv_id == inv.getId(reactor_inv_1)) {
- list.remove(reactor_hold_list_1, player_uuid);
- if(list.getSize(reactor_hold_list_1) == 0) {
- sabotage.holdReactor(reactor_inv_1, false);
- hold_reactor_1 = false;
- }
- goto("checkgame");
- }
- if(inv_id == inv.getId(reactor_inv_2)) {
- list.remove(reactor_hold_list_2, player_uuid);
- if(list.getSize(reactor_hold_list_2) == 0) {
- sabotage.holdReactor(reactor_inv_2, false);
- hold_reactor_2 = false;
- }
- goto("checkgame");
- }
- }
- title_string = string.text(inv_title);
- if(title_string == "§cFuel" || title_string == "§cEngine") {
- map.remove(fuel_counter, player_uuid);
- goto("checkgame");
- }
- if(title_string == "§cFix Wiring") {
- map.remove(wires_map, player_uuid);
- goto("checkgame");
- }
- if(title_string == "§cFix Communications") {
- map.remove(comms_inv_map, player_uuid);
- map.remove(comms_fix_map, player_uuid);
- goto("checkgame");
- }
- if(title_string == "§cClean O2 Filter") {
- map.remove(clean_o2_map, player_uuid);
- goto("checkgame");
- }
- if(title_string == "§cSubmit Scan") {
- list.add(submit_scan_list_2, player_uuid);
- sgoto(20, "unblock_submit_scan");
- goto("checkgame");
- }
- if(title_string == "§cCalibrate Distributor") {
- list.add(calibrate_dist_list_2, player_uuid);
- sgoto(7, "unblock_calib_dist");
- goto("checkgame");
- }
- if(title_string == "§cChart Course") {
- map.remove(chart_course_counter, player_uuid);
- map.remove(chart_course_pattern, player_uuid);
- goto("checkgame");
- }
- if(title_string == "§cEmpty Garbage") {
- list.add(empty_garb_list_2, player_uuid);
- sgoto(25, "unblock_empty_garb");
- goto("checkgame");
- }
- if(title_string == "§cClear Asteroids") {
- list.add(clear_ast_list_2, player_uuid);
- sgoto(5, "unblock_clear_ast");
- goto("checkgame");
- }
- if(title_string == "§cUnlock Manifolds") {
- map.remove(manifolds_counter, player_uuid);
- goto("checkgame");
- }
- if(title_string == "§cStart Reactor") {
- reactor_used = false;
- list.add(reactor_block_list, player_uuid);
- sgoto(20, "unblock_start_reactor");
- goto("checkgame");
- }
- if(title_string == "§cDownload Data" || title_string == "§cUpload Data") {
- list.add(download_list_2, player_uuid);
- sgoto(25, "unblock_download");
- }
- goto("checkgame");
- @snuvi_click
- item = inv.getItem(inv, inv_slot);
- item.removeFlag(item, "HIDE_DESTROYS");
- title_string = string.text(inv_title);
- if(title_string == "§cSABOTAGE") {
- //Keine Sabotagen während bestehender Sabotage möglich
- if(amongus.isAlert()) {
- msg.prefix(player, gamename, "A sabotage is already active.");
- goto("checkgame");
- }
- if(meeting) {
- msg.prefix(player, gamename, "Sabotage during meeting not possible.");
- goto("checkgame");
- }
- cooldown = data.getTimer(player, "Sabotage Cooldown");
- if(cooldown != null && cooldown != -1) {
- msg.prefix(player, gamename, string.concat("Remaining sabotage cooldown: ", string.number(math.roundDown(cooldown / 20)), "s"));
- goto("checkgame");
- }
- //sabotage light
- if(inv_slot == 0) {
- sabotage_light();
- goto("checkgame");
- }
- //sabotage reactor
- if(inv_slot == 1) {
- sabotage_reactor();
- goto("checkgame");
- }
- //sabotage oxygen
- if(inv_slot == 2) {
- sabotage_oxygen();
- goto("checkgame");
- }
- //sabotage communication
- if(inv_slot == 3) {
- sabotage_comms();
- goto("checkgame");
- }
- goto("checkgame");
- }
- if(title_string == "§cVOTE") {
- if(player.isGhost(player)) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- if(map.contains(vote_count_map_2, player_uuid)) {
- goto("checkgame");
- }
- item_type = item.getType(item);
- if(customitem.isGreenReturn(item) || item_type == player_head_mat && item.getType(inv.getItem(inv, inv_slot - 1)) != zombie_head_mat) {
- inv.setItem(inv, 2, black_glass);
- inv.setItem(inv, 3, black_glass);
- inv.setItem(inv, 7, black_glass);
- inv.setItem(inv, 8, black_glass);
- inv.setItem(inv, 11, black_glass);
- inv.setItem(inv, 12, black_glass);
- inv.setItem(inv, 16, black_glass);
- inv.setItem(inv, 17, black_glass);
- inv.setItem(inv, 20, black_glass);
- inv.setItem(inv, 21, black_glass);
- inv.setItem(inv, 25, black_glass);
- inv.setItem(inv, 26, black_glass);
- inv.setItem(inv, 29, black_glass);
- inv.setItem(inv, 30, black_glass);
- inv.setItem(inv, 34, black_glass);
- inv.setItem(inv, 35, black_glass);
- inv.setItem(inv, 38, black_glass);
- inv.setItem(inv, 39, black_glass);
- inv.setItem(inv, 43, black_glass);
- inv.setItem(inv, 44, black_glass);
- inv.setItem(inv, 47, black_glass);
- inv.setItem(inv, 48, black_glass);
- inv.setItem(inv, inv_slot + 1, customitem.create("CHECK_GREEN", 1, "§rConfirm", null));
- inv.setItem(inv, inv_slot + 2, customitem.create("CROSS_RED", 1, "§rCancel", null));
- goto("checkgame");
- }
- if(customitem.isRedCross(item)) {
- inv.setItem(inv, inv_slot, black_glass);
- inv.setItem(inv, inv_slot - 1, black_glass);
- goto("checkgame");
- }
- if(customitem.isGreenCheck(item)) {
- if(item.getType(inv.getItem(inv, inv_slot - 2)) != zombie_head_mat) {
- vote_item = inv.getItem(inv, inv_slot - 1);
- if(customitem.isGreenReturn(vote_item)) {
- map.add(vote_count_map, "skip", map.getOrDefault(vote_count_map, "skip", 0) + 1);
- map.add(vote_count_map_2, player_uuid, "skip");
- } else {
- vote_item_name = string.text(item.getName(vote_item));
- a = string.split(" ", vote_item_name);
- vote_name = a[2];
- vote_uuid = player.getUuid(string.removeFormat(vote_name));
- map.add(vote_count_map, vote_uuid, map.getOrDefault(vote_count_map, vote_uuid, 0) + 1);
- map.add(vote_count_map_2, player_uuid, vote_uuid);
- }
- inv.setItem(inv, inv_slot, black_glass);
- inv.setItem(inv, inv_slot + 1, black_glass);
- //Bei allen Spielern anzeigen, dass player gevoted hat
- index = list.getIndexOf(all_list, player_uuid);
- if(index % 2 == 0) {
- voted_slot = (index / 2) * 9;
- } else {
- voted_slot = ((index - 1) / 2) * 9 + 5;
- }
- voted_item = customitem.create("CHECK_RED", 1, string.concat(amongus.getPlayerColorCode(player), player.getName(player), "§r has voted"), null);
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- inv = getVoteInv(p);
- inv.setItem(inv, voted_slot, voted_item);
- }
- sound.spawnForPlayer(player, vote_sound, master_sound_category);
- //Haben bereits alle gevoted?
- if(map.getSize(vote_count_map_2) == list.getSize(player_list) - list.getSize(ghosts)) {
- goto("score_evaluation");
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cENTER CODE") {
- //CODE eingeben
- if(customitem.isDigit(item)) {
- number = string.text(item.getName(item));
- for(i = 2; i < 7; i++) {
- if(item.getType(inv.getItem(inv, i)) == black_glass_mat) {
- break;
- }
- }
- if(i == 7) {
- goto("checkgame");
- }
- inv.setItem(inv, i, item);
- inv.setItem(inv, 7, black_glass);
- goto("checkgame");
- }
- //CODEEINGABE CANCELN
- if(inv_slot == 48) {
- for(i = 2; i < 7; i++) {
- inv.setItem(inv, i, black_glass);
- }
- goto("checkgame");
- }
- //CODE BESTÄTIGEN
- if(inv_slot == 50) {
- number = "";
- for(i = 2; i < 7; i++) {
- item = inv.getItem(inv, i);
- if(item.getType(item) == black_glass_mat) {
- for(h = 2; h < 7; h++) {
- inv.setItem(inv, h, black_glass);
- }
- goto("checkgame");
- }
- number = string.concat(number, string.text(item.getName(item)));
- }
- number = read.number(string.removeFormat(number));
- if(number == oxy_code) {
- player_uuid = player.getUuid(player);
- sgoto_auto_close_inv(player_uuid);
- inv.setItem(inv, 7, customitem.create("CHECK_GREEN", 1, "§rCorrect code", null));
- loc = map.get(oxygen_map, player_uuid);
- if(loc == fix_o2_loc_1) {
- oxy_fixed_1 = true;
- removeSaboParticles(fix_o2_par_loc_1, null);
- if(oxy_fixed_2) {
- fix_oxygen();
- }
- } elseif(loc == fix_o2_loc_2) {
- oxy_fixed_2 = true;
- removeSaboParticles(fix_o2_par_loc_2, null);
- if(oxy_fixed_1) {
- fix_oxygen();
- }
- }
- } else {
- inv.setItem(inv, 7, customitem.create("CROSS_RED", 1, "§rFalse code", null));
- for(i = 2; i < 7; i++) {
- inv.setItem(inv, i, black_glass);
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cAlign Engine") {
- task_id = 17;
- step = task.getStep(player, task_id);
- if(step == 2) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- loc = map.get(align_engine_map_2, player_uuid);
- if(block_loc == ue_align_loc && set.contains(align_ue_engine_set, player_uuid)) {
- goto("checkgame");
- }
- if(block_loc == le_align_loc && set.contains(align_le_engine_set, player_uuid)) {
- goto("checkgame");
- }
- if(customitem.isUpArrow(item)) {
- temp = set_engine(player, inv, "up");
- } elseif(customitem.isDownArrow(item)) {
- temp = set_engine(player, inv, "down");
- } else {
- goto("checkgame");
- }
- if(temp) {
- if(loc == le_align_loc) {
- set.add(align_le_engine_set, player_uuid);
- removeTaskParticle(player, le_align_par_loc);
- } else {
- set.add(align_ue_engine_set, player_uuid);
- removeTaskParticle(player, ue_align_par_loc);
- }
- step = task.stepIncrease(player, task_id);
- giveTask(player, 17, "UE/LE", "Align Engine", step, 2, null);
- sgoto_auto_close_inv(player_uuid);
- }
- goto("checkgame");
- }
- if(title_string == "§cClean O2 Filter") {
- task_id = 15;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- if(customitem.isUpArrow(item)) {
- old_slot = inv_slot + 9;
- } elseif(customitem.isLeftArrow(item)) {
- old_slot = inv_slot + 1;
- } elseif(customitem.isDownArrow(item)) {
- old_slot = inv_slot - 9;
- } else {
- goto("checkgame");
- }
- inv.setItem(inv, inv_slot, item.create("oak_leaves", 1, null, null));
- inv.setItem(inv, old_slot, light_gray_glass);
- if(inv_slot == 18 || inv_slot == 27) {
- inv.setItem(inv, inv_slot, light_gray_glass);
- player_uuid = player.getUuid(player);
- c = map.getOrDefault(clean_o2_map, player_uuid, 0) + 1;
- map.add(clean_o2_map, player_uuid, c);
- if(c == 6) {
- removeTaskParticle(player, clean_o2_par_loc);
- step = task.stepIncrease(player, task_id);
- giveTask(player, 15, "O2", "Clean O2 Filter", 1, 1, null);
- sgoto_auto_close_inv(player_uuid);
- goto("checkgame");
- }
- }
- for(slot = 1; slot < 53; slot++) {
- if(item.getType(inv.getItem(inv, slot)) == oak_leaves_mat) {
- if(slot < 18) {
- a = inv.getItem(inv, slot + 9);
- b = inv.getItem(inv, slot - 1);
- if(customitem.isDownArrow(a) || customitem.isLeftArrow(b)) {
- continue;
- }
- a_type = item.getType(a);
- if(a_type == light_gray_glass_mat) {
- inv.setItem(inv, slot + 9, item_arrow_down);
- continue;
- }
- }
- if(slot > 36) {
- a = inv.getItem(inv, slot - 9);
- b = inv.getItem(inv, slot - 1);
- if(customitem.isUpArrow(a) || customitem.isLeftArrow(b)) {
- continue;
- }
- a_type = item.getType(a);
- if(a_type == light_gray_glass_mat) {
- inv.setItem(inv, slot - 9, item_arrow_up);
- continue;
- }
- }
- if(item.getType(inv.getItem(inv, slot - 1)) == light_gray_glass_mat) {
- inv.setItem(inv, slot - 1, item_arrow_left);
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cDivert Power") {
- task_id = 14;
- step = task.getStep(player, task_id);
- if(step == 2) {
- goto("checkgame");
- }
- item_type = item.getType(item);
- if(item_type == redstone_torch_mat) {
- if(step == 1) {
- goto("checkgame");
- }
- redstone = item.create("redstone", 1, null, null);
- inv.setItem(inv, 4, redstone);
- inv.setItem(inv, 13, redstone);
- inv.setItem(inv, inv_slot - 9, redstone);
- if(inv_slot < 40) {
- inv.setItem(inv, inv_slot - 17, redstone);
- if(inv_slot < 38) {
- inv.setItem(inv, inv_slot - 24, redstone);
- inv.setItem(inv, inv_slot - 25, redstone);
- }
- } elseif(inv_slot > 40) {
- inv.setItem(inv, inv_slot - 19, redstone);
- if(inv_slot > 42) {
- inv.setItem(inv, inv_slot - 29, redstone);
- inv.setItem(inv, inv_slot - 30, redstone);
- }
- } else {
- inv.setItem(inv, inv_slot - 18, redstone);
- }
- player_uuid = player.getUuid(player);
- removeTaskParticle(player, elec_power_par_loc);
- r = map.get(divert_pow_map_3, player_uuid);
- addTaskParticle(player, map.get(divert_pow_map_4, r));
- step = task.stepIncrease(player, task_id);
- giveTask(player, task_id, "[Room]", "Divert power to [Room]", step, 2, null);
- sgoto_auto_close_inv(player_uuid);
- goto("checkgame");
- }
- if(item_type == stone_button_mat) {
- redstone = item.create("redstone", 1, null, null);
- inv.setItem(inv, 8, redstone);
- inv.setItem(inv, 15, redstone);
- inv.setItem(inv, 16, redstone);
- inv.setItem(inv, 23, redstone);
- inv.setItem(inv, 26, redstone);
- inv.setItem(inv, 32, redstone);
- inv.setItem(inv, 33, redstone);
- inv.setItem(inv, 34, redstone);
- inv.setItem(inv, 41, redstone);
- inv.setItem(inv, 44, redstone);
- inv.setItem(inv, 51, redstone);
- inv.setItem(inv, 52, redstone);
- player_uuid = player.getUuid(player);
- r = map.get(divert_pow_map_3, player_uuid);
- removeTaskParticle(player, map.get(divert_pow_map_4, r));
- step = task.stepIncrease(player, task_id);
- giveTask(player, task_id, "[Room]", "Divert power to [Room]", step, 2, null);
- sgoto_auto_close_inv(player.getUuid(player));
- }
- goto("checkgame");
- }
- if(title_string == "§cClear Asteroids") {
- task_id = 13;
- step = task.getStep(player, task_id);
- if(step == 20) {
- goto("checkgame");
- }
- if(item == asteroid_item) {
- inv.setItem(inv, inv_slot, black_glass);
- player_uuid = player.getUuid(player);
- my_list = map.get(clear_ast_map, player_uuid);
- iter = iterator(my_list);
- while(hasNext(iter)) {
- a = next(iter);
- slot = a[1];
- if(slot == inv_slot) {
- step = task.stepIncrease(player, task_id);
- giveTask(player, 13, "WEA", "Clear Asteroids", step, 20, null);
- if(step == 20) {
- removeTaskParticle(player, clear_ast_par_loc);
- sgoto_auto_close_inv(player_uuid);
- list.add(clear_ast_list_3, player_uuid);
- break;
- }
- remove(iter);
- continue;
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cEmpty Garbage") {
- task_id = 12;
- step = task.getStep(player, task_id);
- if(step == 2) {
- goto("checkgame");
- }
- if(customitem.isDownArrow(item)) {
- inv.setItem(inv, inv_slot, black_glass);
- player_uuid = player.getUuid(player);
- list.add(empty_garb_list, player_uuid);
- map.add(empty_garb_map, player_uuid, 0);
- map.add(empty_garb_map_2, player_uuid, inv);
- sgoto(20, "empty_garb");
- }
- goto("checkgame");
- }
- if(title_string == "§cSwipe Card") {
- task_id = 11;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- if(inv_slot == 11 || (item.getType(item) == light_gray_glass_mat && item.getType(inv.getItem(inv, inv_slot - 1)) == lime_glass_mat)) {
- player_uuid = player.getUuid(player);
- if(inv_slot == 11) {
- map.add(swipe_card_map, player_uuid, time.getMillis());
- }
- inv.setItem(inv, inv_slot, lime_glass);
- if(inv_slot == 15) {
- start_time = map.get(swipe_card_map, player_uuid);
- time = (time.getMillis() - start_time) / 1000;
- if(time < 1.8) {
- inv.setItem(inv, 16, customitem.create("CROSS_RED", 1, string.concat("§rToo fast ", math.roundComma(time, 1), "s"), null));
- for(i = 11; i < 16; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- } elseif(time > 2.2) {
- inv.setItem(inv, 16, customitem.create("CROSS_RED", 1, string.concat("§rToo slow ", math.roundComma(time, 1), "s"), null));
- for(i = 11; i < 16; i++) {
- inv.setItem(inv, i, light_gray_glass);
- }
- } else {
- removeTaskParticle(player, swipe_card_par_loc);
- inv.setItem(inv, 16, customitem.create("CHECK_GREEN", 1, "§rTask completed", null));
- step = task.stepIncrease(player, task_id);
- giveTask(player, 11, "ADM", "Swipe Card", 1, 1, null);
- sgoto_auto_close_inv(player_uuid);
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cFix Wiring") {
- task_id = 10;
- step = task.getStep(player, task_id);
- if(step == 3) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- if(inv_slot == 11 || inv_slot == 20 || inv_slot == 29 || inv_slot == 38) {
- map.add(wires_map_2, player_uuid, inv_slot);
- }
- if(inv_slot == 15 || inv_slot == 24 || inv_slot == 33 || inv_slot == 42) {
- slot = map.get(wires_map_2, player_uuid);
- if(slot == null) {
- goto("checkgame");
- }
- map.remove(wires_map_2, player_uuid);
- if(inv.getItem(inv, slot) == item && customitem.isRedCross(inv.getItem(inv, inv_slot - 1))) {
- inv.setItem(inv, slot + 1, customitem.create("CHECK_GREEN", 1, "§rConnected", null));
- inv.setItem(inv, inv_slot - 1, customitem.create("CHECK_GREEN", 1, "§rConnected", null));
- c = map.getOrDefault(wires_map, player_uuid, 0) + 1;
- map.add(wires_map, player_uuid, c);
- if(c == 4) {
- map.remove(wires_map, player_uuid);
- step = task.stepIncrease(player, task_id);
- giveTask(player, 10, "CAF", "Fix Wiring", step, 3, null);
- sgoto_auto_close_inv(player_uuid);
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cCalibrate Distributor") {
- task_id = 9;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- if(inv_slot == 44) {
- player_uuid = player.getUuid(player);
- a = map.get(calibrate_dist_map, player_uuid);
- if(inv.getItem(inv, 33) == inv.getItem(inv, 34)) {
- stage = a[4] + 1;
- a[4] = stage;
- if(stage == 1) {
- inv.setItem(inv, 3, customitem.create("CHECK_GREEN", 1, null, null));
- inv.setItem(inv, 34, blue_glass);
- inv.setItem(inv, 35, blue_glass);
- } elseif(stage == 2) {
- inv.setItem(inv, 4, customitem.create("CHECK_GREEN", 1, null, null));
- inv.setItem(inv, 34, cyan_glass);
- inv.setItem(inv, 35, cyan_glass);
- } elseif(stage == 3) {
- removeTaskParticle(player, calibrate_dist_par_loc);
- inv.setItem(inv, 5, customitem.create("CHECK_GREEN", 1, null, null));
- step = task.stepIncrease(player, task_id);
- giveTask(player, 9, "ELE", "Calibrate Distributor", 1, 1, null);
- sgoto_auto_close_inv(player_uuid);
- }
- } else {
- a[4] = 0;
- inv.setItem(inv, 3, customitem.create("CROSS_RED", 1, null, null));
- inv.setItem(inv, 4, customitem.create("CROSS_RED", 1, null, null));
- inv.setItem(inv, 5, customitem.create("CROSS_RED", 1, null, null));
- inv.setItem(inv, 34, yellow_glass);
- inv.setItem(inv, 35, yellow_glass);
- }
- a[3] = a[2]; //Index = Start_index
- map.add(calibrate_dist_map, player_uuid, a);
- for(h = 0; h < 12; h++) {
- inv.setItem(inv, calibrate_dist_array[h], black_glass);
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cInspect Sample") {
- task_id = 8;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- item_type = item.getType(item);
- if(item_type == green_glass_mat) {
- if(inv_slot == 53) {
- inv.setItem(inv, 53, item.create("gray_stained_glass_pane", 59, "§rGo grab a coffee", null));
- giveTask(player, 8, "MED", "Inspect Sample", 0, 1, 59);
- player_uuid = player.getUuid(player);
- list.add(sample_list, player_uuid);
- list.add(sample_list_2, 59);
- map.add(sample_map, player_uuid, inv);
- sgoto(20, "countdown_sample");
- goto("checkgame");
- }
- if(inv_slot >= 36) {
- if(item.getType(inv.getItem(inv, inv_slot - 18)) == red_glass_mat) {
- removeTaskParticle(player, inspect_par_loc);
- step = task.stepIncrease(player, task_id);
- giveTask(player, 8, "MED", "Inspect Sample", 1, 1, null);
- sgoto_auto_close_inv(player.getUuid(player));
- } else {
- h = 0;
- for(i = 0; i < 3; i++) {
- inv.setItem(inv, 0 + h, sample);
- inv.setItem(inv, 2 + h, sample);
- inv.setItem(inv, 4 + h, sample);
- inv.setItem(inv, 6 + h, sample);
- inv.setItem(inv, 8 + h, sample);
- h += 9;
- }
- select_sample = item.create("gray_stained_glass_pane", 1, "§rSelect sample", null);
- inv.setItem(inv, 36, select_sample);
- inv.setItem(inv, 38, select_sample);
- inv.setItem(inv, 40, select_sample);
- inv.setItem(inv, 42, select_sample);
- inv.setItem(inv, 44, select_sample);
- inv.setItem(inv, 53, item.create("green_stained_glass_pane", 1, "§rPress to start", null));
- giveTask(player, 8, "MED", "Inspect Sample", 0, 1, null);
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cStabilize Steering") {
- task_id = 7;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- new_cross_slot = inv_slot;
- if(customitem.isDownArrow(item)) {
- cross_slot = inv_slot - 9;
- if(cross_slot == 22) {
- new_cross_slot = cross_slot;
- cross_slot -= 9;
- }
- } elseif(customitem.isUpArrow(item)) {
- cross_slot = inv_slot + 9;
- if(cross_slot == 22) {
- new_cross_slot = cross_slot;
- cross_slot += 9;
- }
- } elseif(customitem.isLeftArrow(item)) {
- cross_slot = inv_slot + 1;
- if(cross_slot == 22) {
- new_cross_slot = cross_slot;
- cross_slot++;
- }
- } elseif(customitem.isRightArrow(item)) {
- cross_slot = inv_slot - 1;
- if(cross_slot == 22) {
- new_cross_slot = cross_slot;
- cross_slot--;
- }
- } else {
- goto("checkgame");
- }
- //remove old plus
- if(cross_slot != 22) {
- inv.setItem(inv, cross_slot, light_gray_glass);
- }
- temp_slot = cross_slot - 1;
- if(temp_slot == 22) {
- temp_slot--;
- }
- if(temp_slot >= 0 && cross_slot % 9 != 0) {
- inv.setItem(inv, temp_slot, light_gray_glass);
- }
- temp_slot = cross_slot + 1;
- if(temp_slot == 22) {
- temp_slot++;
- }
- if(temp_slot >= 0 && temp_slot % 9 != 0) {
- inv.setItem(inv, temp_slot, light_gray_glass);
- }
- temp_slot = cross_slot - 9;
- if(temp_slot == 22) {
- temp_slot -= 9;
- }
- if(temp_slot >= 0) {
- inv.setItem(inv, temp_slot, light_gray_glass);
- }
- temp_slot = cross_slot + 9;
- if(temp_slot == 22) {
- temp_slot += 9;
- }
- if(temp_slot < 45) {
- inv.setItem(inv, temp_slot, light_gray_glass);
- }
- //set new plus
- inv.setItem(inv, new_cross_slot, customitem.create("PLUS_RED", 1, null, null));
- temp_slot = new_cross_slot - 1;
- if(temp_slot == 22) {
- inv.setItem(inv, temp_slot - 1, item_arrow_left);
- } else {
- if(temp_slot >= 0 && new_cross_slot % 9 != 0) {
- inv.setItem(inv, temp_slot, item_arrow_left);
- }
- }
- temp_slot = new_cross_slot + 1;
- if(temp_slot == 22) {
- inv.setItem(inv, temp_slot + 1, item_arrow_right);
- } else {
- if(temp_slot >= 0 && temp_slot % 9 != 0) {
- inv.setItem(inv, temp_slot, item_arrow_right);
- }
- }
- temp_slot = new_cross_slot - 9;
- if(temp_slot == 22) {
- inv.setItem(inv, temp_slot - 9, item_arrow_up);
- } else {
- if(temp_slot >= 0) {
- inv.setItem(inv, temp_slot, item_arrow_up);
- }
- }
- temp_slot = new_cross_slot + 9;
- if(temp_slot == 22) {
- inv.setItem(inv, temp_slot + 9, item_arrow_down);
- } else {
- if(temp_slot < 45) {
- inv.setItem(inv, temp_slot, item_arrow_down);
- }
- }
- //finish task
- if(new_cross_slot == 22) {
- removeTaskParticle(player, steering_par_loc);
- inv.setItem(inv, 44, customitem.create("CHECK_GREEN", 1, "§rTask completed", null));
- step = task.stepIncrease(player, task_id);
- giveTask(player, task_id, "NAV", "Stabilize Steering", 1, 1, null);
- sgoto_auto_close_inv(player.getUuid(player));
- }
- goto("checkgame");
- }
- if(title_string == "§cChart Course") {
- task_id = 6;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- a = map.get(chart_course_pattern, player_uuid);
- c = map.getOrDefault(chart_course_counter, player_uuid, 0);
- if(a[c] == inv_slot) {
- inv.setItem(inv, inv_slot, green_glass);
- map.add(chart_course_counter, player_uuid, c + 1);
- if(c == 8) {
- inv.setItem(inv, 53, customitem.create("CHECK_GREEN", 1, "§rTask completed", null));
- removeTaskParticle(player, chart_course_par_loc);
- step = task.stepIncrease(player, task_id);
- giveTask(player, task_id, "NAV", "Chart Course", 1, 1, null);
- sgoto_auto_close_inv(player_uuid);
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cUnlock Manifolds") {
- task_id = 5;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- item_type = item.getType(item);
- if(item_type == blue_glass_mat) {
- player_uuid = player.getUuid(player);
- amount = map.getOrDefault(manifolds_counter, player_uuid, 1);
- if(amount == item.getAmount(item)) {
- inv.setItem(inv, inv_slot, item.create("GREEN_STAINED_GLASS_PANE", amount, null, null));
- map.add(manifolds_counter, player_uuid, amount + 1);
- if(amount == 10) {
- removeTaskParticle(player, unlock_manifolds_par_loc);
- step = task.stepIncrease(player, task_id);
- giveTask(player, task_id, "REA", "Unlock Manifolds", 1, 1, null);
- sgoto_auto_close_inv(player_uuid);
- }
- goto("checkgame");
- }
- goto("false_manifolds_click");
- }
- if(item_type == green_glass_mat) {
- goto("false_manifolds_click");
- }
- goto("checkgame");
- }
- if(title_string == "§cStart Reactor") {
- task_id = 4;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- if(!(inv_slot > 22 && inv_slot < 26 || inv_slot > 31 && inv_slot < 35 || inv_slot > 40 && inv_slot < 44)) {
- goto("checkgame");
- }
- player_uuid = player.getUuid(player);
- item_type = item.getType(item);
- if(item_type == red_glass_mat) {
- goto("checkgame");
- }
- if(item_type == black_glass_mat) {
- goto("false_reactor_click");
- }
- if(reactor.getPhase(reactor_array) == "draw") {
- goto("false_reactor_click");
- }
- reactor_array = reactor.get(player);
- stage = reactor.getStage(reactor_array);
- counter = reactor.getCounter(reactor_array);
- pattern = reactor.getPattern(reactor_array);
- if(inv_slot - 4 != pattern[counter]) {
- goto("false_reactor_click");
- }
- inv.setItem(inv, inv_slot, blue_glass);
- list.add(reset_reactor_click_list, player_uuid);
- list.add(reset_reactor_click_list_2, inv_slot);
- sgoto(10, "reset_reactor_click");
- if(counter == stage && stage < 5) {
- stage++;
- reactor.setStage(reactor_array, stage);
- reactor.setCounter(reactor_array, 0);
- reactor.setPhase(reactor_array, "draw");
- reactor.save(reactor_array, player);
- if(stage == 5) {
- removeTaskParticle(player, start_reactor_par_loc);
- step = task.stepIncrease(player, task_id);
- giveTask(player, task_id, "REA", "Start Reactor", 1, 1, null);
- sgoto_auto_close_inv(player_uuid);
- reactor_used = false;
- goto("checkgame");
- }
- list.add(reactor_draw_list_1, player_uuid);
- sgoto(20, "draw_pattern_1");
- goto("checkgame");
- }
- reactor.setCounter(reactor_array, ++counter);
- reactor.save(reactor_array, player);
- goto("checkgame");
- }
- if(title_string == "§cPrime Shields") {
- task_id = 3;
- step = task.getStep(player, task_id);
- if(step == 1) {
- goto("checkgame");
- }
- if(item == green_glass) {
- inv.setItem(inv, inv_slot, red_glass);
- goto("checkgame");
- }
- if(item == red_glass) {
- inv.setItem(inv, inv_slot, green_glass);
- for(i = 9; i < 42; i++) {
- if(item.getType(inv.getItem(inv, i)) == red_glass_mat) {
- goto("checkgame");
- }
- }
- removeTaskParticle(player, prime_shields_par_loc);
- step = task.stepIncrease(player, task_id);
- giveTask(player, task_id, "SHI", "Prime Shields", 1, 1, null);
- sgoto_auto_close_inv(player.getUuid(player));
- }
- goto("checkgame");
- }
- inv_id = inv.getId(inv);
- if(inv_id == inv.getId(reactor_inv_1)) {
- if(reactor_sabotaged) {
- sabotage.holdReactor(reactor_inv_1, true);
- hold_reactor_1 = true;
- if(hold_reactor_2) {
- fix_meltdown();
- }
- }
- goto("checkgame");
- }
- if(inv_id == inv.getId(reactor_inv_2)) {
- if(reactor_sabotaged) {
- sabotage.holdReactor(reactor_inv_2, true);
- hold_reactor_2 = true;
- if(hold_reactor_1) {
- fix_meltdown();
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cFix Communications") {
- if(!comms_sabotaged) {
- goto("checkgame");
- }
- if(inv_slot == 48) {
- comms_freq = item.getAmount(inv.getItem(inv, 49)) - 1;
- } elseif(inv_slot == 50) {
- comms_freq = item.getAmount(inv.getItem(inv, 49)) + 1;
- } else {
- goto("checkgame");
- }
- if(comms_freq < 1 || comms_freq > 64) {
- goto("checkgame");
- }
- inv.setItem(inv, 49, item.create("BLACK_STAINED_GLASS_PANE", comms_freq, null, null));
- player_uuid = player.getUuid(player);
- comms_state = map.get(comms_state_map, player_uuid);
- diff = math.abs(comms_freq - comms_fix_freq);
- if(diff == 0) {
- if(comms_state != 2) {
- comms.drawCorrect(inv, player);
- }
- list.add(comms_fix_list, player_uuid);
- map.add(comms_fix_map, player_uuid, time.getMillis());
- sgoto(40, "scheduled_fix_comms");
- goto("checkgame");
- } elseif(diff < 4) {
- if(comms_state != 1) {
- comms.drawClose(inv, player);
- }
- map.remove(comms_fix_map, player_uuid);
- } else {
- if(comms_state != 0) {
- comms.drawWorst(inv, player);
- }
- map.remove(comms_fix_map, player_uuid);
- }
- goto("checkgame");
- }
- if(title_string == "§cFix Lights") {
- if(!lights_sabotaged) {
- goto("checkgame");
- }
- item_type = item.getType(item);
- if(item_type == red_glass_mat) {
- inv.setItem(lights_inv, inv_slot, item.create("GREEN_STAINED_GLASS_PANE", 1, "§fOn", null));
- c = 0;
- for(i = 0; i < 9; i+=2) {
- if(item.getType(inv.getitem(lights_inv, i)) == green_glass_mat) {
- c++;
- }
- }
- if(c == 5) {
- fix_light();
- }
- goto("checkgame");
- }
- if(item_type == green_glass_mat) {
- inv.setItem(lights_inv, inv_slot, item.create("RED_STAINED_GLASS_PANE", 1, "§fOff", null));
- }
- goto("checkgame");
- }
- if(title_string == "§cDownload Data") {
- if(customitem.isDownArrow(item)) {
- inv.setItem(inv, 22, gray_glass);
- goto("download_data_2");
- }
- goto("checkgame");
- }
- if(title_string == "§cUpload Data") {
- if(customitem.isUpArrow(item)) {
- inv.setItem(inv, 22, gray_glass);
- goto("download_data_2");
- }
- goto("checkgame");
- }
- if(title_string == "§cFuel") {
- task_id = 1;
- step = task.getStep(player, task_id);
- if(step == 1 || step == 3 || step == 4) {
- goto("checkgame");
- }
- if(customitem.isDownArrow(item)) {
- player_uuid = player.getUuid(player);
- c = map.getOrDefault(fuel_counter, player_uuid, 0);
- if((c + 2) % 9 == 0) {
- c += 2;
- }
- inv.setItem(inv, c++, light_gray_glass);
- map.add(fuel_counter, player_uuid, c);
- if(c == 52) {
- step = task.stepIncrease(player, task_id);
- map.remove(fuel_counter, player_uuid);
- removeTaskParticle(player, get_fuel_par_loc);
- if(step == 1) {
- addTaskParticle(player, upper_engine_par_loc);
- giveTask(player, task_id, "UE", "Fuel Engines", 1, 4, null);
- sgoto_auto_close_inv(player_uuid);
- } elseif(step == 3) {
- addTaskParticle(player, lower_engine_par_loc);
- giveTask(player, task_id, "LE", "Fuel Engines", 3, 4, null);
- sgoto_auto_close_inv(player_uuid);
- }
- }
- }
- goto("checkgame");
- }
- if(title_string == "§cEngine") {
- task_id = 1;
- step = task.getStep(player, task_id);
- if(step == 0 || step == 2 || step == 4) {
- goto("checkgame");
- }
- if(customitem.isUpArrow(item)) {
- player_uuid = player.getUuid(player);
- c = map.getOrDefault(fuel_counter, player_uuid, 51);
- if((c + 1) % 9 == 0) {
- c -= 2;
- }
- inv.setItem(inv, c--, lime_terra_item);
- map.add(fuel_counter, player_uuid, c);
- if(c == -1) {
- map.remove(fuel_counter, player_uuid);
- if(step == 1) {
- removeTaskParticle(player, upper_engine_par_loc);
- addTaskParticle(player, get_fuel_par_loc);
- giveTask(player, task_id, "STO", "Fuel Engines", 2, 4, null);
- sgoto_auto_close_inv(player_uuid);
- } elseif(step == 3) {
- removeTaskParticle(player, lower_engine_par_loc);
- giveTask(player, task_id, "LE", "Fuel Engines", 4, 4, null);
- sgoto_auto_close_inv(player_uuid);
- }
- step = task.stepIncrease(player, task_id);
- }
- }
- goto("checkgame");
- }
- goto("checkgame");
- @score_evaluation
- sort_array = map.sort(vote_count_map, false);
- //Ausgabe der Votes
- minigame.speakAll(gamename, "§0------------------------");
- sort_array_size = array.getSize(sort_array);
- for(i = 0; i < sort_array_size; i++) {
- p_uuid = sort_array[i, 0];
- value = sort_array[i, 1];
- if(p_uuid == "skip") {
- minigame.speakAll(gamename, string.concat("Skipped: ", string.number(value)));
- } else {
- minigame.speakAll(gamename, string.concat(amongus.getPlayerColorCode(p_uuid), player.getName(p_uuid), "§r ", string.number(value)));
- }
- }
- //Auswertung der Votes
- if(sort_array_size == 0) {
- message = "Nobody voted (Skipped).";
- minigame.speakAll(gamename, message);
- minigame.titleAll("Voting ended", message, 20, 60, 20);
- continueGame();
- goto("checkgame");
- } elseif(sort_array_size == 1) {
- kick_uuid = sort_array[0, 0];
- } else {
- value_0 = sort_array[0, 1];
- value_1 = sort_array[1, 1];
- if(value_0 > value_1) {
- kick_uuid = sort_array[0, 0];
- } else {
- message = "No one ejected (Tie).";
- minigame.speakAll(gamename, message);
- minigame.titleAll("Voting ended", message, 20, 60, 20);
- continueGame();
- goto("checkgame");
- }
- }
- if(kick_uuid == "skip") {
- message = "No one ejected (Skipped).";
- minigame.speakAll(gamename, message);
- minigame.titleAll("Voting ended", message, 20, 60, 20);
- continueGame();
- goto("checkgame");
- }
- //Vollstreckung
- if(confirm_ejects) {
- if(isImpostor(kick_uuid)) {
- message = "§r was an §cimpostor§r.";
- } else {
- message = "§r was a §bcrewmate§r.";
- }
- } else {
- message = "§r was ejected.";
- }
- message = string.concat(amongus.getPlayerColorCode(kick_uuid), player.getName(kick_uuid), message);
- minigame.speakAll(gamename, message);
- list.add(ghosts, kick_uuid);
- list.remove(impostors_list_3, kick_uuid);
- kick_player = player.get(kick_uuid);
- player.hideOnline(kick_player);
- amongus.removeEquip(kick_player);
- minigame.titleAll("Voting ended", message, 20, 60, 20);
- //Checkwin
- imps_alive = 0;
- crew_alive = 0;
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- if(!player.isGhost(p)) {
- if(isImpostor(p)) {
- imps_alive++;
- } else {
- crew_alive++;
- }
- }
- }
- boss.removeAll(meeting_bar);
- if(imps_alive == 0) {
- winners = "§bCrewmates";
- goto("win");
- }
- if(imps_alive >= crew_alive) {
- winners = "§cImpostors";
- goto("win");
- }
- continueGame();
- goto("checkgame");
- @player_quit
- @player_giveup
- minigame.speakAll(gamename, string.concat(amongus.getPlayerColorCode(player), player.getName(player), " §rhas left the game."));
- player.setGamemode(player, "SURVIVAL");
- boss.removePlayer(progress_bar, player);
- boss.removePlayer(meeting_bar, player);
- boss.removePlayer(sabotage_cooldown_bar, player);
- my_kill_bar = map.get(imp_kill_bars, player.getUuid(player));
- if(my_kill_bar != null) {
- boss.removePlayer(my_kill_bar, player);
- }
- script = script.getFromId(script_id);
- minigame.kickplayer(script, player);
- player.gameMute(player, false);
- player.showOnline(player);
- living.setInvisible(player, false);
- if(isImpostor(player)) {
- list.remove(impostors_list_2, player_uuid);
- list.remove(impostors_list_3, player_uuid);
- }
- //Building-Perms wieder geben
- player_uuid = player.getUuid(player);
- if(list.contains(removed_perms, player_uuid)) {
- list.remove(removed_perms, player_uuid);
- //PERMS perm.registerPlayer(player_uuid, 1);
- //PERMS perm.registerPlayer(player_uuid, 15);
- }
- if(freeplay) {
- removeDeadBodies();
- removeCamBodies();
- minigame.kickAllPlayers(script);
- minigame.term(script, gamesignloc);
- term();
- }
- //checkwin
- imps_alive = 0;
- crew_alive = 0;
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- if(!player.isGhost(p)) {
- if(isImpostor(p)) {
- imps_alive++;
- } else {
- crew_alive++;
- }
- }
- }
- if(imps_alive == 0) {
- winners = "§bCrewmates";
- goto("win");
- }
- if(imps_alive >= crew_alive) {
- winners = "§cImpostors";
- goto("win");
- }
- if(!player.isGhost(player)) {
- amongus.removeFromAdminTable(player);
- }
- amount_all_tasks = (amount_short + amount_common + amount_long) * crew_alive;
- pct = amount_done_tasks / amount_all_tasks;
- boss.setProgress(progress_bar, pct);
- if(meeting) {
- //Vote des leavenden Spielers entfernen
- vote_uuid = map.get(vote_count_map_2, player_uuid);
- if(vote_uuid != null) {
- votes = map.get(vote_count_map, vote_uuid) - 1;
- if(votes == 0) {
- map.remove(vote_count_map, vote_uuid);
- } else {
- map.add(vote_count_map, vote_uuid, votes);
- }
- map.remove(vote_count_map_2, player_uuid);
- }
- //Alle Votes entfernen, die auf den leavenden Spieler lauten
- iter = map.iterator(vote_count_map_2);
- while(hasNext(iter)) {
- element = next(iter);
- vote_uuid = map.getValue(element);
- if(vote_uuid == player_uuid) {
- //Spieler neu voten lassen
- voter_uuid = map.getKey(element);
- remove(iter);
- map.remove(vote_count_map_2, voter_uuid);
- //Vote-Menu aktualisieren
- index = list.getIndexOf(all_list, voter_uuid);
- voted_slot = index * 4;
- setItemInVoteInv(voted_slot, air_item);
- }
- }
- //Vote-Menu aktualisieren
- index = list.getIndexOf(all_list, player_uuid);
- voted_slot = index * 4;
- setItemInVoteInv(voted_slot, zombie_head);
- }
- goto("checkgame");
- @player_data_tick
- if(var == "Discussion Time") {
- player.giveItem(player, open_vote_menu_item);
- tick_time = vote_time * 20; //s
- boss.setTitle(meeting_bar, "Voting Time");
- updateMeetingBar(vote_time, false);
- data.setTimer(player, "Voting Time", tick_time - 20);
- vote_inv = getVoteInv(player);
- inv.open(vote_inv, player);
- data.setTimer(player, "sound.vote.end.10", tick_time - 200);
- data.setTimer(player, "sound.vote.end.5", tick_time - 100);
- data.setTimer(player, "sound.vote.end.4", tick_time - 80);
- data.setTimer(player, "sound.vote.end.3", tick_time - 60);
- data.setTimer(player, "sound.vote.end.2", tick_time - 40);
- data.setTimer(player, "sound.vote.end.1", tick_time - 20);
- goto("checkgame");
- }
- if(!meeting) {
- goto("checkgame");
- }
- if(var == "Voting Time") {
- boss.removeAll(meeting_bar);
- goto("score_evaluation");
- }
- if(var == "sound.vote.end.10") {
- sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
- goto("checkgame");
- }
- if(var == "sound.vote.end.5") {
- sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
- goto("checkgame");
- }
- if(var == "sound.vote.end.4") {
- sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
- goto("checkgame");
- }
- if(var == "sound.vote.end.3") {
- sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
- goto("checkgame");
- }
- if(var == "sound.vote.end.2") {
- sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
- goto("checkgame");
- }
- if(var == "sound.vote.end.1") {
- sound.spawnForPlayer(player, vote_ends_sound, master_sound_category);
- goto("checkgame");
- }
- goto("checkgame");
- @player_drop
- cancel = true;
- goto("checkgame");
- function getInvSlotFromItem(player, item) {
- inv = player.getInv(player);
- for(i = 0; i < inv.getSize(inv); i++) {
- if(item == inv.getItem(inv, i)) {
- return i;
- }
- }
- return -1;
- }
- function giveCrewmateItems(player) {
- //nothing
- }
- function removeImpostorItems(player) {
- player.removeItem(player, $kill_item);
- player.removeItem(player, $sabotage_item);
- }
- function giveImpostorItems(player) {
- player.giveItem(player, $kill_item);
- player.giveItem(player, $sabotage_item);
- }
- function giveSpeedrunnerItems(player) {
- //nothing
- }
- function setSpeedrunner(player) {
- player_uuid = player.getUuid(player);
- map.add($roles, player_uuid, "speedrunner");
- msg.prefix(player, $gamename, "You are §dSpeedrunner!");
- giveSpeedrunnerItems(player);
- sb.add(player, 99, "You are §dSpeedrunner");
- }
- function setImpostor(player) {
- data.setTimer(player, "Kill Cooldown", $start_kill_cooldown * 20);
- player_uuid = player.getUuid(player);
- map.add($roles, player_uuid, "impostor");
- my_kill_bar = createKillBossBar(player);
- updateKillBossBar(my_kill_bar, $start_kill_cooldown);
- list.add($impostors_list, player_uuid);
- list.add($impostors_list_2, player_uuid);
- list.add($impostors_list_3, player_uuid);
- msg.prefix(player, $gamename, "You are §cImpostor!");
- giveImpostorItems(player);
- sb.add(player, 99, "You are §cImpostor");
- sb.add(player, 98, "§cFake Tasks:");
- }
- function createKillBossBar(player) {
- player_uuid = player.getUuid(player);
- my_kill_bar = boss.create("Kill Cooldown", "PURPLE", "SOLID");
- boss.setProgress(my_kill_bar, 0);
- boss.addPlayer(my_kill_bar, player);
- map.add($imp_kill_bars, player_uuid, my_kill_bar);
- return my_kill_bar;
- }
- function updateKillBossBar(bar, time) {
- if(time < 0) {
- time = 0;
- boss.setProgress(bar, 1);
- boss.setTitle(bar, string.concat("Kill Cooldown: 0"));
- return;
- }
- boss.setProgress(bar, ($kill_cooldown - time) / $kill_cooldown);
- boss.setTitle(bar, string.concat("Kill Cooldown: ", string.number(math.roundDown(time))));
- }
- function updateSabotageCooldownBar(time) {
- if(time < 0) {
- time = 0;
- boss.setProgress($sabotage_cooldown_bar, 1);
- boss.setTitle($sabotage_cooldown_bar, string.concat("Sabotage Cooldown: 0"));
- return;
- }
- boss.setProgress($sabotage_cooldown_bar, ($default_sabo_cooldown - time) / $default_sabo_cooldown);
- boss.setTitle($sabotage_cooldown_bar, string.concat("Sabotage Cooldown: ", string.number(math.roundDown(time))));
- }
- function updateMeetingBar(time, discussion) {
- if(time < 0) {
- time = 0;
- return;
- }
- if(discussion) {
- progress = time / $discuss_time;
- pre_title = "Discussion Time";
- } else {
- progress = time / $vote_time;
- pre_title = "Voting Time";
-
- }
- boss.setTitle($meeting_bar, string.concat(pre_title, ": ", string.number(math.roundDown(time))));
- boss.setProgress($meeting_bar, progress);
- }
- function setCrewmate(player) {
- map.add($roles, player.getUuid(player), "crewmate");
- msg.prefix(player, $gamename, "You are §bCrewmate.");
- giveCrewmateItems(player);
- sb.add(player, 99, "You are §bCrewmate");
- }
- function isSpeedrunner(player_or_uuid) {
- if(isPlayer(player_or_uuid)) {
- player_or_uuid = player.getUuid(player_or_uuid);
- }
- role = map.get($roles, player_or_uuid);
- return role == "impostor";
- }
- function isImpostor(player_or_uuid) {
- if(isPlayer(player_or_uuid)) {
- player_or_uuid = player.getUuid(player_or_uuid);
- }
- role = map.get($roles, player_or_uuid);
- return role == "impostor";
- }
- function isCrewmate(player_or_uuid) {
- if(isPlayer(player_or_uuid)) {
- player_or_uuid = player.getUuid(player_or_uuid);
- }
- role = map.get($roles, player_or_uuid);
- return role == "crewmate";
- }
- function player.isGhost(player_or_uuid) {
- if(isPlayer(player_or_uuid)) {
- player_or_uuid = player.getUuid(player_or_uuid);
- }
- return list.contains($ghosts, player_or_uuid);
- }
- function tpAllMiddle(reporter) {
- $vote_count_map = map.new(); //Wieviel Spieler haben einen Spieler gevoted
- $vote_count_map_2 = map.new(); //Welcher Spieler hat für wen gevoted
- amongus.setMeeting(true);
- $reactor_used = false;
- removeDeadBodies();
- amongus.clearAdminTable();
- boss.setTitle($meeting_bar, "Discussion Time");
- updateMeetingBar($discuss_time, true);
- hideSabotageCooldownBar();
- if($lights_sabotaged) {
- switchLights(true);
- }
- for(i = 0; i < list.getSize($player_list); i++) {
- p_uuid = list.getIndex($player_list, i);
- p = player.get(p_uuid);
- createVoteInv(p, player.getUuid(reporter));
- if(list.contains($vent_list, p_uuid)) {
- vent_leave(p);
- }
- if(player.isOnCam(p)) {
- cam.leave(p);
- }
- amongus.manageEffects(p);
- entity.teleport(p, list.getIndex($spawn_locs, i));
- player.setSpeed(p, 0);
- inv.close(p);
- data.setTimer(p, "Discussion Time", $discuss_time * 20);
- boss.addPlayer($meeting_bar, p);
- }
- iter = iterator($impostors_list_3);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- kill_bar = map.get($imp_kill_bars, p_uuid);
- boss.removePlayer(kill_bar, player.get(p_uuid));
- }
- }
- function fix_oxygen() {
- if($oxygen_sabotaged) {
- amongus.setAlert(false);
- $oxygen_sabotaged = false;
- hideSabotageDisplay();
- setSaboCooldown($default_sabo_cooldown);
- sgoto(40, "scheduled_sabo_close");
- }
- }
- function fix_light() {
- amongus.setAlert(false);
- $lights_sabotaged = false;
- removeSaboParticles($fix_lights_par_loc_1, $fix_lights_par_loc_2);
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- hideSabotageDisplay();
- amongus.manageEffects(p);
- }
- setSaboCooldown($default_sabo_cooldown);
- switchLights(true);
- sgoto(40, "scheduled_sabo_close");
- }
- function hideSabotageCooldownBar() {
- iter = iterator($impostors_list_2);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- boss.removePlayer($sabotage_cooldown_bar, p);
- }
- }
- function sabotage_oxygen() {
- hideSabotageCooldownBar();
- amongus.setAlert(true);
- $oxygen_sabotaged = true;
- $oxy_fixed_1 = false;
- $oxy_fixed_2 = false;
- $depletion_time = 30;
- addSaboParticles($fix_o2_par_loc_1, $fix_o2_par_loc_2);
- displaySabotage("§cO2/ADM | Fix Oxygen ", 0, 2, $depletion_time);
- $oxy_code = math.random(10000, 99999);
- sgoto(20, "oxygen_depletion");
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- title.send(p, text.new("§cSabotage!!!"), text.new("Oxygen Depletion"));
- }
- sgoto(20, "crit_sabo_sound_loop");
- }
-
- @oxygen_depletion
- if(!oxygen_sabotaged) {
- goto("checkgame");
- }
- depletion_time--;
- fixed = 0;
- if(oxy_fixed_1) {
- fixed++;
- }
- if(oxy_fixed_2) {
- fixed++;
- }
- displaySabotage("§cO2/ADM | Fix Oxygen ", fixed, 2, depletion_time);
- if(depletion_time == 0) {
- if(freeplay) {
- minigame.speakAll($gamename, "Normally the impostors would have just won because of the critical sabotage. Instead we just shut it off.");
- removeSaboParticles(fix_o2_par_loc_1, fix_o2_par_loc_2);
- fix_oxygen();
- } else {
- winners = "§cImpostors";
- goto("win");
- }
- goto("checkgame");
- }
- sgoto(20, "oxygen_depletion");
- goto("checkgame");
- @crit_sabo_sound_loop
- if(!amongus.isAlert()) {
- goto("checkgame");
- }
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- sound.spawnForPlayer(p, crit_sabo_sound, master_sound_category);
- }
- sgoto(20, "crit_sabo_sound_loop");
- goto("checkgame");
- function sabotage_reactor() {
- hideSabotageCooldownBar();
- amongus.setAlert(true);
- $reactor_sabotaged = true;
- $hold_reactor_1 = false;
- $hold_reactor_2 = false;
- addSaboParticles($fix_reactor_par_loc_1, $fix_reactor_par_loc_2);
- $meltdown_time = 30;
- displaySabotage("§cREA | Prevent Meltdown ", 0, 2, $meltdown_time);
- sgoto(20, "meltdown");
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- title.send(p, text.new("§cSabotage!!!"), text.new("Reactor Meltdown"));
- }
- sgoto(20, "crit_sabo_sound_loop");
- }
- @meltdown
- if(!reactor_sabotaged) {
- goto("checkgame");
- }
- meltdown_time--;
- holded = 0;
- if(hold_reactor_1) {
- holded++;
- }
- if(hold_reactor_2) {
- holded++;
- }
- displaySabotage("§cREA | Preven Meltdown ", holded, 2, meltdown_time);
- if(meltdown_time == 0) {
- if(freeplay) {
- minigame.speakAll($gamename, "Normally the impostors would have just won because of the critical sabotage. Instead we just shut it off.");
- fix_meltdown();
- } else {
- winners = "§cImpostors";
- goto("win");
- }
- goto("checkgame");
- }
- sgoto(20, "meltdown");
- goto("checkgame");
- function setSaboCooldown(sabotage_cooldown) {
- iter = iterator($impostors_list_2);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- data.setTimer(p, "Sabotage Cooldown", sabotage_cooldown * 20);
- boss.addPlayer($sabotage_cooldown_bar, p);
- updateSabotageCooldownBar(sabotage_cooldown);
- }
- }
- function fix_meltdown() {
- $reactor_sabotaged = false;
- amongus.setAlert(false);
- removeSaboParticles($fix_reactor_par_loc_1, $fix_reactor_par_loc_2);
- hideSabotageDisplay();
- setSaboCooldown($default_sabo_cooldown);
- sgoto(40, "scheduled_sabo_close");
- }
- function fix_comms() {
- $comms_sabotaged = false;
- amongus.setAlert(false);
- removeSaboParticles($fix_comms_par_loc, null);
- hideSabotageDisplay();
- setSaboCooldown($default_sabo_cooldown);
- showTasks();
- sgoto(40, "scheduled_sabo_close");
- }
- function sabotage_comms() {
- hideSabotageCooldownBar();
- amongus.setAlert(true);
- $comms_sabotaged = true;
- addSaboParticles($fix_comms_par_loc, null);
- $comms_fix_freq = math.random(1, 64);
- while($comms_fix_freq == 32) {
- $comms_fix_freq = math.random(1, 64);
- }
- displaySabotage("§cCOM | Fix Comms", 1, 1, null);
- boss.setTitle($progress_bar, "COMMS DISABLED");
- boss.setProgress($progress_bar, 0);
- hideTasks();
- }
- function hideTasks() {
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- if(isCrewmate(p) || $freeplay) {
- for(i = 81; i < 98; i++) {
- sb.remove(p, i);
- }
- }
- }
- }
- function showTasks() {
- boss.setProgress($progress_bar, $amount_done_tasks / $amount_all_tasks);
- boss.setTitle($progress_bar, "TOTAL TASKS COMPLETED");
- iter = iterator($player_list);
- while(hasNext(iter)) {
- player_uuid = next(iter);
- player = player.get(player_uuid);
- if(isCrewmate(player) || $freeplay) {
- set = map.get($player_tasks, player_uuid);
- iterator(set);
- task_iter = iterator(set);
- while(hasNext(task_iter)) {
- task_id = next(task_iter);
- a = map.get($all_tasks, task_id);
- room = a[0];
- description = a[1];
- step = task.getStep(player, task_id);
- number_2 = a[3];
- time = null;
- if(time != null) {
- color = "§e";
- } elseif(step == 0) {
- color = "§r";
- } elseif(step == number_2) {
- color = "§a";
- } else {
- color = "§e";
- }
-
- if(task_id == 12) {
- if(step == 0) {
- r = map.get($empty_garb_map_3, player_uuid);
- if(r == 0) {
- room = "CAF";
- } else {
- room = "O2";
- }
- } else {
- room = "STO";
- }
- }
- if(task_id == 2) {
- if(step == 0) {
- r = map.get($download_map_3, player_uuid);
- room = map.get($download_map_4, list.getIndex($download_list_3, r));
- } else {
- room = "ADM";
- description = "Upload Data";
- }
- }
- if(task_id == 10) {
- my_list = map.get($wires_map_4, player_uuid);
- if(step == 3) {
- wire_loc = list.getIndex(my_list, 2);
- } else {
- wire_loc = list.getIndex(my_list, step);
- }
- room = map.get($wires_map_3, wire_loc);
- } elseif(task_id == 14) {
- r = map.get($divert_pow_map_3, player_uuid);
- room_2 = map.get($divert_pow_map_5, r);
- description = string.concat("Divert power to ", room_2);
- if(step != 0) {
- room = room_2;
- }
- }
- sb_id = a[4];
- if((number_2 == 1 && time == null) || time == 0) {
- sb.add(player, sb_id, string.concat(color, room, " §8| ", color, description));
- } elseif(time != null) {
- sb.add(player, sb_id, string.concat(color, room, " §8| ", color, description, " (", string.number(time), ")"));
- } else {
- sb.add(player, sb_id, string.concat(color, room, " §8| ", color, description, " (", string.number(step), "/", string.number(number_2), ")"));
- }
- }
- }
- }
- }
- @scoreboard_toggler
- if(sbtoggle) {
- sbToggle.hideTasks();
- sbtoggle = false;
- } elseif(!comms_sabotaged) {
- showTasks();
- sbtoggle = true;
- }
- sgoto(100, "scoreboard_toggler");
- goto("checkgame");
- function sbToggle.hideTasks() {
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- for(i = 84; i < 98; i++) {
- sb.remove(p, i);
- }
- }
- }
- function sabotage_light() {
- hideSabotageCooldownBar();
- amongus.setAlert(true);
- $lights_sabotaged = true;
- addSaboParticles($fix_lights_par_loc_1, $fix_lights_par_loc_2);
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- amongus.manageEffects(p);
- }
- displaySabotage("§cELE | Fix Lights", 1, 1, null);
- inv.setItem($lights_inv, 0, item.create("RED_STAINED_GLASS_PANE", 1, "§fOff", null));
- for(i = 0; i < 9; i+=2) {
- r = math.random(0, 1);
- if(r == 0) {
- inv.setItem($lights_inv, i, item.create("GREEN_STAINED_GLASS_PANE", 1, "§fOn", null));
- } else {
- inv.setItem($lights_inv, i, item.create("RED_STAINED_GLASS_PANE", 1, "§fOff", null));
- }
- }
- switchLights(false);
- }
- function hideSabotageDisplay() {
- minigame.displayRemoveAll(80);
- }
- function displaySabotage(text, number_1, number_2, time) {
- if(time == null) {
- if(number_2 == 1) {
- minigame.displayAll(80, text);
- } else {
- minigame.displayAll(80, string.concat(text, " (", string.number(number_1), "/", string.number(number_2), ")"));
- }
- } else {
- if(number_2 == 1) {
- minigame.displayAll(80, text, string.number(time));
- } else {
- minigame.displayAll(80, string.concat(text, string.number(time), " (", string.number(number_1), "/", string.number(number_2), ")"));
- }
- }
- }
- function callMeeting(reporter) {
- reporter_uuid = player.getUuid(reporter);
- amount = map.get($meeting_amounts, reporter_uuid);
- if(amount <= 0) {
- msg.prefix(reporter, $gamename, "You have no emergency meetings left.");
- return;
- }
- cooldown = data.getTimer(reporter, "Meeting Cooldown");
- if(cooldown == null || cooldown == -1) {
- tpAllMiddle(reporter);
- reporter_name = player.getName(reporter);
- color_code = amongus.getPlayerColorCode(reporter);
- minigame.titleAll("§cEMERGENY MEETING", string.concat("called by ", color_code, reporter_name), 20, 60, 20);
- minigame.speakAll($gamename, string.concat(color_code, reporter_name, " §rcalls an emergency meeting!"));
- new_amount = amount - 1;
- map.add($meeting_amounts, reporter_uuid, new_amount);
- msg.prefix(reporter, $gamename, string.concat("You have §c", string.number(new_amount), "§r emergeny meetings left."));
- } else {
- msg.prefix(reporter, $gamename, string.concat("Remaining meeting cooldown: ", string.number(math.roundDown(cooldown / 20)), "s"));
- }
- }
- function reportBody(reporter, found_player_uuid) {
- tpAllMiddle(reporter);
- reporter_name = player.getName(reporter);
- found_player_name = player.getName(found_player_uuid);
- minigame.titleAll("§cREPORT", string.concat(reporter_name, " found ", found_player_name), 20, 60, 20);
- minigame.speakAll($gamename, string.concat(amongus.getPlayerColorCode(reporter), reporter_name, " §rfound the body of ", amongus.getPlayerColorCode(found_player_uuid), found_player_name, "."));
- if(amongus.isAlert()) {
- if($oxygen_sabotaged) {
- fix_oxygen();
- }
- if($reactor_sabotaged) {
- fix_meltdown();
- }
- }
- }
- function continueGame() {
- $meeting = false;
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- inv.close(p);
- amongus.manageEffects(p);
- if(player.isGhost(p)) {
- player.setSpeed(p, $move_speed * 1.5);
- } else {
- player.removeItem(p, $open_vote_menu_item);
- player.setSpeed(p, $move_speed);
- if(isImpostor(p) && !player.isGhost(p)) {
- data.setTimer(p, "Kill Cooldown", $kill_cooldown * 20);
- kill_bar = map.get($imp_kill_bars, p_uuid);
- updateKillBossBar(kill_bar, $kill_cooldown);
- }
- }
- boss.removeAll($meeting_bar);
- data.setTimer(p, "Voting Time", -1);
- data.setTimer(p, "Meeting Cooldown", $meeting_cooldown * 20);
- }
- if($lights_sabotaged) {
- sabotage_light();
- return;
- }
- if(!amongus.isAlert()) {
- setSaboCooldown($default_sabo_cooldown);
- }
- }
- function killCrewmate(killer, crewmate) {
- loc = entity.getLocation(crewmate);
- sound.spawnForPlayer(killer, $kill_sound, $master_sound_category);
- sound.spawnForPlayer(crewmate, $kill_sound, $master_sound_category);
- killer_name = player.getName(killer);
- killer_color_code = amongus.getPlayerColorCode(killer);
- msg.prefix(crewmate, $gamename, string.concat(killer_color_code, killer_name, "§r killed you."));
- msg.prefix(killer, $gamename, string.concat("You killed ", amongus.getPlayerColorCode(crewmate), player.getName(crewmate), "§r."));
- //Killer zu Mord-Location teleportieren
- entity.teleport(killer, loc);
- data.setTimer(killer, "Kill Cooldown", $kill_cooldown * 20);
- kill_bar = map.get($imp_kill_bars, player.getUuid(killer));
- updateKillBossBar(kill_bar, $kill_cooldown);
- //Crewmate zum Geist machen
- amongus.manageEffects(crewmate);
- player.hideOnline(crewmate);
- crew_uuid = player.getUuid(crewmate);
- list.add($ghosts, crew_uuid);
- amongus.removeEquip(crewmate);
- title.send(crewmate, text.new("§cKILLED!!!"), text.new(string.concat("by ", killer_color_code, killer_name)));
- inv.close(crewmate);
- $reactor_used = false;
- sabotage.closedInv(crewmate);
- player.setSpeed(crewmate, $move_speed * 1.5);
- //Leiche an Mord-Location platzieren
- ent = entity.spawn(loc, "ZOMBIE");
- list.add($dead_bodies, ent);
- map.add($report_map, ent, crew_uuid);
- living.setAi(ent, false);
- living.setHand(ent, $air_item);
- entity.setSilent(ent, true);
- living.setInvisible(ent, true);
- color = amongus.getPlayerColor(crewmate);
- amongus.equip(ent, color);
- }
- function amongus.clearAdminTable() {
- map.clear($admin_table_map);
- map.clear($admin_table_map_2);
- }
- function amongus.removeFromAdminTable(player) {
- player_uuid = player.getUuid(player);
- room_id = map.get($admin_table_map, player_uuid);
- if(room_id == null) {
- return;
- }
- map.remove($admin_table_map, player_uuid);
- map.add($admin_table_map_2, room_id, map.get($admin_table_map_2, room_id) - 1);
- }
- function removeCamBodies() {
- iter = map.iterator($cam_map_3);
- while(hasNext(iter)) {
- element = next(iter);
- citizen.destroy(map.getValue(element));
- }
- }
- function removeDeadBodies() {
- iter = iterator($dead_bodies);
- while(hasNext(iter)) {
- entity.remove(next(iter));
- }
- }
- function task.getSbId(task_id) {
- a = map.get($all_tasks, task_id);
- return a[4];
- }
- function registerTask(task_id, sb_id, room, description, steps_amount) {
- a = array.new(5);
- a[0] = room;
- a[1] = description;
- a[2] = 0; //starting step
- a[3] = steps_amount;
- a[4] = sb_id;
- map.add($all_tasks, task_id, a);
- }
- function giveTask(player, task_id, room, description, number_1, number_2, time) {
- player_uuid = player.getUuid(player);
- if(time != null) {
- color = "§e";
- } elseif(number_1 == 0) {
- color = "§r";
- } elseif(number_1 == number_2) {
- sound.spawnForPlayer(player, $task_sound, $master_sound_category);
- $amount_done_tasks++;
- color = "§a";
- if(!$comms_sabotaged) {
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- pct = $amount_done_tasks / $amount_all_tasks;
- boss.setProgress($progress_bar, pct);
- if(pct == 1) {
- sgoto(2, "crewmate_win");
- }
- }
- }
- } else {
- color = "§e";
- }
- step = task.getStep(player, task_id);
- if(step == 0) {
- if(task_id == 1) {
- addTaskParticle(player, $get_fuel_par_loc);
- } elseif(task_id == 2) {
- r = map.getOrDefault($download_map_3, player_uuid, math.random(0, 4));
- map.add($download_map_3, player_uuid, r);
- addTaskParticle(player, list.getIndex($download_list_4, r));
- room = map.get($download_map_4, list.getIndex($download_list_3, r));
- } elseif(task_id == 3) {
- addTaskParticle(player, $prime_shields_par_loc);
- } elseif(task_id == 4) {
- addTaskParticle(player, $start_reactor_par_loc);
- } elseif(task_id == 5) {
- addTaskParticle(player, $unlock_manifolds_par_loc);
- } elseif(task_id == 6) {
- addTaskParticle(player, $chart_course_par_loc);
- } elseif(task_id == 7) {
- addTaskParticle(player, $steering_par_loc);
- } elseif(task_id == 8 && time == null) {
- addTaskParticle(player, $inspect_par_loc);
- } elseif(task_id == 9) {
- addTaskParticle(player, $calibrate_dist_par_loc);
- } elseif(task_id == 11) {
- addTaskParticle(player, $swipe_card_par_loc);
- } elseif(task_id == 13) {
- addTaskParticle(player, $clear_ast_par_loc);
- } elseif(task_id == 15) {
- addTaskParticle(player, $clean_o2_par_loc);
- } elseif(task_id == 16) {
- addTaskParticle(player, $scan_par_loc);
- } elseif(task_id == 17) {
- addTaskParticle(player, $ue_align_par_loc);
- addTaskParticle(player, $le_align_par_loc);
- }
- }
- if(task_id == 12) {
- if(step == 0) {
- r = map.getOrDefault($empty_garb_map_3, player_uuid, math.random(0, 1));
- map.add($empty_garb_map_3, player_uuid, r);
- if(r == 0) {
- addTaskParticle(player, $cafe_garb_par_loc);
- room = "CAF";
- } else {
- addTaskParticle(player, $o2_garb_par_loc);
- room = "O2";
- }
- } else {
- room = "STO";
- }
- }
- if(task_id == 10) {
- my_list = map.getOrDefault($wires_map_4, player_uuid, list.new());
- if(step == 0) {
- //Electrical > Storage > Admin > Navigation > Cafeteria > Security
- //1.Wire
- index_1 = math.random(0, 3);
- wire_loc_1 = list.getIndex($wires_list_2, index_1);
- list.add(my_list, wire_loc_1);
- //2.Wire
- index_2 = math.random(1 + index_1, 4);
- wire_loc_2 = list.getIndex($wires_list_2, index_2);
- while(list.contains(my_list, wire_loc_2)) {
- index_2 = math.random(1 + index_1, 4);
- wire_loc_2 = list.getIndex($wires_list_2, index_2);
- }
- list.add(my_list, wire_loc_2);
- //3.Wire
- index_3 = math.random(1 + index_2, 5);
- wire_loc_3 = list.getIndex($wires_list_2, index_3);
- while(list.contains(my_list, wire_loc_3)) {
- index_3 = math.random(1 + index_2, 5);
- wire_loc_3 = list.getIndex($wires_list_2, index_3);
- }
- list.add(my_list, wire_loc_3);
- map.add($wires_map_4, player_uuid, my_list);
- }
- if(step < 3) {
- wire_loc = list.getIndex(my_list, step);
- room = map.get($wires_map_3, wire_loc);
- addTaskParticle(player, map.get($wires_map_5, wire_loc));
- if(step > 0) {
- old_wire_loc = list.getIndex(my_list, step - 1);
- removeTaskParticle(player, map.get($wires_map_5, old_wire_loc));
- }
- } else {
- wire_loc = list.getIndex(my_list, 2);
- removeTaskParticle(player, map.get($wires_map_5, wire_loc));
- }
- } elseif(task_id == 14) {
- r = map.getOrDefault($divert_pow_map_3, player_uuid, math.random(36, 43));
- map.add($divert_pow_map_3, player_uuid, r);
- room_2 = map.get($divert_pow_map_5, r);
- description = string.concat("Divert power to ", room_2);
- if(step == 0) {
- addTaskParticle(player, $elec_power_par_loc);
- } else {
- room = room_2;
- }
- }
- if(!$comms_sabotaged) {
- sb_id = task.getSbId(task_id);
- if((number_2 == 1 && time == null) || time == 0) {
- sb.add(player, sb_id, string.concat(color, room, " §8| ", color, description));
- } elseif(time != null) {
- if($sbtoggle && sb_id > 83) {
- sb.add(player, sb_id, string.concat(color, room, " §8| ", color, description, " (", string.number(time), ")"));
- }
- } else {
- sb.add(player, sb_id, string.concat(color, room, " §8| ", color, description, " (", string.number(number_1), "/", string.number(number_2), ")"));
- }
- }
- set = map.get($player_tasks, player_uuid);
- if(set == null) {
- set = set.new();
- }
- set.add(set, task_id);
- map.add($player_tasks, player_uuid, set);
- }
- function sgoto_auto_close_inv(player_uuid) {
- list.add($auto_close_list, player_uuid);
- sgoto(40, "auto_close_inv");
- }
- @auto_close_inv
- p_uuid = list.getIndex(auto_close_list, 0);
- list.removeIndex(auto_close_list, 0);
- if(list.contains(auto_close_list_2, p_uuid)) {
- list.remove(auto_close_list_2, p_uuid);
- } else {
- inv.close(player.get(p_uuid));
- }
- goto("checkgame");
- function hasTask(player, task_id) {
- player_uuid = player.getUuid(player);
- set = map.getOrDefault($player_tasks, player_uuid, set.new());
- return set.contains(set, task_id);
- }
- function addAstDirection(id, x, y) {
- a = array.new(2);
- a[0] = x;
- a[1] = y;
- $ast_directions[id] = a;
- }
- function addAstStartPos(slot, dir_id_1, dir_id_2, dir_id_3) {
- list.add($ast_start_pos, slot);
- my_list = list.new();
- list.add(my_list, dir_id_1);
- list.add(my_list, dir_id_2);
- list.add(my_list, dir_id_3);
- map.add($ast_start_pos_dirs, slot, my_list);
- }
- function getAstDirection(slot) {
- my_list = map.get($ast_start_pos_dirs, slot);
- dir_id = list.getIndex(my_list, math.random(0, 2));
- a = $ast_directions[dir_id];
- return a;
- }
- @loop
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- player.setHunger(p, 4);
- player.setSaturation(p, 0);
- }
- //Kill Cooldown Bossbar
- if(!meeting) {
- iter = iterator(impostors_list_3);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- kill_bar = map.get(imp_kill_bars, p_uuid);
- cooldown = data.getTimer(player.get(p_uuid), "Kill Cooldown");
- updateKillBossBar(kill_bar, cooldown / 20);
- }
- }
- //Meeting Bossbar
- if(meeting) {
- discussion = true;
- p = player.get(list.getIndex(player_list, 0));
- time = data.getTimer(p, "Discussion Time");
- if(time == null || time == -1) {
- time = data.getTimer(p, "Voting Time");
- discussion = false;
- }
- updateMeetingBar(time / 20, discussion);
- }
- //Sabotage Cooldown Bossbar
- if(!freeplay) {
- if(!meeting) {
- p = player.get(list.getIndex(impostors_list_2, 0));
- time = data.getTimer(p, "Sabotage Cooldown");
- updateSabotageCooldownBar(time / 20);
- }
- }
- sgoto(20, "loop");
- goto("checkgame");
- @imp_par_loop
- iter = iterator(impostors_list_2);
- while(hasNext(iter)) {
- p_uuid_1 = next(iter);
- p_1 = player.get(p_uuid_1);
- iter_2 = iterator(impostors_list_2);
- while(hasNext(iter_2)) {
- p_uuid_2 = next(iter_2);
- p_2 = player.get(p_uuid_2);
- if(!player.isGhost(p_2)) {
- p_2_loc = entity.getLocation(p_2);
- loc.add(p_2_loc, 0, 2.3, 0);
- particle.spawnPlayer(p_2_loc, imp_par, p_1);
- }
- }
- }
- sgoto(5, "imp_par_loop");
- goto("checkgame");
- @download_data_2
- player_uuid = player.getUuid(player);
- c = 0;
- inv.setItem(inv, c++, lime_glass);
- map.add(download_counter, player_uuid, c);
- list.add(download_list, player_uuid);
- map.add(download_map, player_uuid, inv);
- sgoto(20, "download_data");
- goto("checkgame");
- @download_data
- task_id = 2;
- player_uuid = list.getIndex(download_list, 0);
- inv = map.get(download_map, player_uuid);
- player = player.get(player_uuid);
- list.removeIndex(download_list, 0);
- c = map.get(download_counter, player_uuid);
- if(list.contains(download_list_2, player_uuid)) {
- goto("checkgame");
- }
- inv.setItem(inv, c++, lime_glass);
- map.add(download_counter, player_uuid, c);
- if(c < 9) {
- list.add(download_list, player_uuid);
- map.add(download_map, player_uuid, inv);
- sgoto(20, "download_data");
- } else {
- inv.setItem(inv, 22, customitem.create("CHECK_GREEN", 1, "§rTask completed", null));
- map.remove(download_counter, player_uuid);
- step = task.getStep(player, task_id);
- step = task.stepIncrease(player, task_id);
- if(step == 1) {
- r = map.get(download_map_3, player_uuid);
- removeTaskParticle(player, list.getIndex(download_list_4, r));
- addTaskParticle(player, admin_upload_par_loc);
- } else {
- removeTaskParticle(player, admin_upload_par_loc);
- }
- giveTask(player, task_id, "ADM", "Upload Data", step, 2, null);
- sgoto_auto_close_inv(player_uuid);
- }
- goto("checkgame");
- @draw_pattern_1
- player_uuid = list.getIndex(reactor_draw_list_1, 0);
- list.removeIndex(reactor_draw_list_1, 0);
- if(list.contains(reactor_block_list, player_uuid)) {
- goto("checkgame");
- }
- reactor_array = reactor.get(player_uuid);
- inv = reactor.getInv(reactor_array);
- stage = reactor.getStage(reactor_array);
- for(i = 0; i <= stage; i++) {
- inv.setItem(inv, i + 2, green_glass);
- }
- reactor.setRightSide(inv, black_glass);
- player = player.get(player_uuid);
- list.add(reactor_draw_list_2, player_uuid);
- goto("draw_pattern_2");
- @draw_pattern_2
- player_uuid = list.getIndex(reactor_draw_list_2, 0);
- list.removeIndex(reactor_draw_list_2, 0);
- if(list.contains(reactor_block_list, player_uuid)) {
- goto("checkgame");
- }
- reactor_array = reactor.get(player_uuid);
- inv = reactor.getInv(reactor_array);
- stage = reactor.getStage(reactor_array);
- counter = reactor.getCounter(reactor_array);
- pattern = reactor.getPattern(reactor_array);
- player = player.get(player_uuid);
- if(counter > stage) {
- reactor.setCounter(reactor_array, 0);
- reactor.setPhase(reactor_array, "click");
- reactor.save(reactor_array, player);
- reactor.setRightSide(inv, gray_glass);
- goto("checkgame");
- }
- inv.setItem(inv, pattern[counter], blue_glass);
- counter++;
- reactor.setCounter(reactor_array, counter);
- reactor.save(reactor_array, player);
- if(counter < 6) {
- list.add(reactor_draw_list_2, player_uuid);
- list.add(reset_reactor_draw_list, player_uuid);
- sgoto(10, "reset_reactor_draw");
- sgoto(12, "draw_pattern_2");
- }
- goto("checkgame");
- @reset_reactor_draw
- player_uuid = list.getIndex(reset_reactor_draw_list, 0);
- list.removeIndex(reset_reactor_draw_list, 0);
- reactor_array = reactor.get(player_uuid);
- inv = reactor.getInv(reactor_array);
- counter = reactor.getCounter(reactor_array) - 1;
- pattern = reactor.getPattern(reactor_array);
- if(counter >= 0) {
- inv.setItem(inv, pattern[counter], black_glass);
- player = player.get(player_uuid);
- }
- goto("checkgame");
- @reset_reactor_click
- player_uuid = list.getIndex(reset_reactor_click_list, 0);
- slot = list.getIndex(reset_reactor_click_list_2, 0);
- list.removeIndex(reset_reactor_click_list, 0);
- list.removeIndex(reset_reactor_click_list_2, 0);
- if(list.contains(reactor_block_list, player_uuid)) {
- goto("checkgame");
- }
- reactor_array = reactor.get(player_uuid);
- inv = reactor.getInv(reactor_array);
- inv.setItem(inv, slot, gray_glass);
- player = player.get(player_uuid);
- goto("checkgame");
- @unblock_start_reactor
- list.removeIndex(reactor_block_list, 0);
- goto("checkgame");
- @unblock_submit_scan
- list.removeIndex(submit_scan_list_2, 0);
- goto("checkgame");
- @unblock_calib_dist
- list.removeIndex(calibrate_dist_list_2, 0);
- goto("checkgame");
- @unblock_empty_garb
- list.removeIndex(empty_garb_list_2, 0);
- goto("checkgame");
- @unblock_download
- list.removeIndex(download_list_2, 0);
- goto("checkgame");
- @unblock_clear_ast
- list.removeIndex(clear_ast_list_2, 0);
- goto("checkgame");
- @new_reactor
- player_uuid = list.getIndex(reactor_false_click_list, 0);
- list.removeIndex(reactor_false_click_list, 0);
- reactor_array = reactor.get(player_uuid);
- inv = reactor.getInv(reactor_array);
- reactor.setHeader(inv, light_gray_glass);
- reactor.setLeftSide(inv, black_glass);
- reactor.setRightSide(inv, black_glass);
- player = player.get(player_uuid);
- reactor_array = array.new(5);
- reactor.setInv(reactor_array, inv);
- reactor.setStage(reactor_array, 0);
- reactor.setCounter(reactor_array, 0);
- reactor.setPattern(reactor_array);
- reactor.save(reactor_array, player);
- list.add(reactor_draw_list_1, player_uuid);
- sgoto(20, "draw_pattern_1");
- goto("checkgame");
- @false_reactor_click
- reactor.setHeader(inv, red_glass);
- reactor.setRightSide(inv, red_glass);
- list.add(reactor_block_list, player_uuid);
- list.add(reactor_false_click_list, player_uuid);
- sgoto(20, "unblock_start_reactor");
- sgoto(40, "new_reactor");
- goto("checkgame");
- @false_manifolds_click
- for(i = 2; i < 16; i++) {
- if(i == 7) {
- i = 11;
- }
- inv.setItem(inv, i, item.create("RED_STAINED_GLASS_PANE", item.getAmount(inv.getItem(inv, i)), null, null));
- }
- list.add(manifolds_list, inv);
- list.add(manifolds_list_2, player);
- sgoto(30, "redo_manifolds");
- goto("checkgame");
- @redo_manifolds
- inv = list.getIndex(manifolds_list, 0);
- player_uuid = player.getUuid(list.getIndex(manifolds_list_2, 0));
- list.removeIndex(manifolds_list, 0);
- list.removeIndex(manifolds_list_2, 0);
- map.remove(manifolds_counter, player_uuid);
- for(i = 2; i < 16; i++) {
- if(i == 7) {
- i = 11;
- }
- inv.setItem(inv, i, item.create("BLUE_STAINED_GLASS_PANE", item.getAmount(inv.getItem(inv, i)), null, null));
- }
- goto("checkgame");
- @countdown_sample
- player_uuid = list.getIndex(sample_list, 0);
- player = player.get(player_uuid);
- time = list.getIndex(sample_list_2, 0) - 1;
- list.removeIndex(sample_list, 0);
- list.removeIndex(sample_list_2, 0);
- inv = map.get(sample_map, player_uuid);
- sample = item.create("blue_stained_glass_pane", 1, "§rSample", null);
- if(time == 58) {
- inv.setItem(inv, 0, sample);
- inv.setItem(inv, 9, sample);
- inv.setItem(inv, 18, sample);
- } elseif(time == 57) {
- inv.setItem(inv, 2, sample);
- inv.setItem(inv, 11, sample);
- inv.setItem(inv, 20, sample);
- } elseif(time == 56) {
- inv.setItem(inv, 4, sample);
- inv.setItem(inv, 13, sample);
- inv.setItem(inv, 22, sample);
- } elseif(time == 55) {
- inv.setItem(inv, 6, sample);
- inv.setItem(inv, 15, sample);
- inv.setItem(inv, 24, sample);
- } elseif(time == 54) {
- inv.setItem(inv, 8, sample);
- inv.setItem(inv, 17, sample);
- inv.setItem(inv, 26, sample);
- }
- if(time == 0) {
- inv.setItem(inv, 53, item.create("gray_stained_glass_pane", 1, "§rSelect anomaly", null));
- r = math.random(0, 4) * 2;
- inv.setItem(inv, r, item.create("red_stained_glass_pane", 1, "§rSample", null));
- inv.setItem(inv, r + 9, item.create("red_stained_glass_pane", 1, "§rSample", null));
- inv.setItem(inv, r + 18, item.create("red_stained_glass_pane", 1, "§rSample", null));
- select_sample = item.create("green_stained_glass_pane", 1, "§rSelect sample", null);
- inv.setItem(inv, 36, item.create("green_stained_glass_pane", 1, "§rSelect sample", null));
- inv.setItem(inv, 38, item.create("green_stained_glass_pane", 1, "§rSelect sample", null));
- inv.setItem(inv, 40, item.create("green_stained_glass_pane", 1, "§rSelect sample", null));
- inv.setItem(inv, 42, item.create("green_stained_glass_pane", 1, "§rSelect sample", null));
- inv.setItem(inv, 44, item.create("green_stained_glass_pane", 1, "§rSelect sample", null));
- giveTask(player, 8, "MED", "Inspect Sample", 0, 1, 0);
- goto("checkgame");
- }
- giveTask(player, 8, "MED", "Inspect Sample", 0, 1, time);
- inv.setItem(inv, 53, item.create("gray_stained_glass_pane", time, "§rGo grab a coffee", null));
- list.add(sample_list, player_uuid);
- list.add(sample_list_2, time);
- sgoto(20, "countdown_sample");
- goto("checkgame");
- @calibrate_dist
- p_uuid = list.getIndex(calibrate_dist_list, 0);
- list.removeIndex(calibrate_dist_list, 0);
- if(list.contains(calibrate_dist_list_2, p_uuid)) {
- goto("checkgame");
- }
- a = map.get(calibrate_dist_map, p_uuid);
- inv = a[1];
- index = a[3];
- stage = a[4];
- inv.setItem(inv, calibrate_dist_array[index++], black_glass);
- if(index == 12) {
- index = 0;
- }
- a[3] = index;
- if(stage == 0) {
- inv.setItem(inv, calibrate_dist_array[index], yellow_glass);
- } elseif(stage == 1) {
- inv.setItem(inv, calibrate_dist_array[index], blue_glass);
- } elseif(stage == 2) {
- inv.setItem(inv, calibrate_dist_array[index], cyan_glass);
- }
- if(stage < 3) {
- map.add(calibrate_dist_map, p_uuid, a);
- list.add(calibrate_dist_list, p_uuid);
- sgoto(7, "calibrate_dist");
- }
- goto("checkgame");
- @empty_garb
- p_uuid = list.getIndex(empty_garb_list, 0);
- list.removeIndex(empty_garb_list, 0);
- c = map.get(empty_garb_map, p_uuid);
- inv = map.get(empty_garb_map_2, p_uuid);
- if(list.contains(empty_garb_list_2, p_uuid)) {
- goto("checkgame");
- }
- for(slot = 52; slot > 9; slot--) {
- if(slot == 44) {
- continue;
- }
- inv.setItem(inv, slot, inv.getItem(inv, slot - 9));
- }
- p = player.get(p_uuid);
- if(++c == 5) {
- step = task.stepIncrease(p, 12);
- if(step == 1) {
- addTaskParticle(p, stor_garb_par_loc);
- r = map.get(empty_garb_map_3, player_uuid);
- if(r == 0) {
- removeTaskParticle(p, cafe_garb_par_loc);
- } else {
- removeTaskParticle(p, o2_garb_par_loc);
- }
- } else {
- removeTaskParticle(p, stor_garb_par_loc);
- }
- inv.setItem(inv, 44, customitem.create("CHECK_GREEN", 1, "§rTask completed", null));
- map.remove(empty_garb_map, p_uuid);
-
- giveTask(p, 12, "STO", "Empty Garbage", step, 2, null);
- sgoto_auto_close_inv(p_uuid);
- } else {
- map.add(empty_garb_map, p_uuid, c);
- map.add(empty_garb_map_2, p_uuid, inv);
- list.add(empty_garb_list, p_uuid);
- sgoto(20, "empty_garb");
- }
- goto("checkgame");
- @clear_ast
- p_uuid = list.getIndex(clear_ast_list, 0);
- list.removeIndex(clear_ast_list, 0);
- if(list.contains(clear_ast_list_2, p_uuid)) {
- if(list.getSize(clear_ast_list) == 0) {
- goto("checkgame");
- }
- }
- inv = map.get(clear_ast_map_3, p_uuid);
- my_list = map.get(clear_ast_map, p_uuid);
- iter = iterator(my_list);
- while(hasNext(iter)) {
- a = next(iter);
- slot = a[1];
- x_dir = a[2];
- y_dir = a[3];
- reached_end = a[4];
- speed = a[5];
- speed_counter = a[6];
- if(speed_counter == speed) {
- inv.setItem(inv, slot, black_glass);
- if(reached_end) {
- remove(iter);
- continue;
- }
- slot += x_dir;
- slot += (y_dir * 9);
- a[1] = slot;
- if(list.contains(ast_start_pos, slot)) {
- a[4] = true;
- }
- inv.setItem(inv, slot, asteroid_item);
- a[6] = 0;
- } else {
- a[6] = speed_counter + 1;
- }
- }
- c = map.get(clear_ast_map_2, p_uuid) + 1;
- if(c == 3 && !list.contains(clear_ast_list_3, p_uuid)) {
- c = 0;
- //new asteroid
- a = array.new(7);
- slot = list.getIndex(ast_start_pos, math.random(0, 25));
- a[1] = slot;
- inv.setItem(inv, slot, asteroid_item);
- b = getAstDirection(slot);
- a[2] = b[0]; //x_dir
- a[3] = b[1]; //y_dir
- a[4] = false; //reached end
- a[5] = math.random(1, 2); //speed
- a[6] = 0; //speed counter
- list.add(my_list, a);
- }
- map.add(clear_ast_map, p_uuid, my_list);
- map.add(clear_ast_map_2, p_uuid, c);
- list.add(clear_ast_list, p_uuid);
- sgoto(5, "clear_ast");
- goto("checkgame");
- function assignSeat(player) {
- for(i = 0; i < 10; i++) {
- if($seat_array[i] == null) {
- entity.teleport(player, $lobbyspawnloc);
- player_uuid = player.getUuid(player);
- $seat_array[i] = player_uuid;
- map.add($seat_map_index, player_uuid, i);
- list.add($seat_list_join, player_uuid);
- sgoto(10, "lobby_join_seat");
- return;
- }
- }
- }
- @lobby_join_seat
- player_uuid = list.getIndex(seat_list_join, 0);
- list.removeIndex(seat_list_join, 0);
- i = map.get(seat_map_index, player_uuid);
- loc = list.getIndex(seat_locs, i);
- ent = entity.spawnseat(loc);
- entity.frame.setfixed(ent, true);
- map.add(seat_map, player_uuid, ent);
- player = player.get(player_uuid);
- if(player != null) {
- entity.mount(player, ent);
- list.add(seat_list_leave, player_uuid);
- sgoto(60, "lobby_leave_seat");
- }
- goto("simplelobby");
- @lobby_leave_seat
- player_uuid = list.getIndex(seat_list_leave, 0);
- list.removeIndex(seat_list_leave, 0);
- leaveSeat(player_uuid);
- goto("simplelobby");
- function leaveSeat(player_or_uuid) {
- if(isPlayer(player_or_uuid)) {
- player_uuid = player.getUuid(player_or_uuid);
- } else {
- player_uuid = player_or_uuid;
- }
- for(i = 0; i < 10; i++) {
- if($seat_array[i] == player_uuid) {
- $seat_array[i] = null;
- ent = map.get($seat_map, player_uuid);
- if(ent != null) {
- entity.remove(ent);
- map.remove($seat_map, player_uuid);
- }
- }
- }
- }
- @submit_scan
- p_uuid = list.getIndex(submit_scan_list, 0);
- list.removeIndex(submit_scan_list, 0);
- if(list.contains(submit_scan_list_2, p_uuid)) {
- goto("checkgame");
- }
- c = map.get(submit_scan_map, p_uuid);
- inv = map.get(submit_scan_map_2, p_uuid);
- p = player.get(p_uuid);
- if(c == 0) {
- inv.setItem(inv, 2, lime_glass);
- inv.setItem(inv, 3, lime_glass);
- inv.setItem(inv, 4, lime_glass);
- inv.setItem(inv, 5, lime_glass);
- inv.setItem(inv, 6, lime_glass);
- } elseif(c == 1) {
- inv.setItem(inv, 0, item.create("black_stained_glass_pane", 1, string.concat("§rID: ", string.toUpperCase(amongus.getPlayerColor(p), "P0")), null));
- inv.setItem(inv, 2, light_gray_glass);
- inv.setItem(inv, 3, light_gray_glass);
- inv.setItem(inv, 4, light_gray_glass);
- inv.setItem(inv, 5, light_gray_glass);
- inv.setItem(inv, 6, light_gray_glass);
- inv.setItem(inv, 11, lime_glass);
- inv.setItem(inv, 12, lime_glass);
- inv.setItem(inv, 14, lime_glass);
- inv.setItem(inv, 15, lime_glass);
- inv.setItem(inv, 47, green_glass);
- } elseif(c == 2) {
- inv.setItem(inv, 11, light_gray_glass);
- inv.setItem(inv, 12, light_gray_glass);
- inv.setItem(inv, 14, light_gray_glass);
- inv.setItem(inv, 15, light_gray_glass);
- inv.setItem(inv, 20, lime_glass);
- inv.setItem(inv, 21, lime_glass);
- inv.setItem(inv, 23, lime_glass);
- inv.setItem(inv, 24, lime_glass);
- } elseif(c == 3) {
- inv.setItem(inv, 8, item.create("black_stained_glass_pane", 1, "§rHT: 3' 6''", null));
- inv.setItem(inv, 20, light_gray_glass);
- inv.setItem(inv, 21, light_gray_glass);
- inv.setItem(inv, 23, light_gray_glass);
- inv.setItem(inv, 24, light_gray_glass);
- inv.setItem(inv, 29, lime_glass);
- inv.setItem(inv, 30, lime_glass);
- inv.setItem(inv, 32, lime_glass);
- inv.setItem(inv, 33, lime_glass);
- inv.setItem(inv, 48, green_glass);
- } elseif(c == 4) {
- inv.setItem(inv, 29, light_gray_glass);
- inv.setItem(inv, 30, light_gray_glass);
- inv.setItem(inv, 32, light_gray_glass);
- inv.setItem(inv, 33, light_gray_glass);
- inv.setItem(inv, 38, lime_glass);
- inv.setItem(inv, 39, lime_glass);
- inv.setItem(inv, 41, lime_glass);
- inv.setItem(inv, 42, lime_glass);
- } elseif(c == 5) {
- inv.setItem(inv, 18, item.create("black_stained_glass_pane", 1, "§rWT: 92 lbs", null));
- inv.setItem(inv, 38, light_gray_glass);
- inv.setItem(inv, 39, light_gray_glass);
- inv.setItem(inv, 41, light_gray_glass);
- inv.setItem(inv, 42, light_gray_glass);
- inv.setItem(inv, 29, lime_glass);
- inv.setItem(inv, 30, lime_glass);
- inv.setItem(inv, 32, lime_glass);
- inv.setItem(inv, 33, lime_glass);
- inv.setItem(inv, 49, green_glass);
- } elseif(c == 6) {
- inv.setItem(inv, 29, light_gray_glass);
- inv.setItem(inv, 30, light_gray_glass);
- inv.setItem(inv, 32, light_gray_glass);
- inv.setItem(inv, 33, light_gray_glass);
- inv.setItem(inv, 20, lime_glass);
- inv.setItem(inv, 21, lime_glass);
- inv.setItem(inv, 23, lime_glass);
- inv.setItem(inv, 24, lime_glass);
- } elseif(c == 7) {
- inv.setItem(inv, 26, item.create("black_stained_glass_pane", 1, string.concat("§rC: ", string.toUpperCase(amongus.getPlayerColor(p))), null));
- inv.setItem(inv, 20, light_gray_glass);
- inv.setItem(inv, 21, light_gray_glass);
- inv.setItem(inv, 23, light_gray_glass);
- inv.setItem(inv, 24, light_gray_glass);
- inv.setItem(inv, 11, lime_glass);
- inv.setItem(inv, 12, lime_glass);
- inv.setItem(inv, 14, lime_glass);
- inv.setItem(inv, 15, lime_glass);
- inv.setItem(inv, 50, green_glass);
- } elseif(c == 8) {
- inv.setItem(inv, 11, light_gray_glass);
- inv.setItem(inv, 12, light_gray_glass);
- inv.setItem(inv, 14, light_gray_glass);
- inv.setItem(inv, 15, light_gray_glass);
- inv.setItem(inv, 2, lime_glass);
- inv.setItem(inv, 3, lime_glass);
- inv.setItem(inv, 4, lime_glass);
- inv.setItem(inv, 5, lime_glass);
- inv.setItem(inv, 6, lime_glass);
- } elseif(c == 9) {
- inv.setItem(inv, 36, item.create("black_stained_glass_pane", 1, "§rBT: O-", null));
- inv.setItem(inv, 2, light_gray_glass);
- inv.setItem(inv, 3, light_gray_glass);
- inv.setItem(inv, 4, light_gray_glass);
- inv.setItem(inv, 5, light_gray_glass);
- inv.setItem(inv, 6, light_gray_glass);
- inv.setItem(inv, 51, green_glass);
- } else {
- inv.setItem(inv, 44, customitem.create("CHECK_GREEN", 1, "§rTask completed", null));
- removeTaskParticle(p, scan_par_loc);
- step = task.stepIncrease(p, 16);
- giveTask(p, 16, "MED", "Submit Scan", 1, 1, null);
- sgoto_auto_close_inv(p_uuid);
- goto("checkgame");
- }
- map.add(submit_scan_map, p_uuid, c + 1);
- list.add(submit_scan_list, p_uuid);
- sgoto(20, "submit_scan");
- goto("checkgame");
- function set_engine(player, inv, direction) {
- player_uuid = player.getUuid(player);
- pos = map.get($align_engine_map, player_uuid);
- if(direction == "up") {
- new_pos = pos + 1;
- } elseif(direction == "down") {
- new_pos = pos - 1;
- } else {
- new_pos = pos;
- }
- if(new_pos < 0 || new_pos > 10) {
- return false;
- }
- map.add($align_engine_map, player_uuid, new_pos);
- //remove old pattern
- temp_list = $align_engine_array[pos];
- iter = iterator(temp_list);
- while(hasNext(iter)) {
- slot = next(iter);
- if(slot < 18 || slot > 26) {
- inv.setItem(inv, slot, $gray_glass);
- } else {
- inv.setItem(inv, slot, $light_gray_glass);
- }
- }
- //set new pattern
- temp_list = $align_engine_array[new_pos];
- iter = iterator(temp_list);
- while(hasNext(iter)) {
- slot = next(iter);
- if(slot < 18 || slot > 26) {
- inv.setItem(inv, slot, $red_glass);
- } else {
- inv.setItem(inv, slot, $green_glass);
- }
- }
- return new_pos == 5;
- }
- function cam.enter(player) {
- if(player.isOnCam(player)) {
- return;
- }
- player.hideOnline(player);
- amongus.manageEffects(player);
- entity.setGravity(player, false);
- player_uuid = player.getUuid(player);
- list.add($cam_list, player_uuid);
- player.giveItem(player, $prev_cam_item);
- player.giveItem(player, $next_cam_item);
- player.giveItem(player, $leave_cam_item);
- amongus.removeequip(player);
- if(isImpostor(player)) {
- cooldown = data.getTimer(player, "Kill Cooldown");
- map.add($holded_kill_cooldown, player_uuid, cooldown);
- }
- if($cam_loop == false) {
- $cam_loop = true;
- sgoto(10, "cam_tp_loop");
- }
- }
- function cam.leave(player) {
- player_uuid = player.getUuid(player);
- list.remove($cam_list, player_uuid);
- map.remove($cam_map, player_uuid);
- ent = map.get($cam_map_3, player_uuid);
- if(ent != null) {
- map.remove($cam_map_3, ent);
- map.remove($cam_map_4, ent);
- citizen.destroy(ent);
- }
- entity.teleport(player, map.get($cam_map_2, player_uuid));
- list.add($gravity_list, player.getUuid(player));
- sgoto(2, "setGravity");
- if(list.getSize($cam_list) == 0) {
- $cam_loop = false;
- }
- player.removeItem(player, $prev_cam_item);
- player.removeItem(player, $next_cam_item);
- player.removeItem(player, $leave_cam_item);
- amongus.manageEffects(player);
- if(!player.isGhost(player)) {
- color = amongus.getPlayerColor(player);
- amongus.equip(player, color);
- player.showOnline(player);
- }
- }
- @setGravity
- p_uuid = list.getIndex(gravity_list, 0);
- list.removeIndex(gravity_list, 0);
- p = player.get(p_uuid);
- if(p != null) {
- entity.setGravity(p, true);
- }
- goto("checkgame");
- function player.isOnCam(player) {
- return list.contains($cam_list, player.getUuid(player));
- }
- @cam_tp_loop
- show_cam_pars = false;
- iter = iterator(cam_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- cam_number = map.get(cam_map, p_uuid);
- tp_loc = list.getIndex(cams_locs_tp, cam_number);
- entity.teleport(p, tp_loc);
- if(isImpostor(p)) {
- cooldown = map.getOrDefault(holded_kill_cooldown, player_uuid, -1);
- if(cooldown != -1) {
- data.setTimer(p, "Kill Cooldown", cooldown);
- kill_bar = map.get(imp_kill_bars, player_uuid);
- updateKillBossBar(kill_bar, cooldown / 20);
- }
- }
- if(!player.isGhost(p)) {
- show_cam_pars = true;
- }
- }
- if(show_cam_pars) {
- iter = iterator(cams_par_locs);
- while(hasNext(iter)) {
- particle.spawn(next(iter), cam_par);
- }
- }
- if(cam_loop) {
- sgoto(10, "cam_tp_loop");
- }
- goto("checkgame");
- function vent_enter(player, vent_loc) {
- tp_loc = map.get($vent_map, vent_loc);
- entity.teleport(player, tp_loc);
- player.hideOnline(player);
- removeImpostorItems(player);
- player_uuid = player.getUuid(player);
- map.add($vent_map_2, player_uuid, tp_loc);
- map.add($vent_map_4, player_uuid, vent_loc);
- a = map.get($vent_map_3, vent_loc);
- icon_1 = a[0];
- icon_2 = a[2];
- inv = player.getInv(player);
- if(icon_1 == null) {
- inv.setItem(inv, 6, null);
- } else {
- inv.setItem(inv, 6, icon_1);
- }
- if(!list.contains($vent_list, player_uuid)) {
- list.add($vent_list, player_uuid);
- }
- if(icon_2 == null) {
- inv.setItem(inv, 7, null);
- } else {
- inv.setItem(inv, 7, icon_2);
- }
- inv.setItem(inv, 8, $leave_vent_item);
- if($vent_loop == false) {
- $vent_loop = true;
- sgoto(10, "vent_tp_loop");
- }
- }
- function vent_leave(player) {
- player_uuid = player.getUuid(player);
- list.remove($vent_list, player_uuid);
- map.remove($vent_map_2, player_uuid);
- map.remove($vent_map_4, player_uuid);
- player.showOnline(player);
- if(list.getSize($vent_list) == 0) {
- $vent_loop = false;
- }
- color = amongus.getPlayerColor(player);
- player.removeItem(player, $vent_left_item);
- player.removeItem(player, $vent_right_item);
- player.removeItem(player, $vent_up_item);
- player.removeItem(player, $vent_down_item);
- player.removeItem(player, $leave_vent_item);
- if(isImpostor(player)) {
- giveImpostorItems(player);
- }
- }
- @vent_tp_loop
- iter = iterator(vent_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- tp_loc = map.get(vent_map_2, p_uuid);
- entity.teleport(p, tp_loc);
- if(isImpostor(p)) {
- cooldown = map.getOrDefault(holded_kill_cooldown, player_uuid, -1);
- if(cooldown != -1) {
- data.setTimer(p, "Kill Cooldown", cooldown);
- kill_bar = map.get(imp_kill_bars, player_uuid);
- updateKillBossBar(kill_bar, cooldown / 20);
- }
- }
- }
- if(vent_loop) {
- sgoto(10, "vent_tp_loop");
- }
- goto("checkgame");
- @space_loop
- loc_iter = iterator(space_locs);
- while(hasNext(loc_iter)) {
- particle.spawn(next(loc_iter), space_par);
- }
- sgoto(50, "space_loop");
- goto("checkgame");
- @task_part_loop
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- my_list = map.get(task_part_map, p_uuid);
- if(my_list != null) {
- loc_iter = iterator(my_list);
- while(hasNext(loc_iter)) {
- particle.spawnPlayer(next(loc_iter), task_par, p, 1, 0, 0.05, 0.05, 0.05);
- }
- }
- }
- sgoto(10, "task_part_loop");
- goto("checkgame");
- function addSaboParticles(location1, location2) {
- list.add($sabo_par_list, location1);
- if(location2 != null) {
- list.add($sabo_par_list, location2);
- }
- sgoto(10, "sabo_par_loop");
- }
- function removeSaboParticles(location1, location2) {
- list.remove($sabo_par_list, location1);
- if(location2 != null) {
- list.remove($sabo_par_list, location2);
- }
- }
- @sabo_par_loop
- if(!amongus.isAlert()) {
- goto("checkgame");
- }
- loc_iter = iterator(sabo_par_list);
- while(hasNext(loc_iter)) {
- particle.spawn(next(loc_iter), sabo_par);
- }
- sgoto(10, "sabo_par_loop");
- goto("checkgame");
- function addTaskParticle(player, location) {
- if(isCrewmate(player) || $freeplay) {
- player_uuid = player.getUuid(player);
- my_list = map.get($task_part_map, player_uuid);
- if(my_list == null) {
- my_list = list.new();
- map.add($task_part_map, player_uuid, my_list);
- }
- list.add(my_list, location);
- }
- }
- function removeTaskParticle(player, location) {
- player_uuid = player.getUuid(player);
- my_list = map.get($task_part_map, player_uuid);
- if(my_list == null) {
- my_list = list.new();
- map.add($task_part_map, player_uuid, my_list);
- }
- list.remove(my_list, location);
- }
- function reactor.setHeader(inv, item) {
- for(i = 2; i < 7; i++) {
- inv.setItem(inv, i, item);
- }
- }
- function reactor.setLeftSide(inv, item) {
- inv.setItem(inv, 19, item);
- inv.setItem(inv, 20, item);
- inv.setItem(inv, 21, item);
- inv.setItem(inv, 28, item);
- inv.setItem(inv, 29, item);
- inv.setItem(inv, 30, item);
- inv.setItem(inv, 37, item);
- inv.setItem(inv, 38, item);
- inv.setItem(inv, 39, item);
- }
- function reactor.setRightSide(inv, item) {
- inv.setItem(inv, 23, item);
- inv.setItem(inv, 24, item);
- inv.setItem(inv, 25, item);
- inv.setItem(inv, 32, item);
- inv.setItem(inv, 33, item);
- inv.setItem(inv, 34, item);
- inv.setItem(inv, 41, item);
- inv.setItem(inv, 42, item);
- inv.setItem(inv, 43, item);
- }
- function reactor.get(player_or_uuid) {
- if(isPlayer(player_or_uuid)) {
- player_or_uuid = player.getUuid(player_or_uuid);
- }
- reactor_array = map.get($start_reactor_map, player_or_uuid);
- return reactor_array;
- }
- function reactor.save(reactor_array, player) {
- player_uuid = player.getUuid(player);
- map.add($start_reactor_map, player_uuid, reactor_array);
- }
- function reactor.setInv(reactor_array, inv) {
- reactor_array[0] = inv;
- }
- function reactor.getInv(reactor_array) {
- return reactor_array[0];
- }
- function reactor.setStage(reactor_array, stage) {
- reactor_array[1] = stage;
- }
- function reactor.getStage(reactor_array) {
- return reactor_array[1];
- }
- function reactor.setCounter(reactor_array, counter) {
- reactor_array[2] = counter;
- }
- function reactor.getCounter(reactor_array) {
- return reactor_array[2];
- }
- function reactor.setPattern(reactor_array) {
- pattern = array.new(5);
- for(i = 0; i < 5; i++) {
- r = math.random(1, 9);
- if(r < 4) {
- r += 18;
- } elseif(r < 7) {
- r += 24;
- } else {
- r += 30;
- }
- pattern[i] = r;
- }
- reactor_array[3] = pattern;
- }
- function reactor.getPattern(reactor_array) {
- return reactor_array[3];
- }
- function reactor.setPhase(reactor_array, phase) {
- reactor_array[4] = phase;
- }
- function reactor.getPhase(reactor_array) {
- return reactor_array[4];
- }
- function sabotage.holdReactor(inv, hold) {
- if(hold) {
- item = $lime_glass;
- } else {
- item = $red_glass;
- }
- for(i = 0; i < 54; i++) {
- inv.setItem(inv, i, item);
- }
- }
- function switchLights(boolean) {
- if(boolean) {
- mat = material.get("sea_lantern");
- } else {
- mat = material.get("smooth_stone");
- }
- iter = iterator($lights_blocks);
- while(hasNext(iter)) {
- block.setMaterial(next(iter), mat);
- }
- }
- @draw_comms
- player_uuid = list.getIndex(comms_state_list, 0);
- list.removeIndex(comms_state_list, 0);
- if(!comms_sabotaged) {
- goto("checkgame");
- }
- inv = map.get(comms_inv_map, player_uuid);
- if(inv == null) {
- goto("checkgame");
- }
- comms_state = map.get(comms_state_map, player_uuid);
- counter = map.getOrDefault(comms_counter_map, player_uuid, 0);
- if(comms_state == 0) {
- //worst
- for(i = 26; i >= 9; i--) {
- inv.setItem(inv, i, inv.getItem(inv, i - 1));
- }
- if(counter == 1) {
- counter = 0;
- } else {
- inv.setItem(inv, 9, red_glass);
- counter++;
- }
- } elseif(comms_state == 1) {
- //close
- for(i = 26; i > 0; i--) {
- inv.setItem(inv, i, inv.getItem(inv, i - 1));
- }
- if(counter == 3) {
- inv.setItem(inv, 0, yellow_glass);
- inv.setItem(inv, 18, black_glass);
- counter = 0;
- } elseif(counter == 2) {
- inv.setItem(inv, 9, yellow_glass);
- counter++;
- } elseif(counter == 0) {
- inv.setItem(inv, 0, black_glass);
- counter++;
- } else {
- counter++;
- }
- } elseif(comms_state == 2) {
- //correct
- for(i = 35; i > 0; i--) {
- inv.setItem(inv, i, inv.getItem(inv, i - 1));
- }
- if(counter == 5) {
- inv.setItem(inv, 0, lime_glass);
- counter = 0;
- } elseif(counter == 4) {
- inv.setItem(inv, 9, lime_glass);
- inv.setItem(inv, 27, black_glass);
- counter++;
- } elseif(counter == 2) {
- inv.setItem(inv, 9, black_glass);
- inv.setItem(inv, 27, lime_glass);
- counter++;
- } elseif(counter == 0) {
- inv.setItem(inv, 0, black_glass);
- inv.setItem(inv, 9, lime_glass);
- inv.setItem(inv, 27, black_glass);
- counter++;
- } else {
- counter++;
- }
- }
- map.add(comms_counter_map, player_uuid, counter);
- list.add(comms_state_list, player_uuid);
- sgoto(5, "draw_comms");
- goto("checkgame");
- function comms.drawCorrect(inv, player) {
- player_uuid = player.getUuid(player);
- map.add($comms_state_map, player_uuid, 2);
- map.remove($comms_counter_map, player_uuid);
- for(i = 0; i < 36; i++) {
- inv.setItem(inv, i, $black_glass);
- }
- inv.setItem(inv, 0, $lime_glass);
- inv.setItem(inv, 6, $lime_glass);
- inv.setItem(inv, 10, $lime_glass);
- inv.setItem(inv, 14, $lime_glass);
- inv.setItem(inv, 16, $lime_glass);
- inv.setItem(inv, 20, $lime_glass);
- inv.setItem(inv, 22, $lime_glass);
- inv.setItem(inv, 26, $lime_glass);
- inv.setItem(inv, 30, $lime_glass);
- }
- function comms.drawClose(inv, player) {
- player_uuid = player.getUuid(player);
- map.add($comms_state_map, player_uuid, 1);
- map.remove($comms_counter_map, player_uuid);
- for(i = 0; i < 36; i++) {
- inv.setItem(inv, i, $black_glass);
- }
- inv.setItem(inv, 0, $yellow_glass);
- inv.setItem(inv, 4, $yellow_glass);
- inv.setItem(inv, 8, $yellow_glass);
- inv.setItem(inv, 10, $yellow_glass);
- inv.setItem(inv, 12, $yellow_glass);
- inv.setItem(inv, 14, $yellow_glass);
- inv.setItem(inv, 16, $yellow_glass);
- inv.setItem(inv, 20, $yellow_glass);
- inv.setItem(inv, 24, $yellow_glass);
- }
- function comms.drawWorst(inv, player) {
- player_uuid = player.getUuid(player);
- map.add($comms_state_map, player_uuid, 0);
- map.remove($comms_counter_map, player_uuid);
- for(i = 0; i < 9; i++) {
- inv.setItem(inv, i, $black_glass);
- }
- for(i = 27; i < 36; i++) {
- inv.setItem(inv, i, $black_glass);
- }
- for(i = 9; i < 27; i = i + 2) {
- inv.setItem(inv, i, $black_glass);
- }
- for(i = 10; i < 27; i = i + 2) {
- inv.setItem(inv, i, $red_glass);
- }
- }
- @scheduled_fix_comms
- player_uuid = list.getIndex(comms_fix_list, 0);
- list.removeIndex(comms_fix_list, 0);
- time = map.get(comms_fix_map, player_uuid);
- if(time == null) {
- goto("checkgame");
- }
- if(time.getMillis() - time <= 2000) {
- fix_comms();
- }
- goto("checkgame");
- function sabotage.openedInv(player) {
- list.add($sabo_list, player.getUuid(player));
- }
- function sabotage.closedInv(player) {
- list.remove($sabo_list, player.getUuid(player));
- }
- function sabotage.closeInvs() {
- iter = iterator($sabo_list);
- while(hasNext(iter)) {
- inv.close(player.get(next(iter)));
- }
- }
- @scheduled_sabo_close
- sabotage.closeInvs();
- goto("checkgame");
- function task.stepIncrease(player, task_id) {
- player_uuid = player.getUuid(player);
- map = map.get($task_steps, player_uuid);
- if(map == null) {
- map = map.new();
- }
- step = map.getOrDefault(map, task_id, 0) + 1;
- map.add(map, task_id, step);
- map.add($task_steps, player_uuid, map);
- return step;
- }
- function task.getStep(player, task_id) {
- map = map.get($task_steps, player.getUuid(player));
- if(map == null) {
- return 0;
- }
- return map.getOrDefault(map, task_id, 0);
- }
- function task.resetSteps(player) {
- map.add($task_steps, player.getUuid(player), map.new());
- }
- function amongus.setPlayerColor(player, color) {
- player_uuid = player.getUuid(player);
- map.add($player_colors, player_uuid, color);
- }
- function amongus.getPlayerColor(player_or_uuid) {
- if(isPlayer(player_or_uuid)) {
- player_or_uuid = player.getUuid(player_or_uuid);
- }
- return map.get($player_colors, player_or_uuid);
- }
- function amongus.getPlayerColorCode(player_or_uuid) {
- color = amongus.getPlayerColor(player_or_uuid);
- return map.getOrDefault($color_code_map, color, "§r");
- }
- function amongus.isUsedPlayerColor(color) {
- iter = map.iterator($player_colors);
- while(hasNext(iter)) {
- element = next(iter);
- value = map.getValue(element);
- if(value == color) {
- return true;
- }
- }
- return false;
- }
- function amongus.removeEquip(player) {
- living.setEquip(player, slot.getHead(), $air_item);
- living.setEquip(player, slot.getChest(), $air_item);
- living.setEquip(player, slot.getLegs(), $air_item);
- living.setEquip(player, slot.getFeet(), $air_item);
- }
- function amongus.equipCitizen(citizen, color, player) {
- item = player.getHead(player.getUuid(player), player.getName(player));
- citizen.setEquip(citizen, "HELMET", item);
-
- color_code = map.get($cloth_code_map, color);
- item = read.item(string.concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- citizen.setEquip(citizen, "CHESTPLATE", item);
- item = read.item(string.concat("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- citizen.setEquip(citizen, "LEGGINGS", item);
- item = read.item(string.concat("{id:\"minecraft:leather_boots\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- citizen.setEquip(citizen, "BOOTS", item);
- }
- function amongus.equip(entity, color) {
- color_code = map.get($cloth_code_map, color);
- if(isPlayer(entity)) {
- item = player.getHead(player.getUuid(entity), player.getName(entity));
- living.setEquip(entity, slot.getHead(), item);
- }
- item = read.item(string.concat("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- living.setEquip(entity, slot.getChest(), item);
- item = read.item(string.concat("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- living.setEquip(entity, slot.getLegs(), item);
- item = read.item(string.concat("{id:\"minecraft:leather_boots\",Count:1b,tag:{Damage:0,display:{color:", color_code, "}}}"));
- item.addFlag(item, "HIDE_ATTRIBUTES");
- living.setEquip(entity, slot.getFeet(), item);
- }
- function amongus.removeequip(player) {
- living.setEquip(player, slot.getHead(), air_item);
- living.setEquip(player, slot.getChest(), air_item);
- living.setEquip(player, slot.getLegs(), air_item);
- living.setEquip(player, slot.getFeet(), air_item);
- }
- function createVoteInv(player, reporter_uuid) {
- //inv = inv.new("022200222 022200222 022200222 022200222 022200222 022200000");
- inv = inv.new("022200222022200222022200222022200222022200222022200000", text.new("§cVOTE"));
- index = 1;
- iter = iterator($all_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p_name = player.getName(p_uuid);
- head = player.getHead(p_uuid, p_name);
- color = amongus.getPlayerColorCode(p_uuid);
- if(player.isGhost(p_uuid)) {
- item.setName(head, text.new(string.concat("§r", color, p_name)));
- inv.setItem(inv, index - 1, $zombie_head);
- } else {
- item.setName(head, text.new(string.concat("§rVote for ", color, p_name)));
- if(p_uuid == reporter_uuid) {
- item.setAmount(head, 2);
- }
- }
- inv.setItem(inv, index, head);
- if((index - 1) % 9 == 0) {
- index = index + 5;
- } else {
- index = index + 4;
- }
- }
- inv.setItem(inv, 46, customitem.create("RETURN_GREEN", 1, "§rSkip Vote", null));
- map.add($vote_inv_map, player.getUuid(player), inv);
- }
- function getVoteInv(player) {
- return map.get($vote_inv_map, player.getUuid(player));
- }
- function setItemInVoteInv(slot, item) {
- iter = iterator($player_list);
- while(hasNext(iter)) {
- p = player.get(next(iter));
- inv = getVoteInv(p);
- inv.setItem(inv, slot, item);
- }
- }
- function amongus.isAlert() {
- return $alert;
- }
- function amongus.setAlert(bool) {
- $alert = bool;
- }
- function addVentIcons(vent_loc, icon_1, vent_tp_loc_1, icon_2, vent_tp_loc_2) {
- a = array.new(4);
- a[0] = icon_1;
- a[1] = vent_tp_loc_1;
- a[2] = icon_2;
- a[3] = vent_tp_loc_2;
- map.add($vent_map_3, vent_loc, a);
- }
- function minigame.canStartIndiv() {
- if(minigame.isStarting()) {
- return false;
- }
- player_list = minigame.getPlayers($script_id);
- p_amount = list.getSize(player_list);
- return p_amount == minigame.getMinPlayers() || p_amount >= $multi_minplayers;
- }
- @crewmate_win
- winners = "§bCrewmates";
- if(freeplay) {
- endtime = time.getMillis();
-
- p_uuid = list.getIndex(player_list, 0);
- p = player.get(p_uuid);
- time = math.round((endtime - starttime) / 1000);
- last_record = ranking.getPoints(rankingtable, p);
- if(last_record == 0 || time < last_record) {
- record = time;
- diff = last_record - time;
- } else {
- record = last_record;
- }
- ranking.setPoints(rankingtable, p, record);
- mins = math.roundDown(time / 60);
- secs = math.roundComma(time % 60, 2);
- rec_mins = math.roundDown(record / 60);
- rec_secs = math.roundComma(record % 60, 2);
- minigame.statsHeader(p, gamename, "§e");
- minigame.statsLine(p, "§e", "Time", string.concat(string.number(mins), " min ", string.number(secs), " s"));
- minigame.statsLine(p, "§e", "Your record", string.concat(string.number(rec_mins), " min ", string.number(rec_secs), " s"));
- if(diff != null) {
- msg(p, " §e- §rBeat own record by §e", string.concat(string.number(diff), " s"));
- }
- }
- goto("win");
- @checkwin
- imps_alive = 0;
- crew_alive = 0;
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- if(!player.isGhost(p)) {
- if(isImpostor(p)) {
- imps_alive++;
- } else {
- crew_alive++;
- }
- }
- }
- if(imps_alive == 0) {
- winners = "§bCrewmates";
- goto("win");
- }
- if(imps_alive >= crew_alive) {
- winners = "§cImpostors";
- goto("win");
- }
- goto("checkgame");
- @win
- imp_string = "";
- iter = iterator(impostors_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p_name = player.getName(p_uuid);
- p = player.get(p_uuid);
- string = string.concat(amongus.getPlayerColorCode(p_uuid), p_name);
- if(imp_string == "") {
- imp_string = string;
- } else {
- imp_string = string.concat(imp_string, ", ", string);
- }
- if(winners == "§cImpostors") {
- //money.addBoost(p, 128);
- } else {
- //money.addBoost(p, 32);
- }
- }
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- msg.prefix(p, $gamename, string.concat("The ", winners, "§r have won the game."));
- msg.prefix(p, $gamename, string.concat("§4Impostors: §r", imp_string));
- inv.close(p);
- boss.removePlayer(progress_bar, p);
- player.gameMute(p, false);
- player.showOnline(p);
- living.setInvisible(p, false);
- if(winners == "§bCrewmates") {
- //money.addBoost(p, 128);
- } else {
- //money.addBoost(p, 32);
- }
- }
- //Building-Perms wieder geben
- for(i = 0; i < list.getSize(removed_perms); i++) {
- player_uuid = list.getIndex(removed_perms, i);
- //PERMS perm.registerPlayer(player_uuid, 1);
- //PERMS perm.registerPlayer(player_uuid, 15);
- }
- script = script.getFromId(script_id);
- removeDeadBodies();
- removeCamBodies();
- minigame.kickAllPlayers(script);
- minigame.term(script, gamesignloc);
- term();
- @on_error
- msg.dev("Error Handler activated");
- if(progress_bar != null) {
- boss.removeAll(progress_bar);
- }
- if(meeting_bar != null) {
- boss.removeAll(meeting_bar);
- }
- if(sabotage_cooldown_bar != null) {
- boss.removeAll(sabotage_cooldown_bar);
- }
- if(script_id != null) {
- minigame.msgAll("§cThere was an error in the game.");
- if(imp_kill_bars != null) {
- player_list = minigame.getPlayers(script_id);
- iter = iterator(player_list);
- while(hasNext(iter)) {
- p_uuid = next(iter);
- p = player.get(p_uuid);
- if(p != null) {
- living.clearEffects(p);
- player.showOnline(p);
- living.setInvisible(p, false);
- entity.setGravity(p, false);
- }
- my_kill_bar = map.get(imp_kill_bars, p_uuid);
- if(my_kill_bar != null) {
- boss.removeAll(my_kill_bar);
- }
- }
- }
- minigame.kickAllPlayers(script_id);
- }
- msg.dev("Script terminated (Minigame).");
- term();
|