summaryrefslogtreecommitdiff
path: root/worldedit_commands
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2013-04-27 18:28:20 -0400
committerAnthony Zhang <azhang9@gmail.com>2013-04-27 18:28:20 -0400
commit71b6004b928766abc3638aaca3526b80af642140 (patch)
treedf61f94df1138ae60c836f30a3a98a52b8ee3cf5 /worldedit_commands
parent20722389bdc12359399ae2d1eab9b11f556fdb56 (diff)
New commands //hollowdome and //dome, as well as new API functions worldedit.dome and worldedit.hollow_dome. Oh, and spheres generate faster too.
Diffstat (limited to 'worldedit_commands')
-rw-r--r--worldedit_commands/init.lua52
1 files changed, 52 insertions, 0 deletions
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 = "<radius> <node>",
+ description = "Add hollow dome at WorldEdit position 1 with radius <radius>, composed of <node>",
+ 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 = "<radius> <node>",
+ description = "Add dome at WorldEdit position 1 with radius <radius>, composed of <node>",
+ 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/? <length> <radius> <node>",
description = "Add hollow cylinder at WorldEdit position 1 along the x/y/z/? axis with length <length> and radius <radius>, composed of <node>",