mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-05-13 21:56:29 +02:00
option to add random scrap loot
This commit is contained in:
parent
09c7b1417e
commit
19ad0b6725
@ -10,7 +10,13 @@ local threat_values = {
|
||||
["big-spitter"] = 8,
|
||||
["big-biter"] = 8,
|
||||
["behemoth-spitter"] = 24,
|
||||
["behemoth-biter"] = 24
|
||||
["behemoth-biter"] = 24,
|
||||
["small-worm-turret"] = 8,
|
||||
["medium-worm-turret"] = 12,
|
||||
["big-worm-turret"] = 16,
|
||||
["behemoth-worm-turret"] = 16,
|
||||
["biter-spawner"] = 16,
|
||||
["spitter-spawner"] = 16
|
||||
}
|
||||
|
||||
local function get_active_biter_count(biter_force_name)
|
||||
@ -199,9 +205,11 @@ end
|
||||
--Biter Threat Value Substraction
|
||||
local function on_entity_died(event)
|
||||
if not event.entity.valid then return end
|
||||
if event.entity.type ~= "unit" then return end
|
||||
if not threat_values[event.entity.name] then return end
|
||||
if event.entity.type == "unit" then
|
||||
global.active_biters[event.entity.force.name][event.entity.unit_number] = nil
|
||||
end
|
||||
global.bb_threat[event.entity.force.name] = global.bb_threat[event.entity.force.name] - threat_values[event.entity.name]
|
||||
global.active_biters[event.entity.force.name][event.entity.unit_number] = nil
|
||||
end
|
||||
|
||||
--Flamethrower Turret Nerf
|
||||
|
@ -4,6 +4,7 @@ require "on_tick_schedule"
|
||||
require "maps.biter_battles_v2.config"
|
||||
require "modules.dynamic_landfill"
|
||||
require "modules.spawners_contain_biters"
|
||||
require "modules.mineable_wreckage_yields_scrap"
|
||||
|
||||
require "modules.surrounded_by_worms"
|
||||
global.average_worm_amount_per_chunk = 1
|
||||
@ -23,8 +24,8 @@ local function init_surface()
|
||||
["iron-ore"] = {frequency = "3", size = "1.2", richness = "1"},
|
||||
["uranium-ore"] = {frequency = "2", size = "1", richness = "1"},
|
||||
["crude-oil"] = {frequency = "3", size = "1.2", richness = "1.5"},
|
||||
["trees"] = {frequency = "1.25", size = "0.5", richness = "0.65"},
|
||||
["enemy-base"] = {frequency = "6", size = "1.5", richness = "1.5"}
|
||||
["trees"] = {frequency = "1.25", size = "0.6", richness = "0.5"},
|
||||
["enemy-base"] = {frequency = "5.5", size = "1.5", richness = "1.5"}
|
||||
}
|
||||
game.create_surface("biter_battles", map_gen_settings)
|
||||
|
||||
|
@ -6,7 +6,7 @@ bb_config = {
|
||||
["blueprint_string_importing"] = false, --Allow the importing of blueprints via blueprint strings?
|
||||
|
||||
--MAP PREGENERATION
|
||||
["map_pregeneration_radius"] = 33, --Radius in chunks to pregenerate at the start of the map.
|
||||
["map_pregeneration_radius"] = 32, --Radius in chunks to pregenerate at the start of the map.
|
||||
["fast_pregen"] = false, --Force fast pregeneration.
|
||||
|
||||
--TEAM SETTINGS
|
||||
@ -17,6 +17,7 @@ bb_config = {
|
||||
--TERRAIN OPTIONS
|
||||
["border_river_width"] = 32, --Approximate width of the horizontal impassable river seperating the teams. (values up to 100)
|
||||
["builders_area"] = true, --Grant each side a peaceful direction with no nests and biters?
|
||||
["random_scrap"] = true, --Generate harvestable scrap around worms randomly?
|
||||
|
||||
--BITER SETTINGS
|
||||
["max_active_biters"] = 1250, --Maximum total amount of attacking units per side.
|
||||
|
@ -48,7 +48,7 @@ local function annihilate_base_v2(center_pos, surface, force_name)
|
||||
for y = -80, 80, 1 do
|
||||
local pos = {x = center_pos.x + x, y = center_pos.y + y}
|
||||
local distance_to_center = math.ceil(math.sqrt((pos.x - center_pos.x)^2 + (pos.y - center_pos.y)^2))
|
||||
if distance_to_center < 52 and math.random(1,5) == 1 then
|
||||
if distance_to_center < 52 and math.random(1,7) == 1 then
|
||||
if not positions[distance_to_center] then positions[distance_to_center] = {} end
|
||||
positions[distance_to_center][#positions[distance_to_center] + 1] = pos
|
||||
end
|
||||
|
@ -227,10 +227,8 @@ local function on_chunk_generated(event)
|
||||
local surface = event.surface
|
||||
if surface.name ~= "biter_battles" then return end
|
||||
|
||||
for _, e in pairs(surface.find_entities_filtered({area = event.area, force = "enemy"})) do
|
||||
--if e.type == "unit-spawner" then
|
||||
surface.create_entity({name = e.name, position = e.position, force = "north_biters", direction = e.direction})
|
||||
--end
|
||||
for _, e in pairs(surface.find_entities_filtered({area = event.area, force = "enemy"})) do
|
||||
surface.create_entity({name = e.name, position = e.position, force = "north_biters", direction = e.direction})
|
||||
e.destroy()
|
||||
end
|
||||
|
||||
@ -248,6 +246,17 @@ local function on_chunk_generated(event)
|
||||
end
|
||||
end
|
||||
|
||||
if bb_config.random_scrap then
|
||||
local distance_to_center = math.sqrt(event.area.left_top.x ^ 2 + event.area.left_top.y ^ 2)
|
||||
local scrap_amount = math.ceil(distance_to_center / 32) - 8
|
||||
for _, e in pairs(surface.find_entities_filtered({area = event.area, type = "tree"})) do
|
||||
scrap_amount = scrap_amount - 1
|
||||
if scrap_amount < 0 then break end
|
||||
e.surface.create_entity({name = "mineable-wreckage", position = e.position, force = "neutral"})
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
if event.area.left_top.y == -320 and event.area.left_top.x == -320 then
|
||||
local area = {{-10,-10},{10,10}}
|
||||
for _, e in pairs(surface.find_entities_filtered({area = area})) do
|
||||
|
Loading…
x
Reference in New Issue
Block a user