diff options
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 46 |
1 files changed, 36 insertions, 10 deletions
@@ -271,6 +271,36 @@ minetest.register_chatcommand("/hollowcylinder", { end,
})
+minetest.register_chatcommand("/cylinder", {
+ params = "x/y/z/? <length> <radius> <node>",
+ description = "Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length <length> and 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")
+ return
+ end
+
+ local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+([^%s]+)$")
+ if found == nil then
+ minetest.chat_send_player(name, "Invalid usage: " .. param)
+ return
+ end
+ if axis == "?" then
+ axis, sign = worldedit.player_axis(name)
+ length = length * sign
+ end
+ if not worldedit.node_is_valid(pos, nodename) then
+ minetest.chat_send_player(name, "Invalid node name: " .. param)
+ return
+ end
+
+ local count = worldedit.cylinder(pos, axis, tonumber(length), tonumber(radius), nodename)
+ minetest.chat_send_player(name, count .. " nodes added")
+ end,
+})
+
minetest.register_chatcommand("/pyramid", {
params = "<height> <node>",
description = "Add pyramid at WorldEdit position 1 with height <height>, composed of <node>",
@@ -297,9 +327,9 @@ minetest.register_chatcommand("/pyramid", { end,
})
-minetest.register_chatcommand("/cylinder", {
- params = "x/y/z/? <length> <radius> <node>",
- description = "Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length <length> and radius <radius>, composed of <node>",
+minetest.register_chatcommand("/spiral", {
+ params = "<width> <height> <space> <node>",
+ description = "Add spiral at WorldEdit position 1 with width <width>, height <height>, space between walls <space>, composed of <node>",
privs = {worldedit=true},
func = function(name, param)
local pos = worldedit.pos1[name]
@@ -308,22 +338,18 @@ minetest.register_chatcommand("/cylinder", { return
end
- local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+([^%s]+)$")
+ local found, _, width, height, space, nodename = param:find("(%d+)%s+(%d+)%s+(%d+)%s+([^%s]+)$")
if found == nil then
minetest.chat_send_player(name, "Invalid usage: " .. param)
return
end
- if axis == "?" then
- axis, sign = worldedit.player_axis(name)
- length = length * sign
- end
if not worldedit.node_is_valid(pos, nodename) then
minetest.chat_send_player(name, "Invalid node name: " .. param)
return
end
- local count = worldedit.cylinder(pos, axis, tonumber(length), tonumber(radius), nodename)
- minetest.chat_send_player(name, count .. " nodes added")
+ local count = worldedit.spiral(pos, tonumber(width), tonumber(height), tonumber(space), nodename)
+ minetest.chat_send_player(name, count .. " nodes changed")
end,
})
|