You've already forked ComfyFactorio
mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2026-06-20 16:32:28 +02:00
optimizations
This commit is contained in:
@@ -61,7 +61,8 @@ end
|
||||
local function set_player_spawn_and_refill_fish()
|
||||
if not global.locomotive_cargo then return end
|
||||
if not global.locomotive_cargo.valid then return end
|
||||
global.locomotive_cargo.get_inventory(defines.inventory.cargo_wagon).insert({name = "raw-fish", count = 4})
|
||||
global.locomotive_cargo.health = global.locomotive_cargo.health + 6
|
||||
global.locomotive_cargo.get_inventory(defines.inventory.cargo_wagon).insert({name = "raw-fish", count = math.random(2, 5)})
|
||||
local position = global.locomotive_cargo.surface.find_non_colliding_position("stone-furnace", global.locomotive_cargo.position, 16, 2)
|
||||
if not position then return end
|
||||
game.forces.player.set_spawn_position({x = position.x, y = position.y}, global.locomotive_cargo.surface)
|
||||
|
||||
@@ -79,7 +79,7 @@ function Public.reset_map()
|
||||
game.map_settings.enemy_expansion.min_expansion_cooldown = 3600
|
||||
game.map_settings.enemy_expansion.settler_group_max_size = 8
|
||||
game.map_settings.enemy_expansion.settler_group_min_size = 16
|
||||
game.map_settings.pollution.enabled = true
|
||||
game.map_settings.pollution.enabled = false
|
||||
|
||||
game.forces.player.technologies["landfill"].enabled = false
|
||||
game.forces.player.technologies["railway"].researched = true
|
||||
@@ -316,7 +316,7 @@ local function on_init()
|
||||
"The biters have catched the scent of fish in the cargo wagon.\n",
|
||||
"Guide the choo into the mountain and protect it as long as possible!\n",
|
||||
"This however will not be an easy task,\n",
|
||||
"since their strength and resistance increases constantly over time.\n",
|
||||
"since their strength and numbers increase over time.\n",
|
||||
"\n",
|
||||
"Delve deep for greater treasures, but also face increased dangers.\n",
|
||||
"Mining productivity research, will overhaul your mining equipment,\n",
|
||||
|
||||
@@ -11,7 +11,7 @@ local rock_mining_chance_weights = {
|
||||
{"iron-ore", 25},
|
||||
{"copper-ore",17},
|
||||
{"coal",13},
|
||||
{"stone",9},
|
||||
{"stone",10},
|
||||
{"uranium-ore",2}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,9 +88,9 @@ local function set_group_spawn_position(surface)
|
||||
local wave_defense_table = WD.get_table()
|
||||
local spawner = get_random_close_spawner(surface)
|
||||
if not spawner then return end
|
||||
local position = surface.find_non_colliding_position("rocket-silo", spawner.position, 48, 1)
|
||||
local position = surface.find_non_colliding_position("rocket-silo", spawner.position, 64, 1)
|
||||
if not position then return end
|
||||
wave_defense_table.spawn_position = {x = math.floor(position.x), y = math.floor(position.y)}
|
||||
wave_defense_table.spawn_position = {x = position.x, y = position.y}
|
||||
debug_print("set_group_spawn_position -- Changed position to x" .. wave_defense_table.spawn_position.x .. " y" .. wave_defense_table.spawn_position.y .. ".")
|
||||
end
|
||||
|
||||
@@ -169,9 +169,9 @@ local function spawn_biter(surface)
|
||||
else
|
||||
name = BiterRolls.wave_defense_roll_biter_name()
|
||||
end
|
||||
local position = surface.find_non_colliding_position(name, wave_defense_table.spawn_position, 48, 2)
|
||||
if not position then return false end
|
||||
local biter = surface.create_entity({name = name, position = position, force = "enemy"})
|
||||
--local position = surface.find_non_colliding_position(name, wave_defense_table.spawn_position, 48, 2)
|
||||
--if not position then return false end
|
||||
local biter = surface.create_entity({name = name, position = wave_defense_table.spawn_position, force = "enemy"})
|
||||
biter.ai_settings.allow_destroy_when_commands_fail = false
|
||||
biter.ai_settings.allow_try_return_to_spawner = false
|
||||
wave_defense_table.active_biters[biter.unit_number] = {entity = biter, spawn_tick = game.tick}
|
||||
|
||||
@@ -15,16 +15,24 @@ local side_target_types = {
|
||||
}
|
||||
|
||||
local function get_random_target(wave_defense_table)
|
||||
local r = math.random(1, #wave_defense_table.side_targets)
|
||||
if not wave_defense_table.side_targets[r] then table.remove(wave_defense_table.side_targets, r) return end
|
||||
if not wave_defense_table.side_targets[r].valid then table.remove(wave_defense_table.side_targets, r) return end
|
||||
return wave_defense_table.side_targets[r]
|
||||
local r = math.random(1, wave_defense_table.side_target_count)
|
||||
if not wave_defense_table.side_targets[r] then
|
||||
table.remove(wave_defense_table.side_targets, r)
|
||||
wave_defense_table.side_target_count = wave_defense_table.side_target_count - 1
|
||||
return
|
||||
end
|
||||
if not wave_defense_table.side_targets[r].valid then
|
||||
table.remove(wave_defense_table.side_targets, r)
|
||||
wave_defense_table.side_target_count = wave_defense_table.side_target_count - 1
|
||||
return
|
||||
end
|
||||
return wave_defense_table.side_targets[r]
|
||||
end
|
||||
|
||||
function Public.get_side_target()
|
||||
local wave_defense_table = WD.get_table()
|
||||
for _ = 1, 1024, 1 do
|
||||
if #wave_defense_table.side_targets == 0 then return false end
|
||||
local wave_defense_table = WD.get_table()
|
||||
for _ = 1, 512, 1 do
|
||||
if wave_defense_table.side_target_count == 0 then return end
|
||||
local target = get_random_target(wave_defense_table)
|
||||
if target then return target end
|
||||
end
|
||||
@@ -33,6 +41,7 @@ end
|
||||
local function add_entity(entity)
|
||||
local wave_defense_table = WD.get_table()
|
||||
table.insert(wave_defense_table.side_targets, entity)
|
||||
wave_defense_table.side_target_count = wave_defense_table.side_target_count + 1
|
||||
end
|
||||
|
||||
local function on_built_entity(event)
|
||||
|
||||
@@ -28,6 +28,7 @@ function Public.reset_wave_defense()
|
||||
wave_defense.nest_building_density = 48
|
||||
wave_defense.next_wave = game.tick + 3600 * 15
|
||||
wave_defense.side_targets = {}
|
||||
wave_defense.side_target_count = 0
|
||||
wave_defense.simple_entity_shredding_cost_modifier = 0.005
|
||||
wave_defense.spawn_position = {x = 0, y = 64}
|
||||
wave_defense.spitter_raffle = {}
|
||||
|
||||
Reference in New Issue
Block a user