From 71b6004b928766abc3638aaca3526b80af642140 Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Sat, 27 Apr 2013 18:28:20 -0400 Subject: New commands //hollowdome and //dome, as well as new API functions worldedit.dome and worldedit.hollow_dome. Oh, and spheres generate faster too. --- worldedit_commands/init.lua | 52 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'worldedit_commands/init.lua') diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index da24747..fb01ce7 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -279,6 +279,58 @@ minetest.register_chatcommand("/sphere", { end, }) +minetest.register_chatcommand("/hollowdome", { + params = " ", + description = "Add hollow dome at WorldEdit position 1 with radius , 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", false) + return + end + + local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$") + if found == nil then + minetest.chat_send_player(name, "Invalid usage: " .. param, false) + return + end + if not worldedit.node_is_valid(nodename) then + minetest.chat_send_player(name, "Invalid node name: " .. param, false) + return + end + + local count = worldedit.hollow_dome(pos, tonumber(radius), nodename) + minetest.chat_send_player(name, count .. " nodes added", false) + end, +}) + +minetest.register_chatcommand("/dome", { + params = " ", + description = "Add dome at WorldEdit position 1 with radius , 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", false) + return + end + + local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$") + if found == nil then + minetest.chat_send_player(name, "Invalid usage: " .. param, false) + return + end + if not worldedit.node_is_valid(nodename) then + minetest.chat_send_player(name, "Invalid node name: " .. param, false) + return + end + + local count = worldedit.dome(pos, tonumber(radius), nodename) + minetest.chat_send_player(name, count .. " nodes added", false) + end, +}) + minetest.register_chatcommand("/hollowcylinder", { params = "x/y/z/? ", description = "Add hollow cylinder at WorldEdit position 1 along the x/y/z/? axis with length and radius , composed of ", -- cgit v1.2.3