mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-07 13:31:40 +02:00
terrain update
This commit is contained in:
parent
722eda8388
commit
ff2ee0a2e9
@ -56,7 +56,6 @@ end
|
||||
function Public.reset_map()
|
||||
local map_gen_settings = {}
|
||||
map_gen_settings.seed = math_random(1, 10000000)
|
||||
map_gen_settings.height = 192
|
||||
map_gen_settings.water = 0.2
|
||||
map_gen_settings.starting_area = 1
|
||||
map_gen_settings.terrain_segmentation = 12
|
||||
@ -144,7 +143,7 @@ local function get_belts(spawner)
|
||||
return belts
|
||||
end
|
||||
|
||||
local nom_msg = {"munch", "munch", "yum"}
|
||||
local nom_msg = {"munch", "munch", "yum", "nom"}
|
||||
|
||||
local function feed_floaty_text(entity)
|
||||
entity.surface.create_entity({name = "flying-text", position = entity.position, text = nom_msg[math_random(1, #nom_msg)], color = {math_random(50, 100), 0, 255}})
|
||||
@ -295,7 +294,7 @@ end
|
||||
|
||||
local function tick()
|
||||
if game.tick % 240 == 0 then
|
||||
local area = {{-256, -96}, {255, 96}}
|
||||
local area = {{-256, -97}, {255, 96}}
|
||||
game.forces.west.chart(game.surfaces[global.active_surface_index], area)
|
||||
game.forces.east.chart(game.surfaces[global.active_surface_index], area)
|
||||
end
|
||||
|
@ -1,3 +1,5 @@
|
||||
local math_abs = math.abs
|
||||
|
||||
local function get_replacement_tile(surface, position)
|
||||
for i = 1, 128, 1 do
|
||||
local vectors = {{0, i}, {0, i * -1}, {i, 0}, {i * -1, 0}}
|
||||
@ -12,6 +14,11 @@ end
|
||||
|
||||
local function combat_area(event)
|
||||
local surface = event.surface
|
||||
local left_top = event.area.left_top
|
||||
|
||||
if left_top.y >= 96 then return end
|
||||
if left_top.y < -96 then return end
|
||||
|
||||
for _, tile in pairs(surface.find_tiles_filtered({area = event.area})) do
|
||||
if tile.name == "water" or tile.name == "deepwater" then
|
||||
surface.set_tiles({{name = get_replacement_tile(surface, tile.position), position = tile.position}}, true)
|
||||
@ -25,11 +32,29 @@ local function combat_area(event)
|
||||
end
|
||||
end
|
||||
|
||||
local function is_out_of_map(p)
|
||||
if p.y < 96 and p.y >= -96 then return end
|
||||
if p.x * 0.5 > math_abs(p.y) then return end
|
||||
if p.x * -0.5 > math_abs(p.y) then return end
|
||||
return true
|
||||
end
|
||||
|
||||
local function out_of_map_area(event)
|
||||
local surface = event.surface
|
||||
local left_top = event.area.left_top
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local p = {x = left_top.x + x, y = left_top.y + y}
|
||||
if is_out_of_map(p) then surface.set_tiles({{name = "out-of-map", position = p}}, true) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_chunk_generated(event)
|
||||
local left_top = event.area.left_top
|
||||
if left_top.y >= 96 then return end
|
||||
if left_top.y < -96 then return end
|
||||
|
||||
out_of_map_area(event)
|
||||
|
||||
if left_top.x >= -192 and left_top.x < 192 then combat_area(event) end
|
||||
|
||||
if left_top.x > 512 then return end
|
||||
|
Loading…
x
Reference in New Issue
Block a user