diff options
author | SmallJoker <mk939@ymail.com> | 2015-03-05 00:10:00 +1000 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2015-03-05 00:10:53 +1000 |
commit | bbed01ab62bf2433e103dd18c6c07ff3f503bc57 (patch) | |
tree | 4fec3ae562c1f8226242d2ac615b854b7f3ec0f5 | |
parent | 40bf1d7b5f2a190ae89885c9ea99f52c476ea6be (diff) | |
download | minetest-bbed01ab62bf2433e103dd18c6c07ff3f503bc57.tar.gz minetest-bbed01ab62bf2433e103dd18c6c07ff3f503bc57.tar.bz2 minetest-bbed01ab62bf2433e103dd18c6c07ff3f503bc57.zip |
Radius parameter for /deleteblocks here
-rw-r--r-- | builtin/game/chatcommands.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 46e2d03de..210117884 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -414,13 +414,14 @@ core.register_chatcommand("set", { }) core.register_chatcommand("deleteblocks", { - params = "[here] [<pos1> <pos2>]", + params = "(here [radius]) | (<pos1> <pos2>)", description = "delete map blocks contained in area pos1 to pos2", privs = {server=true}, func = function(name, param) local p1 = {} local p2 = {} - if param == "here" then + local args = param:split(" ") + if args[1] == "here" then local player = core.get_player_by_name(name) if player == nil then core.log("error", "player is nil") @@ -428,6 +429,12 @@ core.register_chatcommand("deleteblocks", { end p1 = player:getpos() p2 = p1 + + if #args >= 2 then + local radius = tonumber(args[2]) or 0 + p1 = vector.add(p1, radius) + p2 = vector.subtract(p2, radius) + end else local pos1, pos2 = unpack(param:split(") (")) if pos1 == nil or pos2 == nil then |