package Tree import Entity import RegionData import ChannelAbilityPreset import Json constant TREE_ID = compiletime(UNIT_ID_GEN.next()) public class Tree extends UnitEntity private destructable dummy construct(vec2 pos, player owner) super(createUnit(owner, TREE_ID, pos, angle(0))) let rdata = this.setCurrentRegion().getTypeSet() dummy = createDestructable(rdata.treeId, pos, GetRandomReal(0,360).fromDeg(), GetRandomReal(0.8,1.2), GetRandomInt(0,2)) override function serialize() returns Json let json = super.serialize() json..addProperty(new Property(KEY_TYPE, TREE_INDEX.toString())) return json ondestroy dummy.remove() @objectgen function genTree() new BuildingDefinition(TREE_DUMMY_ID, 'ncop') ..setName("|cFF00FF00Tree|r ") ..setTooltipBasic("Build |cFFFFFF00Tree|r [|cffFFCC00Q|r]") ..setCategorizationCampaign(false) ..setRace(Race.Nightelf) ..setSelectionScale(1.0) ..setDescription("") ..setHotkey("Q") ..setBuildTime(1) ..setUnitSoundSet("") ..setPathingMap("none") ..setModelFile("Doodads\\Barrens\\Plants\\Barrens_TreeDoodad\\Barrens_TreeDoodad1.mdl") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNNightElfBuild.blp") ..setTooltipExtended("Does not kill escapers\r\nCreates a Tree fitting to your Regions terrain") ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setNameEditorSuffix("(Dummy)") ..setUnitClassification("ancient,standon") new BuildingDefinition(TREE_ID, 'ncop') ..setScalingValue(0.1) ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNNightElfBuild.blp") ..setModelFile("models\\tcBox.mdl") ..setSelectionScale(1.0) ..setUnitSoundSet("") ..setPathingMap("none") ..setCategorizationCampaign(false) ..setNormalAbilities(commaList(GHOST_VIS_ID, REMOVE_OBJECT_ID, INVULNERABILITY_ID)) ..setHotkey("Q") ..setName("|cFF00FF00Tree|r ") ..setTooltipBasic("Plant |cff08A54ATree |r[|cffFFCC00Q|r]") ..setTooltipExtended("Plants a tree, fitting to the terraintype of your region.|n|n|cff5AB542Does not kill escapers, has no pathing") ..setBuildTime(1) ..setUnitClassification("ancient,standon") ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setRace(Race.Nightelf) ..setDescription("") ..setHideMinimapDisplay(true)