package LobbyTeleporter import BaseObject import PlayerData import StringUtils import Assets constant EFFECT_STRING = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl" constant ESC_ID = 'A009' constant EVENT_RADIUS = 38. public class LobbyTeleporter extends StaticBaseObject FText ftext = null boolean array[12] votes int currentPlus = 0 boolean ready = false boolean startmaze = false ondestroy if ftext != null ftext.recycle() construct(unit existing, boolean builder) super(existing.getPos(), existing, EVENT_RADIUS, function LobbyTeleporter.checkVote, null) actor..removeAbility(REMOVE_OBJECT_ID) ..removeAbility(MAKE_UNIT_INVISIBLE_ID) ..removeAbility(ESC_ID) if builder ftext = createCenterFText(existing.getPos().toVec3(), existing.getOwner().getNameColored() + " |cffffcc00building", 6) else startmaze = true ftext = createFText(pos, "", 10) override function slowUpdate() super.slowUpdate() if owner != STAFF_PLAYER and isBuilderPlayer(owner) and not owner.isIngame() terminate() static function checkVote() let source = GetTriggeringTrigger().getSource() let u = GetTriggerUnit() let e = u.getEntity() let obj = source.getEntity() castTo LobbyTeleporter if obj.ready and e instanceof Escaper and isEscaperPlayer(e.owner) obj.check(e castTo Escaper) function check(Escaper e) let votesNeeded = (escaperPlayers.size() * 0.45).round() votes[e.owner.getId()] = not votes[e.owner.getId()] if votes[e.owner.getId()] currentPlus++ if currentPlus >= votesNeeded if startmaze or (isEscaperPlayer(e.owner) and owner == STAFF_PLAYER and not actor.hasAbility(REMOVE_OBJECT_ID)) teleport(e) terminate() return else for ep from escaperPlayers.staticItr() if ep.escaper != null and ep.escaper.alive teleport(ep.escaper) setRallyPoint(pos.toVec2()) addQuestionmark() for i = 0 to 11 votes[i] = false ftext.tt.center(getPos(), owner.getNameColored() + " |cffffcc00building", 6) ready = false return else currentPlus-- flashEffect(UI.confirmation, pos) ftext.tt.center(getPos(), "|cff11cc00Ready|r - [" + currentPlus.toString() + "/|cffffcc00" + votesNeeded.toString() + "|r]", 9) function teleport(Escaper e) let rallyPos = getRallyPoint() if noRally == null ready = false e.setPos(rallyPos) addEffect(EFFECT_STRING, pos).destr() addEffect(EFFECT_STRING, rallyPos).destr() if not e.camlock PanCameraToTimedForPlayer(e.owner, rallyPos.x, rallyPos.y, 0.03) override function clearQuestionmark() super.clearQuestionmark() if owner != STAFF_PLAYER let votesNeeded = (escaperPlayers.size() * 0.55).round() ready = true currentPlus = 0 for i = 0 to 11 votes[i] = false if ftext != null ftext.tt.center(getPos(), "|cff11cc00Ready|r - [0" + "/|cffffcc00" + votesNeeded.toString() + "|r]", 9)