From 15299c01b2eaeb8e30b98be4794a7e2038e079a7 Mon Sep 17 00:00:00 2001 From: Gerkiz <39602942+Gerkiz@users.noreply.github.com> Date: Sun, 24 Nov 2019 16:07:45 +0100 Subject: [PATCH] minor fix /clear-corpses now clears near the player. --- commands/misc.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/misc.lua b/commands/misc.lua index c0c97f80..c79471cd 100644 --- a/commands/misc.lua +++ b/commands/misc.lua @@ -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) \ No newline at end of file + player.print("Cleared biter-corpses.", Color.success) +end)