package MinigameTeleporter import BaseObject import PlayerData import StringUtils import Assets import Minigame constant EFFECT_STRING = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" constant ESC_ID = 'A009' public MinigameTeleporter MINI_TP constant EVENT_RADIUS = 38. public class MinigameTeleporter extends StaticBaseObject FText text boolean array[12] votes int currentPlus boolean inprogress = false construct(unit existing) super(existing.getPos(), existing, EVENT_RADIUS, function MinigameTeleporter.checkVote, null) actor..removeAbility(REMOVE_OBJECT_ID) ..removeAbility(MAKE_UNIT_INVISIBLE_ID) ..removeAbility(ESC_ID) clearQuestionmark() text = createCenterFText(existing.getPos().toVec3(), "|cffffcc00Vote for minigame", 10) static function checkVote() let source = GetTriggeringTrigger().getSource() let u = GetTriggerUnit() let e = u.getEntity() let obj = source.getEntity() castTo MinigameTeleporter if isEscaperPlayer(e.owner) and e instanceof Escaper and not obj.inprogress obj.check(e castTo Escaper) function check(Escaper e) votes[e.owner.getId()] = not votes[e.owner.getId()] if votes[e.owner.getId()] currentPlus++ let votesNeeded = (escaperPlayers.size() * 0.65).round() if currentPlus >= votesNeeded startMinigame() text.tt.center(getPos(), "-|cffffcc00Minigame in progress|r-", 10) inprogress = true else flashEffect(UI.confirmation, pos) text.tt.center(getPos(), "Votes - [" + currentPlus.toString() + "/|cffffcc00" + votesNeeded.toString() + "|r]", 10) else currentPlus-- function startMinigame() let chosenMinigame = getNextMinigame() chosenMinigame.start() function reset() inprogress = false for i = 0 to 11 votes[i] = false currentPlus = 0 text.tt.center(getPos(), "|cffffcc00Vote for minigame", 10)