1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-06 00:23:49 +02:00

Merge pull request #194 from NekoBaron/patch-4

Update surrounded_by_worms.lua
This commit is contained in:
MewMew 2020-08-18 02:03:04 +02:00 committed by GitHub
commit ce06b4f3d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,12 +20,16 @@ end
local function on_chunk_generated(event)
local surface = event.surface
local starting_distance = surface.map_gen_settings.starting_area * 200
if not global.worm_distance then
global.worm_distance = surface.map_gen_settings.starting_area * 200
end
--local starting_distance = surface.map_gen_settings.starting_area * 200
local left_top = event.area.left_top
local chunk_distance_to_center = math.sqrt(left_top.x ^ 2 + left_top.y ^ 2)
if starting_distance > chunk_distance_to_center then return end
if global.worm_distance > chunk_distance_to_center then return end
local highest_worm_tier = math.floor((chunk_distance_to_center - starting_distance) * 0.002) + 1
local highest_worm_tier = math.floor((chunk_distance_to_center - global.worm_distance) * 0.002) + 1
if highest_worm_tier > 4 then highest_worm_tier = 4 end
if not global.average_worm_amount_per_chunk then global.average_worm_amount_per_chunk = 1 end
@ -42,4 +46,4 @@ local function on_chunk_generated(event)
end
end
event.add(defines.events.on_chunk_generated, on_chunk_generated)
event.add(defines.events.on_chunk_generated, on_chunk_generated)