From e39493e789d77f98af4cdc17de21ca1ef0547571 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 19 Aug 2012 09:36:11 +0200 Subject: Add //spiral and worldedit.spiral API function --- init.lua | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 10d03b8..cef7e53 100644 --- a/init.lua +++ b/init.lua @@ -216,6 +216,36 @@ minetest.register_chatcommand("/hollowcylinder", { end, }) + +minetest.register_chatcommand("/spiral", { + params = " ", + description = "Add Spiral at WorldEdit position 1 with size , composed of ", + privs = {worldedit=true}, + func = function(name, param) + local pos = worldedit.pos1[name] + if pos == nil then + minetest.chat_send_player(name, "No WorldEdit region selected") + return + end + + local found, _, size, nodename = param:find("(%d+)%s+([^%s]+)$") + if found == nil then + minetest.chat_send_player(name, "Invalid usage: " .. param) + return + end + if axis == "?" then + axis = worldedit.player_axis(name) + end + if not worldedit.node_is_valid(pos, nodename) then + minetest.chat_send_player(name, "Invalid node name: " .. param) + return + end + + local count = worldedit.spiral(pos, tonumber(size), nodename) + minetest.chat_send_player(name, count .. " nodes changed") + end, +}) + minetest.register_chatcommand("/cylinder", { params = "x/y/z/? ", description = "Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length and radius , composed of ", @@ -486,4 +516,4 @@ minetest.register_chatcommand("/load", { minetest.chat_send_player(name, count .. " nodes loaded") end, -}) \ No newline at end of file +}) -- cgit v1.2.3