among_us.txt 168 KB

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