mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-06-28 14:16:18 +02:00
New commands //hollowdome and //dome, as well as new API functions worldedit.dome and worldedit.hollow_dome. Oh, and spheres generate faster too.
This commit is contained in:
@ -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>",
|
||||
|
Reference in New Issue
Block a user