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

Grass tiles now get dagobah swamp based values

This commit is contained in:
TWLTriston 2017-11-12 16:30:17 -05:00
parent ea5259cadf
commit 1802153657
2 changed files with 115 additions and 13 deletions

View File

@ -23,8 +23,8 @@ local tile_types = {
local cols = 5
local rows = 20 / cols
local tile_width = 32
local tile_height = 32
local tile_width = 64
local tile_height = 64
local tile_data = {}

View File

@ -15,21 +15,30 @@ function run_place_tiles(params)
surface.set_tiles(global._tiles_hold, true)
end
function run_place_items(params)
local surface = params.surface
for _,deco in pairs(global._decoratives_hold) do
surface.create_decoratives{check_collision=false, decoratives={deco}}
if MAP_GEN == nil then
game.print("MAP_GEN not set")
return
end
for _, entity in ipairs(global._entities_hold) do
if surface.can_place_entity {name=entity.name, position=entity.position} then
surface.create_entity {name=entity.name, position=entity.position}
local area = event.area
local surface = event.surface
MAP_GEN_SURFACE = surface
local tiles = {}
local entities = {}
local decoratives = {}
local top_x = area.left_top.x
local top_y = area.left_top.y
if map_gen_decoratives then
for _, e in pairs(surface.find_entities_filtered{area=area, type="simple-entity"}) do
e.destroy()
end
for _, e in pairs(surface.find_entities_filtered{area=area, type="tree"}) do
e.destroy()
end
end
end
function run_calc_items(params)
local top_x = params.top_x
local top_y = params.top_y
for y = top_y, top_y + 31 do
for x = top_x, top_x + 31 do
@ -82,6 +91,99 @@ function run_chart_update(params)
-- Don't use full area, otherwise adjacent chunks get charted
game.forces.player.chart(params.surface, {{ params.area.left_top.x, params.area.left_top.y}, { params.area.left_top.x+30, params.area.left_top.y+30} } )
end
end
local decorative_options = {
["concrete"] = {},
["deepwater"] = {},
["deepwater-green"] = {},
["dirt"] = {},
["dirt-dark"] = {},
["grass"] = {
{"green-carpet-grass", 3},
{"green-hairy-grass", 7},
{"green-bush-mini", 10},
{"green-pita", 6},
{"green-small-grass", 12},
{"green-asterisk", 25},
{"green-bush-mini", 7},
},
["grass-dry"] = {},
["grass-medium"] = {},
["hazard-concrete-left"] = {},
["hazard-concrete-right"] = {},
["lab-dark-1"] = {},
["lab-dark-2"] = {},
["red-desert"] = {},
["red-desert-dark"] = {},
["sand"] = {},
["sand-dark"] = {},
["stone-path"] = {},
["water"] = {},
["water-green"] = {},
["out-of-map"] = {},
}
function check_decorative(tile, x, y)
local options = decorative_options[tile]
local tile_decoratives = {}
for _,e in ipairs(options) do
name = e[1]
high_roll = e[2]
if math.random(1, high_roll) == 1 then
table.insert(tile_decoratives, {name=name, amount=1, position={x,y}})
end
end
return tile_decoratives
end
local entity_options = {
["concrete"] = {},
["deepwater"] = {},
["deepwater-green"] = {},
["dirt"] = {},
["dirt-dark"] = {},
["grass"] = {
{"tree-04", 400},
{"tree-06", 150},
{"tree-07", 400},
{"tree-09", 1000},
{"stone-rock", 400},
{"green-coral", 10000},
},
["grass-dry"] = {},
["grass-medium"] = {},
["hazard-concrete-left"] = {},
["hazard-concrete-right"] = {},
["lab-dark-1"] = {},
["lab-dark-2"] = {},
["red-desert"] = {},
["red-desert-dark"] = {},
["sand"] = {},
["sand-dark"] = {},
["stone-path"] = {},
["water"] = {},
["water-green"] = {},
["out-of-map"] = {},
}
function check_entities(tile, x, y)
local options = entity_options[tile]
local tile_entity_list = {}
for _,e in ipairs(options) do
name = e[1]
high_roll = e[2]
if math.random(1, high_roll) == 1 then
table.insert(tile_entity_list, {name=name, position={x,y}})
end
end
return tile_entity_list
end
function run_combined_module(event)