mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-04-15 11:36:41 +02:00
Performance improvement for killing towns + spare chests
This commit is contained in:
parent
5c3a7bb1be
commit
f9d950a33c
@ -42,6 +42,11 @@ local destroy_robot_types = {
|
|||||||
['logistic-robot'] = true
|
['logistic-robot'] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local storage_types = {
|
||||||
|
['container'] = true,
|
||||||
|
['logistic-container'] = true,
|
||||||
|
['storage-tank'] = true
|
||||||
|
}
|
||||||
-- hand craftable
|
-- hand craftable
|
||||||
local player_force_disabled_recipes = {
|
local player_force_disabled_recipes = {
|
||||||
'lab',
|
'lab',
|
||||||
@ -794,31 +799,27 @@ local function kill_force(force_name, cause)
|
|||||||
if destroy_military_types[e.type] == true then
|
if destroy_military_types[e.type] == true then
|
||||||
surface.create_entity({name = 'big-artillery-explosion', position = position})
|
surface.create_entity({name = 'big-artillery-explosion', position = position})
|
||||||
e.die()
|
e.die()
|
||||||
|
elseif destroy_robot_types[e.type] == true then
|
||||||
|
surface.create_entity({name = 'explosion', position = position})
|
||||||
|
e.die()
|
||||||
|
elseif destroy_wall_types[e.type] == true then
|
||||||
|
e.die()
|
||||||
|
elseif storage_types[e.type] == true then
|
||||||
|
-- spare chests
|
||||||
else
|
else
|
||||||
if destroy_robot_types[e.type] == true then
|
game.print(e.type)
|
||||||
surface.create_entity({name = 'explosion', position = position})
|
local damage = math_random() * 2.5 - 0.5
|
||||||
e.die()
|
if damage > 0 then
|
||||||
else
|
if damage >= 1 or e.health == nil then
|
||||||
if destroy_wall_types[e.type] == true then
|
|
||||||
e.die()
|
e.die()
|
||||||
|
else
|
||||||
|
local health = e.health
|
||||||
|
e.health = health * damage
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for _, e in pairs(surface.find_entities_filtered({force = force_name})) do
|
|
||||||
if e.valid then
|
|
||||||
local damage = math_random() * 2.5 - 0.5
|
|
||||||
if damage > 0 then
|
|
||||||
if damage >= 1 or e.health == nil then
|
|
||||||
e.die()
|
|
||||||
else
|
|
||||||
local health = e.health
|
|
||||||
e.health = health * damage
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local r = 27
|
local r = 27
|
||||||
for _, e in pairs(surface.find_entities_filtered({area = {{position.x - r, position.y - r}, {position.x + r, position.y + r}}, force = 'neutral', type = 'resource'})) do
|
for _, e in pairs(surface.find_entities_filtered({area = {{position.x - r, position.y - r}, {position.x + r, position.y + r}}, force = 'neutral', type = 'resource'})) do
|
||||||
if e.name ~= 'crude-oil' then
|
if e.name ~= 'crude-oil' then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user