package Revivepoint import SetupObject import PlayerData import Startmazes import ClosureTimers import SoundUtils import ChannelAbilityPreset constant INFO_REVIVE_POINT_ID = compiletime(ABIL_ID_GEN.next()) constant real EVENT_RADIUS = 90. constant SoundDefinition rescueSound = new SoundDefinition("Sound\\Interface\\Rescue.wav", false) RevivePoint currentRevive = null public class RevivePoint extends StaticSetupObject boolean reached = false int startmaze = -1 construct(unit existing) super(existing, createUnit(existing.getOwner(), REVIVE_POINT_ID, existing.getPos(), angle(0)), EVENT_RADIUS, function RevivePoint.onReach) let tile = pos.getEBRTile() tile.addModifier(TileModifier.RESERVED) construct(vec3 pos, player owner) super(createUnit(owner, REVIVE_POINT_ID, pos.toVec2(), angle(0)), createUnit(owner, REVIVE_POINT_ID, pos.toVec2(), angle(0)), EVENT_RADIUS, function RevivePoint.onReach) let tile = pos.getEBRTile() if tile.hasModifier(TileModifier.RESERVED) terminate() else tile.addModifier(TileModifier.RESERVED) tile.setType(this.setCurrentRegion().getTypeSet().walkableId) function reach(Escaper reacher) Log.debug("on reach") if not reached reached = true actor.setColor(reacher.owner.getColor()) currentRevivepoint = pos.toVec2() if currentRevive != null currentRevive.actor.addAbility(REMOVE_OBJECT_ID) currentRevive = this this.actor.removeAbility(REMOVE_OBJECT_ID) rescueSound.play() printTimed(reacher.owner.getNameColored() + " advanced to the next |cff086BB5Checkpoint", 15) reacher.onCPReach() this.setCurrentRegion() if this.getCurrentRegion().getPermission(STAFF_PLAYER) == Permission.OWNER // Is Startmaze if startmaze > -1 if (startmazes[currentMaze] castTo int) > 0 and startmazes[currentMaze].isInit() startmazes[currentMaze].clearMaze() destroy startmazes[currentMaze] startmazes[currentMaze] = null currentMaze = startmaze if ((startmazes[currentMaze] castTo int) > 0 and not startmazes[currentMaze].isInit()) doAfter(0.5, () -> startmazes[currentMaze].initMaze()) svRev.reached = false svRev.actor.setColor(PLAYER_COLOR_LIGHT_GRAY) else svRev.reached = false svRev.actor.setColor(PLAYER_COLOR_LIGHT_GRAY) let getExp = currentRevivepoint.distanceTo(pos.toVec2()) > 512 for pd from escaperPlayers.staticItr() this.getCurrentRegion().revealRegion(pd.p) if pd.escaper != null and pd.escaper.alive pd.escaper.setPos(pos) pd.escaper.stop() pd.escaper.actor.abortOrder() if not pd.escaper.camlock pd.p.panCameraToTimed(pos, 0) if getExp pd.addXp(20, false) if getExp pData[owner.getId()].addXp(15, false) static function onReach() let source = GetTriggeringTrigger().getSource() let target = GetTriggerUnit() if(isEscaperPlayer(target.getOwner()) and target.getEntity() instanceof Escaper) (source.getEntity() castTo RevivePoint).reach(target.getEntity() castTo Escaper) static function filter() returns boolean return GetUnitTypeId(GetFilterUnit()) == REVIVE_POINT_ID override function serialize() returns Json let json = super.serialize() json..addProperty(new Property(KEY_TYPE, REVIVE_INDEX.toString())) return json override function terminate() if currentRevive != this Log.debug("Delete") super.terminate() else printTimedToPlayer("|cffcc3333You cannot remove the currently active Revivepoint", 5., owner) ondestroy pos.getEBRTile().removeModifier(TileModifier.RESERVED) @objectgen function genRevivePoint() new ChannelAbilityPreset(INFO_REVIVE_POINT_ID, 1, TRUE) ..setName("Information: Revivepoint") ..presetTooltipNormal(lvl -> "|cff7B94E6Information: |rRevivepoint") ..presetTooltipNormalExtended(lvl -> "The Revivepoint is the point where fallen Escapers get revived." + "\nThe Revivepoint gets activated if an Escaper walks into it. Builders cant activate a Revivepoint.") ..presetIcon("ReplaceableTextures\\CommandButtons\\PASInfo.blp") ..presetButtonPosNormal(0, 0) ..presetTargetTypes(Targettype.PASSIVE) ..setHeroAbility(FALSE) new BuildingDefinition(REVIVE_POINT_ID, 'ncop') ..setName("|cff087BB5Revivepoint") ..setHotkey("Q") ..setTooltipBasic("|cffFFCC00Build |cff087BB5Revivepoint [Q]") ..setTooltipExtended("Escapers get revived here when they die." + "\nThe Revivepoint is activated when an escaper steps on it.|nIt cannot be triggered by builders.") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNReviver.blp") ..setNormalAbilities(commaList(REMOVE_OBJECT_ID, INFO_REVIVE_POINT_ID, INVULNERABILITY_ID)) ..setButtonPositionX(0) ..setButtonPositionY(0) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setBuildTime(1) ..setCollisionSize(0) ..setScalingValue(2) ..setSelectionScale(4) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true)