package UnitRemover import BaseObject import EscaperSensor import Decoration constant INFO_UNIT_REMOVER_ID = compiletime(ABIL_ID_GEN.next()) public class UnitRemover extends StaticBaseObject construct(unit existing) super(existing.getPos(), existing, 64., function UnitRemover.removeUnit, null) clearQuestionmark() actor.addAbility(TURN_OFF_ID) construct(vec2 pos, player owner) super(pos, createUnit(owner, UNIT_REMOVER_ID, pos, angle(0)), 64., function UnitRemover.removeUnit, null) clearQuestionmark() actor.addAbility(TURN_OFF_ID) static function removeUnit() let u = GetTriggerUnit() let data = u.getEntity() let sdata = GetTriggeringTrigger().getSource().getEntity() castTo UnitRemover if data != null and data.owner == sdata.owner and u.hasAbility(REMOVE_OBJECT_ID) if data instanceof SetupObject and not data instanceof StaticEscaperSensorSetup and not data instanceof Decoration Log.debug("UnitRemover Terminate") data.terminate() override function serialize() returns Json let json = super.serialize() json..addProperty(new Property(KEY_TYPE, UNITREMOVER_INDEX.toString())) return json @objectgen function genUnitRemover() new ChannelAbilityPreset(INFO_UNIT_REMOVER_ID, 1, TRUE) ..setName("Information: Unit Remover") ..presetTooltipNormal(lvl -> "Information: Unit Remover") ..presetTooltipNormalExtended(lvl -> "The Unit Remover removes any Unit that drives over it from the game") ..presetIcon("ReplaceableTextures\\CommandButtons\\PASInfo.blp") ..presetButtonPosNormal(0, 0) ..presetTargetTypes(Targettype.PASSIVE) ..setHeroAbility(FALSE) new BuildingDefinition(UNIT_REMOVER_ID, 'ncop') ..setName("|cffFF0000UnitRemover") ..setHotkey("E") ..setTooltipBasic("|cffFFCC00Build |cffFF0000UnitRemover [E]") ..setTooltipExtended("Removes units that were created by a Unitcreator") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNTank Remover.blp") ..setNormalAbilities(commaList(INFO_UNIT_REMOVER_ID, REMOVE_OBJECT_ID, GHOST_INVIS_ID, INVULNERABILITY_ID)) ..setButtonPositionX(2) ..setButtonPositionY(0) ..setTintingColorRed(100) ..setTintingColorGreen(0) ..setTintingColorBlue(0) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setBuildTime(1) ..setCollisionSize(0) ..setScalingValue(0.8) ..setSelectionScale(2.2) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true)