mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-17 20:58:13 +02:00
Hotfix to add Fish to Fish
This commit is contained in:
parent
d21ac7f042
commit
7ac4e96997
@ -1,87 +0,0 @@
|
||||
local event = require 'utils.event'
|
||||
|
||||
local function set_chunk_coords(radius)
|
||||
global.chunk_gen_coords = {}
|
||||
for r = radius, 1, -1 do
|
||||
for x = r * -1, r - 1, 1 do
|
||||
local pos = {x = x, y = r * -1}
|
||||
if math.sqrt(pos.x ^ 2 + pos.y ^ 2) <= radius then table.insert(global.chunk_gen_coords, pos) end
|
||||
end
|
||||
for y = r * -1, r - 1, 1 do
|
||||
local pos = {x = r, y = y}
|
||||
if math.sqrt(pos.x ^ 2 + pos.y ^ 2) <= radius then table.insert(global.chunk_gen_coords, pos) end
|
||||
end
|
||||
for x = r, r * -1 + 1, -1 do
|
||||
local pos = {x = x, y = r}
|
||||
if math.sqrt(pos.x ^ 2 + pos.y ^ 2) <= radius then table.insert(global.chunk_gen_coords, pos) end
|
||||
end
|
||||
for y = r, r * -1 + 1, -1 do
|
||||
local pos = {x = r * -1, y = y}
|
||||
if math.sqrt(pos.x ^ 2 + pos.y ^ 2) <= radius then table.insert(global.chunk_gen_coords, pos) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function draw_gui()
|
||||
for _, player in pairs(game.players) do
|
||||
if global.map_generation_complete then
|
||||
if player.gui.left["map_pregen"] then player.gui.left["map_pregen"].destroy() end
|
||||
else
|
||||
local caption = "Map is generating... " .. #global.chunk_gen_coords .. " chunks left. Please get comfy."
|
||||
if player.gui.left["map_pregen"] then
|
||||
player.gui.left["map_pregen"].caption = caption
|
||||
else
|
||||
local frame = player.gui.left.add({
|
||||
type = "frame",
|
||||
caption = caption,
|
||||
name = "map_pregen"
|
||||
})
|
||||
frame.style.font_color = {r = 150, g = 0, b = 255}
|
||||
frame.style.font = "heading-1"
|
||||
frame.style.maximal_height = 42
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function process_chunk(surface)
|
||||
if global.map_generation_complete then return end
|
||||
if game.tick < 300 then return end
|
||||
if not global.chunk_gen_coords then
|
||||
set_chunk_coords(25)
|
||||
--table.shuffle_table(global.chunk_gen_coords)
|
||||
end
|
||||
if #global.chunk_gen_coords == 0 then
|
||||
global.map_generation_complete = true
|
||||
draw_gui()
|
||||
for _, player in pairs(game.connected_players) do
|
||||
player.play_sound{path="utility/new_objective", volume_modifier=0.75}
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if not game then return end
|
||||
local surface = game.surfaces["fish_defender"]
|
||||
if not surface then return end
|
||||
|
||||
local force_chunk_requests = 2
|
||||
|
||||
for i = #global.chunk_gen_coords, 1, -1 do
|
||||
if surface.is_chunk_generated(global.chunk_gen_coords[i]) then
|
||||
--game.forces.player.chart(surface, {{(global.chunk_gen_coords[i].x * 32), (global.chunk_gen_coords[i].y * 32)}, {(global.chunk_gen_coords[i].x * 32) + 32, (global.chunk_gen_coords[i].y * 32) + 32}})
|
||||
global.chunk_gen_coords[i] = nil
|
||||
else
|
||||
--game.forces.player.chart(surface, {{(global.chunk_gen_coords[i].x * 32), (global.chunk_gen_coords[i].y * 32)}, {(global.chunk_gen_coords[i].x * 32) + 32, (global.chunk_gen_coords[i].y * 32) + 32}})
|
||||
surface.request_to_generate_chunks({x = (global.chunk_gen_coords[i].x * 32), y = (global.chunk_gen_coords[i].y * 32)}, 1)
|
||||
surface.force_generate_chunk_requests()
|
||||
global.chunk_gen_coords[i] = nil
|
||||
force_chunk_requests = force_chunk_requests - 1
|
||||
if force_chunk_requests <= 0 then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
draw_gui()
|
||||
end
|
||||
|
||||
return process_chunk
|
@ -281,11 +281,9 @@ local function plankton_territory(surface, position, seed)
|
||||
return true
|
||||
end
|
||||
|
||||
--if math.floor(noise_2 * 0.5) % 2 == 1 then
|
||||
surface.set_tiles({{name = "water", position = position}}, true)
|
||||
--else
|
||||
--surface.set_tiles({{name = "deepwater", position = position}}, true)
|
||||
--end
|
||||
surface.set_tiles({{name = "water", position = position}}, true)
|
||||
if math_random(1, 128) == 1 then surface.create_entity({name = "fish", position = position}) end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user