mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-29 21:47:08 +02:00
update
resource frequency and amount increased; mirroring performance tweaks; spawn wall radius is increased and has more turrets, but is more run down;
This commit is contained in:
parent
ac249f49df
commit
034645c15c
@ -15,13 +15,13 @@ local function init_surface()
|
|||||||
map_gen_settings.terrain_segmentation = math.random(30, 40) * 0.1
|
map_gen_settings.terrain_segmentation = math.random(30, 40) * 0.1
|
||||||
map_gen_settings.cliff_settings = {cliff_elevation_interval = math.random(16, 48), cliff_elevation_0 = math.random(16, 48)}
|
map_gen_settings.cliff_settings = {cliff_elevation_interval = math.random(16, 48), cliff_elevation_0 = math.random(16, 48)}
|
||||||
map_gen_settings.autoplace_controls = {
|
map_gen_settings.autoplace_controls = {
|
||||||
["coal"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
|
["coal"] = {frequency = 2.25, size = 1, richness = 1},
|
||||||
["stone"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
|
["stone"] = {frequency = 2.25, size = 1, richness = 1},
|
||||||
["copper-ore"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
|
["copper-ore"] = {frequency = 3.5, size = 1.25, richness = 1},
|
||||||
["iron-ore"] = {frequency = math.random(10, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
|
["iron-ore"] = {frequency = 3.5, size = 1.25, richness = 1},
|
||||||
["uranium-ore"] = {frequency = math.random(10, 20) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(5, 15) * 0.1},
|
["uranium-ore"] = {frequency = 2, size = 1, richness = 1},
|
||||||
["crude-oil"] = {frequency = math.random(15, 30) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(10, 20) * 0.1},
|
["crude-oil"] = {frequency = 4, size = 2, richness = 0.75},
|
||||||
["trees"] = {frequency = math.random(5, 25) * 0.1, size = math.random(5, 15) * 0.1, richness = math.random(3, 10) * 0.1},
|
["trees"] = {frequency = math.random(8, 16) * 0.1, size = math.random(6, 12) * 0.1, richness = math.random(2, 10) * 0.1},
|
||||||
["enemy-base"] = {frequency = 256, size = 0.61, richness = 1}
|
["enemy-base"] = {frequency = 256, size = 0.61, richness = 1}
|
||||||
}
|
}
|
||||||
game.create_surface("biter_battles", map_gen_settings)
|
game.create_surface("biter_battles", map_gen_settings)
|
||||||
|
@ -35,73 +35,68 @@ local cliff_orientation_translation = {
|
|||||||
["none-to-west"] = "none-to-east"
|
["none-to-west"] = "none-to-east"
|
||||||
}
|
}
|
||||||
|
|
||||||
local valid_types = {
|
local entity_copy_functions = {
|
||||||
["tree"] = true,
|
["tree"] = function(surface, entity, mirror_position)
|
||||||
["simple-entity"] = true,
|
if not surface.can_place_entity({name = entity.name, position = mirror_position}) then return end
|
||||||
["cliff"] = true,
|
entity.clone({position = mirror_position, surface = surface, force = "neutral"})
|
||||||
["resource"] = true,
|
end,
|
||||||
["unit-spawner"] = true,
|
["simple-entity"] = function(surface, entity, mirror_position)
|
||||||
["turret"] = true,
|
local mirror_entity = {name = entity.name, position = mirror_position, direction = direction_translation[entity.direction]}
|
||||||
["rocket-silo"] = true,
|
if not surface.can_place_entity(mirror_entity) then return end
|
||||||
["character"] = true,
|
local mirror_entity = surface.create_entity(mirror_entity)
|
||||||
["ammo-turret"] = true,
|
mirror_entity.graphics_variation = entity.graphics_variation
|
||||||
["wall"] = true,
|
end,
|
||||||
["fish"] = true,
|
["cliff"] = function(surface, entity, mirror_position)
|
||||||
|
local mirror_entity = {name = entity.name, position = mirror_position, cliff_orientation = cliff_orientation_translation[entity.cliff_orientation]}
|
||||||
|
if not surface.can_place_entity(mirror_entity) then return end
|
||||||
|
surface.create_entity(mirror_entity)
|
||||||
|
return
|
||||||
|
end,
|
||||||
|
["resource"] = function(surface, entity, mirror_position)
|
||||||
|
surface.create_entity({name = entity.name, position = mirror_position, amount = entity.amount})
|
||||||
|
end,
|
||||||
|
["corpse"] = function(surface, entity, mirror_position)
|
||||||
|
surface.create_entity({name = entity.name, position = mirror_position})
|
||||||
|
end,
|
||||||
|
["unit-spawner"] = function(surface, entity, mirror_position)
|
||||||
|
local mirror_entity = {name = entity.name, position = mirror_position, direction = direction_translation[entity.direction], force = "south_biters"}
|
||||||
|
if not surface.can_place_entity(mirror_entity) then return end
|
||||||
|
surface.create_entity(mirror_entity)
|
||||||
|
end,
|
||||||
|
["turret"] = function(surface, entity, mirror_position)
|
||||||
|
local mirror_entity = {name = entity.name, position = mirror_position, direction = direction_translation[entity.direction], force = "south_biters"}
|
||||||
|
if not surface.can_place_entity(mirror_entity) then return end
|
||||||
|
surface.create_entity(mirror_entity)
|
||||||
|
end,
|
||||||
|
["rocket-silo"] = function(surface, entity, mirror_position)
|
||||||
|
if surface.count_entities_filtered({name = "rocket-silo", area = {{mirror_position.x - 8, mirror_position.y - 8},{mirror_position.x + 8, mirror_position.y + 8}}}) > 0 then return end
|
||||||
|
global.rocket_silo["south"] = surface.create_entity({name = entity.name, position = mirror_position, direction = direction_translation[entity.direction], force = "south"})
|
||||||
|
global.rocket_silo["south"].minable = false
|
||||||
|
end,
|
||||||
|
["ammo-turret"] = function(surface, entity, mirror_position)
|
||||||
|
if not surface.can_place_entity({name = entity.name, position = mirror_position, force = "south"}) then return end
|
||||||
|
entity.clone({position = mirror_position, surface = surface, force="south"})
|
||||||
|
end,
|
||||||
|
["wall"] = function(surface, entity, mirror_position)
|
||||||
|
--if not surface.can_place_entity({name = entity.name, position = mirror_position, force = "south"}) then return end
|
||||||
|
entity.clone({position = mirror_position, surface = surface, force="south"})
|
||||||
|
end,
|
||||||
|
["container"] = function(surface, entity, mirror_position)
|
||||||
|
--if not surface.can_place_entity({name = entity.name, position = mirror_position, force = "south"}) then return end
|
||||||
|
entity.clone({position = mirror_position, surface = surface, force="south"})
|
||||||
|
end,
|
||||||
|
["fish"] = function(surface, entity, mirror_position)
|
||||||
|
local mirror_entity = {name = entity.name, position = mirror_position, direction = direction_translation[entity.direction]}
|
||||||
|
if not surface.can_place_entity(mirror_entity) then return end
|
||||||
|
local e = surface.create_entity(mirror_entity)
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function process_entity(surface, entity)
|
local function process_entity(surface, entity)
|
||||||
if not entity.valid then return end
|
if not entity.valid then return end
|
||||||
if not valid_types[entity.type] then return end
|
if not entity_copy_functions[entity.type] then return end
|
||||||
local new_pos = {x = entity.position.x * -1, y = entity.position.y * -1}
|
local mirror_position = {x = entity.position.x * -1, y = entity.position.y * -1}
|
||||||
if entity.type == "tree" then
|
entity_copy_functions[entity.type](surface, entity, mirror_position)
|
||||||
if not surface.can_place_entity({name = entity.name, position = new_pos}) then return end
|
|
||||||
entity.clone({position=new_pos, surface=surface, force="neutral"})
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if entity.type == "simple-entity" then
|
|
||||||
local new_e = {name = entity.name, position = new_pos, direction = direction_translation[entity.direction]}
|
|
||||||
if not surface.can_place_entity(new_e) then return end
|
|
||||||
local e = surface.create_entity(new_e)
|
|
||||||
e.graphics_variation = entity.graphics_variation
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if entity.type == "cliff" then
|
|
||||||
local new_e = {name = entity.name, position = new_pos, cliff_orientation = cliff_orientation_translation[entity.cliff_orientation]}
|
|
||||||
if not surface.can_place_entity(new_e) then return end
|
|
||||||
surface.create_entity(new_e)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if entity.type == "resource" then
|
|
||||||
surface.create_entity({name = entity.name, position = new_pos, amount = entity.amount})
|
|
||||||
return
|
|
||||||
end
|
|
||||||
--if entity.type == "unit-spawner" or entity.type == "unit" or entity.type == "turret" then
|
|
||||||
if entity.type == "unit-spawner" or entity.type == "turret" then
|
|
||||||
local new_e = {name = entity.name, position = new_pos, direction = direction_translation[entity.direction], force = "south_biters"}
|
|
||||||
if not surface.can_place_entity(new_e) then return end
|
|
||||||
surface.create_entity(new_e)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if entity.name == "rocket-silo" then
|
|
||||||
if surface.count_entities_filtered({name = "rocket-silo", area = {{new_pos.x - 8, new_pos.y - 8},{new_pos.x + 8, new_pos.y + 8}}}) > 0 then return end
|
|
||||||
global.rocket_silo["south"] = surface.create_entity({name = entity.name, position = new_pos, direction = direction_translation[entity.direction], force = "south"})
|
|
||||||
global.rocket_silo["south"].minable = false
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if entity.name == "gun-turret" or entity.name == "stone-wall" then
|
|
||||||
if not surface.can_place_entity({name = entity.name, position = new_pos, force = "south"}) then return end
|
|
||||||
entity.clone({position=new_pos, surface=surface, force="south"})
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if entity.name == "character" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if entity.name == "fish" then
|
|
||||||
local new_e = {name = entity.name, position = new_pos, direction = direction_translation[entity.direction]}
|
|
||||||
if not surface.can_place_entity(new_e) then return end
|
|
||||||
local e = surface.create_entity(new_e)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function clear_chunk(surface, area)
|
local function clear_chunk(surface, area)
|
||||||
|
@ -94,16 +94,14 @@ local function draw_noise_ore_patch(position, name, surface, radius, richness)
|
|||||||
if not surface then return end
|
if not surface then return end
|
||||||
if not radius then return end
|
if not radius then return end
|
||||||
if not richness then return end
|
if not richness then return end
|
||||||
local math_random = math.random
|
local seed = game.surfaces[1].map_gen_settings.seed
|
||||||
local noise_seed_add = 25000
|
local noise_seed_add = 25000
|
||||||
local richness_part = richness / radius
|
local richness_part = richness / radius
|
||||||
for y = radius * -3, radius * 3, 1 do
|
for y = radius * -3, radius * 3, 1 do
|
||||||
for x = radius * -3, radius * 3, 1 do
|
for x = radius * -3, radius * 3, 1 do
|
||||||
local pos = {x = x + position.x, y = y + position.y}
|
local pos = {x = x + position.x + 0.5, y = y + position.y + 0.5}
|
||||||
local seed = game.surfaces[1].map_gen_settings.seed
|
|
||||||
local noise_1 = simplex_noise(pos.x * 0.0125, pos.y * 0.0125, seed)
|
local noise_1 = simplex_noise(pos.x * 0.0125, pos.y * 0.0125, seed)
|
||||||
seed = seed + noise_seed_add
|
local noise_2 = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed + 25000)
|
||||||
local noise_2 = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed)
|
|
||||||
local noise = noise_1 + noise_2 * 0.12
|
local noise = noise_1 + noise_2 * 0.12
|
||||||
local distance_to_center = math.sqrt(x^2 + y^2)
|
local distance_to_center = math.sqrt(x^2 + y^2)
|
||||||
local a = richness - richness_part * distance_to_center
|
local a = richness - richness_part * distance_to_center
|
||||||
@ -113,6 +111,13 @@ local function draw_noise_ore_patch(position, name, surface, radius, richness)
|
|||||||
|
|
||||||
local mirror_pos = {x = pos.x * -1, y = pos.y * -1}
|
local mirror_pos = {x = pos.x * -1, y = pos.y * -1}
|
||||||
surface.create_entity{name = name, position = mirror_pos, amount = a}
|
surface.create_entity{name = name, position = mirror_pos, amount = a}
|
||||||
|
|
||||||
|
for _, e in pairs(surface.find_entities_filtered({position = pos, name = {"wooden-chest", "stone-wall", "gun-turret"}})) do
|
||||||
|
e.destroy()
|
||||||
|
end
|
||||||
|
for _, e in pairs(surface.find_entities_filtered({position = mirror_pos, name = {"wooden-chest", "stone-wall", "gun-turret"}})) do
|
||||||
|
e.destroy()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -148,7 +153,7 @@ local function generate_circle_spawn(event)
|
|||||||
if left_top_x > 320 then return end
|
if left_top_x > 320 then return end
|
||||||
if left_top_y < -320 then return end
|
if left_top_y < -320 then return end
|
||||||
|
|
||||||
local r = 101
|
local r = 120
|
||||||
for x = 0, 31, 1 do
|
for x = 0, 31, 1 do
|
||||||
for y = 0, 31, 1 do
|
for y = 0, 31, 1 do
|
||||||
local pos = {x = left_top_x + x, y = left_top_y + y}
|
local pos = {x = left_top_x + x, y = left_top_y + y}
|
||||||
@ -167,47 +172,46 @@ local function generate_circle_spawn(event)
|
|||||||
local tile_name = surface.get_tile(pos).name
|
local tile_name = surface.get_tile(pos).name
|
||||||
if tile_name == "water" or tile_name == "deepwater" then
|
if tile_name == "water" or tile_name == "deepwater" then
|
||||||
surface.set_tiles({{name = get_replacement_tile(surface, pos), position = pos}}, true)
|
surface.set_tiles({{name = get_replacement_tile(surface, pos), position = pos}}, true)
|
||||||
--surface.set_tiles({{name = "stone-path", position = pos}}, true)
|
|
||||||
--if math_random(1,256) == 1 then
|
|
||||||
-- local wrecks = {"big-ship-wreck-1", "big-ship-wreck-2", "big-ship-wreck-3"}
|
|
||||||
-- surface.create_entity({name = wrecks[math_random(1, #wrecks)], position = pos, force = "north"})
|
|
||||||
--end
|
|
||||||
--if bb_config.random_scrap and math_random(1,64) == 1 then
|
|
||||||
-- surface.create_entity({name = "mineable-wreckage", position = pos})
|
|
||||||
--end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if tile then surface.set_tiles({{name = tile, position = pos}}, true) end
|
if tile then surface.set_tiles({{name = tile, position = pos}}, true) end
|
||||||
|
|
||||||
if surface.can_place_entity({name = "coal", position = pos}) then
|
if surface.can_place_entity({name = "wooden-chest", position = pos}) and surface.can_place_entity({name = "coal", position = pos}) then
|
||||||
|
local noise_2 = get_noise(3, pos)
|
||||||
if distance_to_center + noise < r and distance_to_center + noise > r - 1.75 then
|
if math.abs(noise_2) > 0.20 then
|
||||||
surface.create_entity({name = "stone-wall", position = pos, force = "north"})
|
local spawn_wall_r = distance_to_center + noise
|
||||||
end
|
if noise_2 > -0.5 then
|
||||||
|
if spawn_wall_r < r and spawn_wall_r > r - 1.55 then
|
||||||
if distance_to_center + noise < r - 4 and distance_to_center + noise > r - 6 then
|
surface.create_entity({name = "stone-wall", position = pos, force = "north"})
|
||||||
if math_random(1,56) == 1 then
|
end
|
||||||
if surface.can_place_entity({name = "gun-turret", position = pos}) then
|
else
|
||||||
local t = surface.create_entity({name = "gun-turret", position = pos, force = "north"})
|
if spawn_wall_r < r and spawn_wall_r > r - 1.75 then
|
||||||
t.insert({name = "firearm-magazine", count = math_random(6,12)})
|
surface.create_entity({name = "stone-wall", position = pos, force = "north"})
|
||||||
|
else
|
||||||
|
if spawn_wall_r < r + 5.5 and spawn_wall_r > r then
|
||||||
|
local name = "wooden-chest"
|
||||||
|
local r_max = math.floor(math.abs(spawn_wall_r - r)) + 2
|
||||||
|
if math_random(1,3) == 1 then name = name .. "-remnants" end
|
||||||
|
if math_random(1,r_max) == 1 then surface.create_entity({name = name, position = pos, force = "north"}) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if spawn_wall_r < r - 3 and spawn_wall_r > r - 6 then
|
||||||
|
if math_random(1, 16) == 1 then
|
||||||
|
if surface.can_place_entity({name = "gun-turret", position = pos}) then
|
||||||
|
local t = surface.create_entity({name = "gun-turret", position = pos, force = "north"})
|
||||||
|
t.insert({name = "firearm-magazine", count = math_random(6,12)})
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if math_random(1, 16) == 1 then
|
||||||
|
if surface.can_place_entity({name = "gun-turret", position = pos}) then
|
||||||
|
surface.create_entity({name = "gun-turret-remnants", position = pos, force = "north"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--if distance_to_center + noise < r - 3 and distance_to_center + noise > r - 7 then
|
|
||||||
--if math_random(1,3) ~= 1 then
|
|
||||||
--surface.set_tiles({{name = "stone-path", position = pos}}, true)
|
|
||||||
--end
|
|
||||||
--end
|
|
||||||
|
|
||||||
--if distance_to_center + noise < r - 3 and distance_to_center + noise > r - 20 then
|
|
||||||
--if math_random(1, 256) == 1 then
|
|
||||||
--if surface.can_place_entity({name = "mineable-wreckage", position = pos}) then
|
|
||||||
--surface.create_entity({name = "mineable-wreckage", position = pos, force = "neutral"})
|
|
||||||
--end
|
|
||||||
--end
|
|
||||||
--end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user