1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00

minor fix

/clear-corpses now clears near the player.
This commit is contained in:
Gerkiz 2019-11-24 16:07:45 +01:00 committed by GitHub
parent 95bc3d473a
commit 15299c01b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -294,10 +294,11 @@ commands.add_command(
end
if param == nil then player.print("[ERROR] Must specify radius!", Color.fail) return end
if param > 500 then player.print("[ERROR] Value is too big.", Color.fail) return end
local pos = player.position
local radius = {{x = -param, y = -param}, {x = param, y = param}} or {{x = -1, y = -1}, {x = 1, y = 1}}
local radius = {{x = (pos.x + -param), y = (pos.y + -param)}, {x = (pos.x + param), y = (pos.y + param)}}
for _, entity in pairs(player.surface.find_entities_filtered{area = radius, type = "corpse"}) do
player.print("Cleared biter-corpses.", Color.success)
entity.destroy()
end
end)
player.print("Cleared biter-corpses.", Color.success)
end)