1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-18 03:21:47 +02:00

Start of the deco overlay on picture maps -- working on a biome test area

This commit is contained in:
TWLTriston 2017-11-12 08:11:06 -05:00
parent dae8b0bdb1
commit 5a5d77f7ca
3 changed files with 70 additions and 13 deletions

View File

@ -0,0 +1,47 @@
local tile_types = {
"concrete",
"deepwater",
"deepwater-green",
"dirt",
"dirt-dark",
"grass",
"grass-dry",
"grass-medium",
"hazard-concrete-left",
"hazard-concrete-right",
"lab-dark-1",
"lab-dark-2",
"out-of-map",
"red-desert",
"red-desert-dark",
"sand",
"sand-dark",
"stone-path",
"water",
"water-green"
}
local tile_width = 32
local tile_height = 32
local tile_data = {}
local abs_y = 1
for e,_ in ipairs(tile_types) do
for y = 1, tile_width do
row = {}
for x = 1, tile_height do
table.insert( row, e)
end
-- abs_y = abs_y + 1
table.insert(tile_data, row)
-- tile_data[abs_y] = row
end
end
return {
height = tile_height * #tile_data,
width = tile_height,
data = tile_data
}

View File

@ -1,7 +1,7 @@
require("locale.gen_combined.grilledham_map_gen.builders")
function run_combined_module(event)
if MAP_GEN == nil then
game.print("MAP_GEN not set")
return
@ -18,29 +18,29 @@ function run_combined_module(event)
for y = top_y, top_y + 31 do
for x = top_x, top_x + 31 do
-- local coords need to be 'centered' to allow for correct rotation and scaling.
local tile, entity = MAP_GEN(x + 0.5, y + 0.5, x, y)
if type(tile) == "boolean" and not tile then
table.insert( tiles, {name = "out-of-map", position = {x, y}} )
-- local coords need to be 'centered' to allow for correct rotation and scaling.
local tile, entity = MAP_GEN(x + 0.5, y + 0.5, x, y)
if type(tile) == "boolean" and not tile then
table.insert( tiles, {name = "out-of-map", position = {x, y}} )
elseif type(tile) == "string" then
table.insert( tiles, {name = tile, position = {x, y}} )
table.insert( tiles, {name = tile, position = {x, y}} )
end
if entity then
table.insert(entities, entity)
end
end
end
end
-- set tiles.
surface.set_tiles(tiles, false)
-- set entities
for _, v in ipairs(entities) do
if surface.can_place_entity(v) then
surface.create_entity(v)
for _, v in ipairs(entities) do
if surface.can_place_entity(v) then
surface.create_entity(v)
end
end
end
end
end

View File

@ -0,0 +1,10 @@
require "locale.gen_combined.grilledham_map_gen.map_gen"
require "locale.gen_combined.grilledham_map_gen.builders"
local pic = require "locale.gen_combined.grilledham_map_gen.data.biome_test"
local shape = picture_builder(pic.data, pic.width, pic.height)
shape = change_tile(shape, false, "deepwater")
return shape