1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-22 03:38:48 +02:00
ComfyFactorio/maps/dungeons/biome_laboratory.lua

44 lines
1.3 KiB
Lua
Raw Normal View History

2020-10-28 21:45:36 +01:00
local Functions = require "maps.dungeons.functions"
local table_shuffle_table = table.shuffle_table
local table_insert = table.insert
local math_random = math.random
local rainbow_tiles = {
"orange-refined-concrete", "purple-refined-concrete",
}
local function laboratory(surface, room)
local tiles = {}
for _, tile in pairs(room.path_tiles) do table_insert(tiles, tile) end
for _, tile in pairs(room.room_border_tiles) do table_insert(tiles, tile) end
for _, tile in pairs(room.room_tiles) do table_insert(tiles, tile) end
local seed = game.surfaces[surface.index].map_gen_settings.seed + math_random(1, 1000000)
for _, tile in pairs(tiles) do
surface.set_tiles({{name = rainbow_tiles[math_random(1, 2)], position = tile.position}}, true)
end
if not room.room_border_tiles[1] then return end
table_shuffle_table(room.room_tiles)
for key, tile in pairs(room.room_tiles) do
if key == 1 then
Functions.laboratory(surface, tile.position)
else
if math_random(1, 128) == 1 then
Functions.rare_loot_crate(surface, tile.position, true)
end
end
end
table_shuffle_table(room.room_border_tiles)
for key, tile in pairs(room.room_border_tiles) do
if key % 8 == 1 then
Functions.place_border_rock(surface, tile.position)
end
end
end
return laboratory