Skip to content

Commit

Permalink
Fixed decoration unit generation for cave floor terrain
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrettin committed Mar 6, 2022
1 parent 872db80 commit ea64292
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 58 deletions.
14 changes: 7 additions & 7 deletions scripts/map_generation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1691,38 +1691,38 @@ function CreateDecorations()
unit = CreateUnit("unit-mushroom-patch", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
elseif (RandomNumber >= 200 and RandomNumber < 300) then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound-cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound_cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
unit = CreateUnit("unit-flowers", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
end
elseif (RandomNumber >= 300 and RandomNumber < 400) then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound-cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound_cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
unit = CreateUnit("unit-large-flower", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
end
elseif (RandomNumber >= 400 and RandomNumber < 600) then
if ((GetTileTerrainName(RandomX, RandomY) == "cave-floor" or GetTileTerrainName(RandomX, RandomY) == "rockbound-cave-floor") and SyncRand(2) == 0) then
if ((GetTileTerrainName(RandomX, RandomY) == "cave_floor" or GetTileTerrainName(RandomX, RandomY) == "rockbound_cave_floor") and SyncRand(2) == 0) then
unit = CreateUnit("unit-stalagmites", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
else
unit = CreateUnit("unit-small-rocks", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
end
elseif (RandomNumber >= 600 and RandomNumber < 800) then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound-cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound_cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
unit = CreateUnit("unit-twigs", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
elseif (GetTileTerrainName(RandomX, RandomY) == "floor") then
unit = CreateUnit("unit-floor-decoration", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
end
elseif (RandomNumber >= 800 and RandomNumber < 875) then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound-cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound_cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
unit = CreateUnit("unit-fern", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
end
elseif (RandomNumber >= 875 and RandomNumber < 900) then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound-cave-floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
if (GetTileTerrainName(RandomX, RandomY) ~= "cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "rockbound_cave_floor" and GetTileTerrainName(RandomX, RandomY) ~= "floor" and GetTileTerrainName(RandomX, RandomY) ~= "rug" and GetTileTerrainName(RandomX, RandomY) ~= "gold-pile") then
unit = CreateUnit("unit-log", PlayerNumNeutral, {RandomX, RandomY})
Count = Count - 1
end
Expand Down Expand Up @@ -6075,7 +6075,7 @@ end

function GetTerrainCivilizations(terrain)
local terrain_civilizations = {}
if (terrain == "dry_mud" or terrain == "cave-floor") then
if (terrain == "dry_mud" or terrain == "cave_floor") then
table.insert(terrain_civilizations, "dwarf")
table.insert(terrain_civilizations, "gnome")
table.insert(terrain_civilizations, "goblin")
Expand Down
8 changes: 4 additions & 4 deletions scripts/terrain_types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
DefineTerrainType("chasm", {
Name = "Chasm",
Color = {32, 32, 0},
BaseTerrainTypes = {"dirt", "dry_dirt", "mud", "dry-mud", "rockbound-cave-floor", "cave-floor", "snow", "grass", "semi_dry_grass", "dry_grass", "ice", "ford"},
BaseTerrainTypes = {"dirt", "dry_dirt", "mud", "dry-mud", "rockbound_cave_floor", "cave_floor", "snow", "grass", "semi_dry_grass", "dry_grass", "ice", "ford"},
Overlay = true,
Flags = {"unpassable"},
AllowSingle = true,
Expand Down Expand Up @@ -112,7 +112,7 @@ DefineTerrainType("floor", {
Character = "f",
Buildable = true,
Flags = {"land", "stone_floor", "underground"},
OuterBorderTerrains = {"rockbound-cave-floor", "cave-floor"},
OuterBorderTerrains = {"rockbound_cave_floor", "cave_floor"},
Graphics = "terrain/floor.png",
SolidTiles = {17, 20, 23, 26},
AdjacentTransitionTiles = {
Expand Down Expand Up @@ -217,7 +217,7 @@ DefineTerrainType("gold-pile", {
DefineTerrainType("dungeon-wall", {
Name = "Dungeon Wall",
Buildable = true,
BaseTerrainTypes = {"floor", "cave-floor"},
BaseTerrainTypes = {"floor", "cave_floor"},
Overlay = true,
Flags = {"land", "wall", "unpassable", "air-unpassable"},
AllowSingle = true,
Expand Down Expand Up @@ -415,7 +415,7 @@ DefineTerrainType("dungeon-wall", {
DefineTerrainType("limestone-rock", {
Name = "Limestone Rock",
Color = {128, 160, 128},
BaseTerrainTypes = {"dirt", "dry_dirt", "mud", "dry-mud", "rockbound-cave-floor", "cave-floor", "desert-sand"},
BaseTerrainTypes = {"dirt", "dry_dirt", "mud", "dry-mud", "rockbound_cave_floor", "cave_floor", "desert-sand"},
Overlay = true,
Flags = {"land", "rock", "unpassable"},
Graphics = "terrain/limestone_rock.png",
Expand Down
12 changes: 6 additions & 6 deletions scripts/tilesets/cave.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ DefineTileset("name", "Cave",
{ 400, 401, 402, 400 }}, -- 010
"solid", { "unused",
{}}, -- 020
"solid", { "rockbound-cave-floor", "land", "no-building", "gravel",
"solid", { "rockbound_cave_floor", "land", "no-building", "gravel",
{ 432, 433, 434, 432}}, -- 030
"solid", { "unused",
{}}, -- 040
"solid", { "cave-floor", "land", "stone_floor",
"solid", { "cave_floor", "land", "stone_floor",
{ 464, 465, 466, 464}}, -- 050
"solid", { "unused",
{}}, -- 060
Expand Down Expand Up @@ -90,7 +90,7 @@ DefineTileset("name", "Cave",
{ 229, 230}, -- 1D0
{}, -- 1E0
{}}, -- 1F0
"mixed", { "gray-shallow-water", "rockbound-cave-floor", "coast",
"mixed", { "gray-shallow-water", "rockbound_cave_floor", "coast",
{ 240, 241, 240}, -- 200
{ 242, 243, 242}, -- 210
{ 244, 245, 246}, -- 220
Expand All @@ -107,7 +107,7 @@ DefineTileset("name", "Cave",
{ 268, 269, 268}, -- 2D0
{}, -- 2E0
{}}, -- 2F0
"mixed", { "dark-rockbound-cave-floor", "rockbound-cave-floor", "land", "no-building", "gravel",
"mixed", { "dark_rockbound_cave_floor", "rockbound_cave_floor", "land", "no-building", "gravel",
{ 177, 177, 177}, -- 300
{ 178, 178, 178}, -- 310
{ 179, 180, 181}, -- 320
Expand All @@ -124,7 +124,7 @@ DefineTileset("name", "Cave",
{ 200, 200, 200}, -- 3D0
{}, -- 3E0
{}}, -- 3F0
"mixed", { "cave-wall", "rockbound-cave-floor", "land", "rock", "unpassable", "air-unpassable",
"mixed", { "cave-wall", "rockbound_cave_floor", "land", "rock", "unpassable", "air-unpassable",
{ 35, 38, 35}, -- 400
{ 33, 36, 33}, -- 410
{ 34, 37, 40}, -- 420
Expand All @@ -141,7 +141,7 @@ DefineTileset("name", "Cave",
{ 10, 10, 10}, -- 4D0
{}, -- 4E0
{}}, -- 4F0
"mixed", { "rockbound-cave-floor", "cave-floor", "land", "no-building", "gravel",
"mixed", { "rockbound_cave_floor", "cave_floor", "land", "no-building", "gravel",
{ 272, 273, 272}, -- 500
{ 274, 275, 274}, -- 510
{ 276, 277, 278}, -- 520
Expand Down
6 changes: 3 additions & 3 deletions scripts/tilesets/dungeon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ DefineTileset("name", "Dungeon",
{}}, -- 010
"solid", { "unused",
{}}, -- 020
"solid", { "rockbound-cave-floor", "land", "no-building", "gravel",
"solid", { "rockbound_cave_floor", "land", "no-building", "gravel",
{ 432, 433, 434, 432}}, -- 030
"solid", { "rug", "land", "grass", -- since the "dark unbuildable land" slot is unused, use it for the rug (essentially a second type of "dark buildable land")
{ 448, 449, 448, 449}}, -- 040
Expand Down Expand Up @@ -125,7 +125,7 @@ DefineTileset("name", "Dungeon",
{ 366, 366, 366}, -- 3D0
{}, -- 3E0
{}}, -- 3F0
"mixed", { "cave-wall", "rockbound-cave-floor", "land", "rock", "unpassable", "air-unpassable",
"mixed", { "cave-wall", "rockbound_cave_floor", "land", "rock", "unpassable", "air-unpassable",
{ 136, 159, 172}, -- 400
{ 128, 153, 171}, -- 410
{ 150, 162, 167}, -- 420
Expand All @@ -142,7 +142,7 @@ DefineTileset("name", "Dungeon",
{ 131, 131, 131}, -- 4D0
{}, -- 4E0
{}}, -- 4F0
"mixed", { "rockbound-cave-floor", "floor", "land", "no-building", "gravel",
"mixed", { "rockbound_cave_floor", "floor", "land", "no-building", "gravel",
{ 272, 272, 272}, -- 500
{ 274, 274, 274}, -- 510
{ 276, 277, 278}, -- 520
Expand Down
76 changes: 38 additions & 38 deletions scripts/units.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1208,24 +1208,24 @@ DefineUnitType("unit-flowers", {
"file", "neutral/decorations/flowers_swamp_1.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/flowers_swamp_2.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/flowers_swamp_3.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
}
},
Sounds = {}
Expand Down Expand Up @@ -1281,96 +1281,96 @@ DefineUnitType("unit-large-flower", {
"file", "neutral/decorations/large_flower_swamp_1.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_2.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_3.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_4.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_5.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_6.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_7.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_8.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_9.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_10.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_11.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/large_flower_swamp_12.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
}
},
Sounds = {}
Expand Down Expand Up @@ -1407,32 +1407,32 @@ DefineUnitType("unit-fern", { Name = "Fern",
"file", "neutral/decorations/fern_swamp_1.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/fern_swamp_2.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/fern_swamp_3.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
},
{
"variation-id", "swamp",
"file", "neutral/decorations/fern_swamp_4.png",
"terrain", "dry-mud",
"terrain", "mud",
"terrain", "cave-floor",
"terrain", "rockbound-cave-floor"
"terrain", "cave_floor",
"terrain", "rockbound_cave_floor"
}
},
Sounds = {}
Expand Down

0 comments on commit ea64292

Please sign in to comment.