diff --git a/maps/dungeons/biome_concrete.lua b/maps/dungeons/biome_concrete.lua index e21ac529..8985904c 100644 --- a/maps/dungeons/biome_concrete.lua +++ b/maps/dungeons/biome_concrete.lua @@ -16,7 +16,7 @@ local function concrete(surface, room) table_shuffle_table(room.room_border_tiles) for key, tile in pairs(room.room_border_tiles) do surface.set_tiles({{name = "refined-concrete", position = tile.position}}, true) - if key < 8 then + if key % 8 == 1 then surface.create_entity({name = "rock-big", position = tile.position}) else surface.create_entity({name = "stone-wall", position = tile.position}) diff --git a/maps/dungeons/biome_desert.lua b/maps/dungeons/biome_desert.lua index 0d72a249..360c426e 100644 --- a/maps/dungeons/biome_desert.lua +++ b/maps/dungeons/biome_desert.lua @@ -18,7 +18,7 @@ local function desert(surface, room) if #room.room_border_tiles > 1 then table_shuffle_table(room.room_border_tiles) end for key, tile in pairs(room.room_border_tiles) do surface.set_tiles({{name = "sand-1", position = tile.position}}, true) - if key < 9 then + if key % 8 == 1 then surface.create_entity({name = "rock-big", position = tile.position}) else if math_random(1, 9) == 1 then diff --git a/maps/dungeons/biome_dirtlands.lua b/maps/dungeons/biome_dirtlands.lua index 5b11874f..a58b4e62 100644 --- a/maps/dungeons/biome_dirtlands.lua +++ b/maps/dungeons/biome_dirtlands.lua @@ -1,4 +1,5 @@ local Functions = require "maps.dungeons.functions" +local Get_noise = require "utils.get_noise" local table_shuffle_table = table.shuffle_table local table_insert = table.insert @@ -6,25 +7,36 @@ local table_remove = table.remove local math_random = math.random local math_abs = math.abs +local decoratives = {"brown-asterisk", "brown-carpet-grass", "brown-fluff", "brown-fluff-dry", "brown-hairy-grass", "brown-asterisk", "brown-fluff", "brown-fluff-dry"} local ores = {"iron-ore", "iron-ore", "iron-ore", "iron-ore", "copper-ore", "copper-ore", "copper-ore","coal", "coal","stone", "stone"} local trees = {"dead-dry-hairy-tree", "dead-grey-trunk", "dead-tree-desert", "dry-hairy-tree", "dry-tree"} local size_of_trees = #trees +local function draw_deco(surface, position, decorative_name, seed) + if surface.get_tile(position).name == "water" then return end + local noise = Get_noise("decoratives", position, seed) + if math_abs(noise) > 0.35 then + surface.create_decoratives{check_collision = false, decoratives = {{name = decorative_name, position = position, amount = math.floor(math.abs(noise * 3)) + 1}}} + end +end + +local function draw_room_decoratives(surface, room) + local seed = game.surfaces[1].map_gen_settings.seed + math_random(1, 1000000) + local decorative_name = decoratives[math_random(1, #decoratives)] + for _, tile in pairs(room.path_tiles) do draw_deco(surface, tile.position, decorative_name, seed) end + for _, tile in pairs(room.room_border_tiles) do draw_deco(surface, tile.position, decorative_name, seed) end + for _, tile in pairs(room.room_tiles) do draw_deco(surface, tile.position, decorative_name, seed) end +end + local function dirtlands(surface, room) local path_tile = "dirt-" .. math_random(1, 3) for _, tile in pairs(room.path_tiles) do surface.set_tiles({{name = path_tile, position = tile.position}}, true) end - if #room.room_border_tiles > 1 then table_shuffle_table(room.room_border_tiles) end - for key, tile in pairs(room.room_border_tiles) do - surface.set_tiles({{name = "dirt-4", position = tile.position}}, true) - if key < 9 then - surface.create_entity({name = "rock-big", position = tile.position}) - end - end + if not room.room_border_tiles[1] then draw_room_decoratives(surface, room) return end - if #room.room_tiles > 1 then table_shuffle_table(room.room_tiles) end + table_shuffle_table(room.room_tiles) for key, tile in pairs(room.room_tiles) do surface.set_tiles({{name = "dirt-7", position = tile.position}}, true) if math_random(1, 64) == 1 then @@ -68,6 +80,16 @@ local function dirtlands(surface, room) end end end + + table_shuffle_table(room.room_border_tiles) + for key, tile in pairs(room.room_border_tiles) do + surface.set_tiles({{name = "dirt-4", position = tile.position}}, true) + if key % 8 == 1 then + surface.create_entity({name = "rock-big", position = tile.position}) + end + end + + draw_room_decoratives(surface, room) end return dirtlands \ No newline at end of file diff --git a/maps/dungeons/biome_doom.lua b/maps/dungeons/biome_doom.lua index fa6bacbe..2409b1ee 100644 --- a/maps/dungeons/biome_doom.lua +++ b/maps/dungeons/biome_doom.lua @@ -47,7 +47,7 @@ local function doom(surface, room) if #room.room_border_tiles > 1 then table_shuffle_table(room.room_border_tiles) end for key, tile in pairs(room.room_border_tiles) do surface.set_tiles({{name = "black-refined-concrete", position = tile.position}}, true) - if key < 9 then + if key % 8 == 1 then surface.create_entity({name = "rock-big", position = tile.position}) end end diff --git a/maps/dungeons/biome_glitch.lua b/maps/dungeons/biome_glitch.lua index a76a9539..b6d4f8c8 100644 --- a/maps/dungeons/biome_glitch.lua +++ b/maps/dungeons/biome_glitch.lua @@ -52,7 +52,7 @@ local function glitch(surface, room) table_shuffle_table(room.room_border_tiles) for key, tile in pairs(room.room_border_tiles) do surface.set_tiles({{name = "lab-dark-2", position = tile.position}}, true) - if key < 7 then + if key % 8 == 1 then surface.create_entity({name = "rock-big", position = tile.position}) end end diff --git a/maps/dungeons/biome_grasslands.lua b/maps/dungeons/biome_grasslands.lua index 7c10a4a9..d142902d 100644 --- a/maps/dungeons/biome_grasslands.lua +++ b/maps/dungeons/biome_grasslands.lua @@ -42,7 +42,7 @@ local function grasslands(surface, room) table_shuffle_table(room.room_tiles) for key, tile in pairs(room.room_tiles) do surface.set_tiles({{name = "grass-2", position = tile.position}}, true) - if math_random(1, 64) == 1 then + if math_random(1, 48) == 1 then surface.create_entity({name = ores[math_random(1, #ores)], position = tile.position, amount = math_random(250, 500) + global.dungeons.depth * 10}) else if math_random(1, 12) == 1 then @@ -81,10 +81,6 @@ local function grasslands(surface, room) surface.set_tiles({{name = "grass-3", position = tile.position}}, true) if key % 8 == 1 then surface.create_entity({name = "rock-big", position = tile.position}) - else - if math_random(1, 8) == 1 then - --surface.create_entity({name = tree_name, position = tile.position}) - end end end diff --git a/maps/dungeons/biome_red_desert.lua b/maps/dungeons/biome_red_desert.lua index e6dbdc2d..2e1cfcb3 100644 --- a/maps/dungeons/biome_red_desert.lua +++ b/maps/dungeons/biome_red_desert.lua @@ -56,7 +56,7 @@ local function red_desert(surface, room) if #room.room_border_tiles > 1 then table_shuffle_table(room.room_border_tiles) end for key, tile in pairs(room.room_border_tiles) do surface.set_tiles({{name = "red-desert-1", position = tile.position}}, true) - if key < 9 then + if key % 8 == 1 then surface.create_entity({name = "rock-big", position = tile.position}) else if math_random(1, 3) > 1 then