From 426f30d788a6fda053cd96eeebb543f704a82ef0 Mon Sep 17 00:00:00 2001 From: Andrettin <6322423+Andrettin@users.noreply.github.com> Date: Mon, 27 Jun 2022 07:59:50 +0200 Subject: [PATCH] Moved the wood pile definition to GSML --- data/unit_types/resources/wood_pile.txt | 40 +++++++++++++ scripts/civilizations/dwarf/units.lua | 2 +- scripts/map_generation.lua | 16 +++--- scripts/map_templates.lua | 16 +++--- scripts/stratagus.lua | 2 +- scripts/units.lua | 74 +++++-------------------- 6 files changed, 73 insertions(+), 77 deletions(-) create mode 100644 data/unit_types/resources/wood_pile.txt diff --git a/data/unit_types/resources/wood_pile.txt b/data/unit_types/resources/wood_pile.txt new file mode 100644 index 0000000000..ec1c698f53 --- /dev/null +++ b/data/unit_types/resources/wood_pile.txt @@ -0,0 +1,40 @@ +unit_wood_pile = { + name = "Wood Pile" + image_file = "neutral/buildings/wood_pile_1.png" + frame_size = { 43 43 } + animation_set = animations_building + icon = icon_lumber + neutral_minimap_color = { 165 42 42 } + hit_points = 25500 + draw_level = 30 + tile_size = { 1 1 } + box_size = { 36 36 } + sight_range = 1 + armor = 20 + missile = missile_none + priority = 0 + domain = land + starting_resources = 400 + num_directions = 1 + building = false + visible_under_fog = true + can_harvest = true + harvest_from_outside = true + given_resource = lumber + variations = { + 1 = { + } + 2 = { + image_file = "neutral/buildings/wood_pile_2.png" + } + 3 = { + image_file = "neutral/buildings/wood_pile_3.png" + } + 4 = { + image_file = "neutral/buildings/wood_pile_4.png" + } + } + sounds = { + selected = tree_selected + } +} diff --git a/scripts/civilizations/dwarf/units.lua b/scripts/civilizations/dwarf/units.lua index 1060b057b4..d3cc81f011 100644 --- a/scripts/civilizations/dwarf/units.lua +++ b/scripts/civilizations/dwarf/units.lua @@ -1997,7 +1997,7 @@ DefineUnitType("unit-dwarven-mushroom-farm", { Costs = {"lumber", 0, "stone", 750}, RepairCosts = {"lumber", 0, "stone", 1}, FireResistance = 20, - Drops = {"unit-wood-pile", "unit_stone_pile"}, + Drops = {"unit_wood_pile", "unit_stone_pile"}, Variations = { { "variation-id", "mushroom-farm", diff --git a/scripts/map_generation.lua b/scripts/map_generation.lua index c383cc86fa..279ffeb5c4 100644 --- a/scripts/map_generation.lua +++ b/scripts/map_generation.lua @@ -1933,9 +1933,9 @@ function CreatePlayers(min_x, max_x, min_y, max_y, town_halls, symmetric, starti CreateStartingGoldMine(i, nil, nil, true) -- create the player's gold mine if (GetPlayerData(i, "RaceName") == "dwarf") then CreateStartingLocationResourcePiles(i, "unit_stone_pile", 12) - CreateStartingLocationResourcePiles(i, "unit-wood-pile", 4) + CreateStartingLocationResourcePiles(i, "unit_wood_pile", 4) else - CreateStartingLocationResourcePiles(i, "unit-wood-pile", 16) + CreateStartingLocationResourcePiles(i, "unit_wood_pile", 16) end else for sub_x=-1,4 do @@ -2328,9 +2328,9 @@ function GenerateRandomMap(arg) if (GetPlayerData(i, "Type") == PlayerPerson or GetPlayerData(i, "Type") == PlayerComputer) then if (GetPlayerData(i, "RaceName") == "dwarf") then CreateStartingLocationResourcePiles(i, "unit_stone_pile", 12) - CreateStartingLocationResourcePiles(i, "unit-wood-pile", 4) + CreateStartingLocationResourcePiles(i, "unit_wood_pile", 4) else - CreateStartingLocationResourcePiles(i, "unit-wood-pile", 16) + CreateStartingLocationResourcePiles(i, "unit_wood_pile", 16) end end end @@ -2444,7 +2444,7 @@ function ApplyRawTiles() end elseif (RawTile(x, y) == "Tree" and (GetCurrentTileset() == "cave" or GetCurrentTileset() == "dungeon")) then -- if the cave or dungeon tileset is being used, then the trees are wood pile objects instead, and the tile is set to buildable land SetRawTile(x, y, "Land") - unit = CreateUnit("unit-wood-pile", PlayerNumNeutral, {x, y}) + unit = CreateUnit("unit_wood_pile", PlayerNumNeutral, {x, y}) elseif (RawTile(x, y) == "Door") then SetRawTile(x, y, "Land") unit = CreateUnit("unit-door", PlayerNumNeutral, {x, y}) @@ -3153,7 +3153,7 @@ function AdjustRawMapTileIrregularities(min_x, max_x, min_y, max_y, count, adjus end elseif (RawTile(x, y) == "Tree" and GetCurrentTileset() == "cave" or GetCurrentTileset() == "dungeon") then -- if the cave or dungeon tileset is being used, then the trees are wood pile objects instead, and the tile is set to buildable land SetRawTile(x, y, "Land") - unit = CreateUnit("unit-wood-pile", PlayerNumNeutral, {x, y}) + unit = CreateUnit("unit_wood_pile", PlayerNumNeutral, {x, y}) end end end @@ -4070,9 +4070,9 @@ function GenerateValley(direction, lake_quantity) if (GetPlayerData(i, "Type") == PlayerPerson or GetPlayerData(i, "Type") == PlayerComputer) then if (GetPlayerData(i, "RaceName") == "dwarf") then CreateStartingLocationResourcePiles(i, "unit_stone_pile", 12) - CreateStartingLocationResourcePiles(i, "unit-wood-pile", 4) + CreateStartingLocationResourcePiles(i, "unit_wood_pile", 4) else - CreateStartingLocationResourcePiles(i, "unit-wood-pile", 16) + CreateStartingLocationResourcePiles(i, "unit_wood_pile", 16) end end end diff --git a/scripts/map_templates.lua b/scripts/map_templates.lua index a3a2d2691f..5e64372fa9 100644 --- a/scripts/map_templates.lua +++ b/scripts/map_templates.lua @@ -44,7 +44,7 @@ DefineMapTemplate("island-of-the-lizard-god", { }, PlayerLocationGeneratedNeutralUnits = { "unit_copper_deposit", 1, - "unit-wood-pile", 16, + "unit_wood_pile", 16, "unit_stone_pile", 16 } }) @@ -58,18 +58,18 @@ DefineMapTemplate("island-of-the-lizard-god-underground", { SubtemplatePositionTopLeft = {748, 536}, GeneratedNeutralUnits = { "unit_copper_deposit", 1, - "unit-wood-pile", 32, - "unit-wood-pile", 32, - "unit-wood-pile", 32, - "unit-wood-pile", 32, - "unit-wood-pile", 32, - "unit-wood-pile", 32, + "unit_wood_pile", 32, + "unit_wood_pile", 32, + "unit_wood_pile", 32, + "unit_wood_pile", 32, + "unit_wood_pile", 32, + "unit_wood_pile", 32, "unit-snigill", 8, "unit-slime", 4 }, PlayerLocationGeneratedNeutralUnits = { "unit_copper_deposit", 1, - "unit-wood-pile", 16, + "unit_wood_pile", 16, "unit_stone_pile", 16 } }) diff --git a/scripts/stratagus.lua b/scripts/stratagus.lua index e7ac417434..0f4bb0677e 100644 --- a/scripts/stratagus.lua +++ b/scripts/stratagus.lua @@ -970,7 +970,7 @@ function StandardTriggers() if (GetArrayIncludes(wyr.preferences.TipsShown, "Wood Pile") == false) then AddTrigger("tip-wood-pile", function() - if (table.getn(GetSelectedUnits()) > 0 and GetUnitVariable(GetSelectedUnits()[1], "Ident") == "unit-wood-pile") then + if (table.getn(GetSelectedUnits()) > 0 and GetUnitVariable(GetSelectedUnits()[1], "Ident") == "unit_wood_pile") then return true else return false diff --git a/scripts/units.lua b/scripts/units.lua index abc08a105d..832b8cc167 100644 --- a/scripts/units.lua +++ b/scripts/units.lua @@ -763,50 +763,6 @@ DefineUnitType("unit-emerald-rock", { } } ) -DefineUnitType("unit-wood-pile", { - Name = "Wood Pile", - Image = {"file", "neutral/buildings/wood_pile_1.png", "size", {43, 43}}, - Animations = "animations-building", Icon = "icon_lumber", - NeutralMinimapColor = {165, 42, 42}, - Costs = {"time", 150}, - HitPoints = 25500, - DrawLevel = 30, - TileSize = {1, 1}, BoxSize = {36, 36}, - SightRange = 1, - Armor = 20, Missile = "missile-none", - Priority = 0, --- Corpse = "unit-destroyed-3x3-place", - Domain = "land", - StartingResources = {400}, - NumDirections = 1, - Building = false, VisibleUnderFog = true, - GivesResource = "lumber", CanHarvest = true, - HarvestFromOutside = true, - Variations = { - { - "variation-id", "1" - }, - { - "variation-id", "2", - "file", "neutral/buildings/wood_pile_2.png" - }, - { - "variation-id", "3", - "file", "neutral/buildings/wood_pile_3.png" - }, - { - "variation-id", "4", - "file", "neutral/buildings/wood_pile_4.png" - } - }, - Sounds = { - "selected", "tree-selected", --- "acknowledge", "gold-mine-acknowledge", --- "ready", "gold-mine-ready", --- "dead", "building-destroyed" - } -} ) - DefineUnitType("unit-template-lair", { Name = "Lair", Parent = "unit-template-base-deposit", @@ -3920,7 +3876,7 @@ DefineUnitType("unit-template-town-hall", { RecruitHeroes = true, IncreasesLuxuryDemand = true, CanStore = {"copper", "silver", "gold", "iron", "mithril", "lumber", "stone", "limestone", "coal", "jewelry", "furniture", "leather", "diamonds", "emeralds"}, - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, RightMouseAction = "rally_point", BurnPercent = 50, BurnDamageRate = 1, @@ -4003,7 +3959,7 @@ DefineUnitType("unit-template-farm", { Supply = 4, -- HydratingAura = 1, ExplodeWhenKilled = "missile-explosion", - Drops = {"unit-cheese", "unit-carrots", "unit_meat", "unit-wood-pile"}, + Drops = {"unit-cheese", "unit-carrots", "unit_meat", "unit_wood_pile"}, Domain = "land", BuilderOutside = true, IncreasesLuxuryDemand = true, @@ -4047,7 +4003,7 @@ DefineUnitType("unit-template-barracks", { IncreasesLuxuryDemand = true, GarrisonTraining = true, NeutralHostile = true, - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, RightMouseAction = "rally_point", CostModifier = 25, BurnPercent = 50, @@ -4095,7 +4051,7 @@ DefineUnitType("unit-template-lumber-mill", { IncreasesLuxuryDemand = true, NeutralHostile = true, MaxHarvesters = 5, - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, CostModifier = 25, BurnPercent = 50, BurnDamageRate = 1, @@ -4148,7 +4104,7 @@ DefineUnitType("unit-template-smithy", { NeutralHostile = true, MaxHarvesters = 5, CanStore = {"copper", "silver", "gold", "iron", "mithril", "coal", "diamonds", "emeralds"}, - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, CostModifier = 25, BurnPercent = 50, BurnDamageRate = 1, @@ -4214,7 +4170,7 @@ DefineUnitType("unit-template-masons-shop", { BuilderOutside = true, IncreasesLuxuryDemand = true, MaxHarvesters = 5, - Drops = {"unit-wood-pile", "unit_stone_pile"}, + Drops = {"unit_wood_pile", "unit_stone_pile"}, CostModifier = 25, BurnPercent = 50, BurnDamageRate = 1, @@ -4255,7 +4211,7 @@ DefineUnitType("unit-template-stables", { Domain = "land", BuilderOutside = true, IncreasesLuxuryDemand = true, - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, CostModifier = 25, BurnPercent = 50, BurnDamageRate = 1, @@ -4291,7 +4247,7 @@ DefineUnitType("unit-template-temple", { BuilderOutside = true, IncreasesLuxuryDemand = true, RightMouseAction = "rally_point", - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, CostModifier = 25, BurnPercent = 50, BurnDamageRate = 1, @@ -4335,7 +4291,7 @@ DefineUnitType("unit-template-university", { BuilderOutside = true, IncreasesLuxuryDemand = true, RightMouseAction = "rally_point", - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, CostModifier = 25, BurnPercent = 50, BurnDamageRate = 1, @@ -4382,7 +4338,7 @@ DefineUnitType("unit-template-watch-tower", { SaveCargo = true, BuilderOutside = true, NeutralHostile = true, - Drops = {"unit-wood-pile", "unit_stone_pile"}, + Drops = {"unit_wood_pile", "unit_stone_pile"}, -- RightMouseAction = "attack", BurnPercent = 50, BurnDamageRate = 1, @@ -4433,7 +4389,7 @@ DefineUnitType("unit-template-guard-tower", { SaveCargo = true, PierceDamage = true, NeutralHostile = true, - Drops = {"unit-wood-pile", "unit_stone_pile"}, + Drops = {"unit_wood_pile", "unit_stone_pile"}, BurnPercent = 50, BurnDamageRate = 1, RequirementsString = "Lumber Mill and Masonry", @@ -4478,7 +4434,7 @@ DefineUnitType("unit-template-heavy-tower", { CanTargetLand = true, CanTargetSea = true, DetectCloak = true, NeutralHostile = true, - Drops = {"unit-wood-pile", "unit_stone_pile"}, + Drops = {"unit_wood_pile", "unit_stone_pile"}, BurnPercent = 50, BurnDamageRate = 1, RequirementsString = "Lumber Mill, Smithy, Engineering and Masonry", @@ -4538,7 +4494,7 @@ DefineUnitType("unit-template-market", { CanHarvest = true, Inexhaustible = true, StartingResources = {1000}, - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, RightMouseAction = "rally_point", CostModifier = 25, BurnPercent = 50, @@ -4592,7 +4548,7 @@ DefineUnitType("unit-template-dock", { Inexhaustible = true, IncreasesLuxuryDemand = true, StartingResources = {1000}, --- Drops = {"unit-wood-pile"}, +-- Drops = {"unit_wood_pile"}, RightMouseAction = "rally_point", CostModifier = 25, BurnPercent = 50, @@ -4834,7 +4790,7 @@ DefineUnitType("unit-mercenary-camp", { Corpse = "unit-destroyed-3x3-place", ExplodeWhenKilled = "missile-explosion", Domain = "land", - Drops = {"unit-wood-pile"}, + Drops = {"unit_wood_pile"}, RightMouseAction = "rally_point", BurnPercent = 50, BurnDamageRate = 1,