mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-26 10:40:40 +01:00
Make chat messages consistent.
This commit is contained in:
parent
d52f3d649e
commit
52c1379bce
@ -7,6 +7,10 @@ worldedit.pos2 = {}
|
|||||||
|
|
||||||
dofile(minetest.get_modpath("worldedit_commands") .. "/mark.lua")
|
dofile(minetest.get_modpath("worldedit_commands") .. "/mark.lua")
|
||||||
|
|
||||||
|
worldedit.player_notify = function(name, message)
|
||||||
|
minetest.chat_send_player(name, "WorldEdit -!- " .. message, false)
|
||||||
|
end
|
||||||
|
|
||||||
--determines whether `nodename` is a valid node name, returning a boolean
|
--determines whether `nodename` is a valid node name, returning a boolean
|
||||||
worldedit.node_is_valid = function(nodename)
|
worldedit.node_is_valid = function(nodename)
|
||||||
return minetest.registered_nodes[nodename] ~= nil
|
return minetest.registered_nodes[nodename] ~= nil
|
||||||
@ -37,7 +41,7 @@ minetest.register_chatcommand("/reset", {
|
|||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
worldedit.set_pos[name] = nil
|
worldedit.set_pos[name] = nil
|
||||||
minetest.chat_send_player(name, "WorldEdit region reset", false)
|
worldedit.player_notify(name, "region reset")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -48,7 +52,7 @@ minetest.register_chatcommand("/mark", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
minetest.chat_send_player(name, "WorldEdit region marked", false)
|
worldedit.player_notify(name, "region marked")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -64,7 +68,7 @@ minetest.register_chatcommand("/unmark", {
|
|||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
worldedit.pos1[name] = pos1
|
worldedit.pos1[name] = pos1
|
||||||
worldedit.pos2[name] = pos2
|
worldedit.pos2[name] = pos2
|
||||||
minetest.chat_send_player(name, "WorldEdit region unmarked", false)
|
worldedit.player_notify(name, "region unmarked")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -77,7 +81,7 @@ minetest.register_chatcommand("/pos1", {
|
|||||||
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
|
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
|
||||||
worldedit.pos1[name] = pos
|
worldedit.pos1[name] = pos
|
||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
minetest.chat_send_player(name, "WorldEdit position 1 set to " .. minetest.pos_to_string(pos), false)
|
worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -90,7 +94,7 @@ minetest.register_chatcommand("/pos2", {
|
|||||||
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
|
pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5)
|
||||||
worldedit.pos2[name] = pos
|
worldedit.pos2[name] = pos
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
minetest.chat_send_player(name, "WorldEdit position 2 set to " .. minetest.pos_to_string(pos), false)
|
worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -101,26 +105,26 @@ minetest.register_chatcommand("/p", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
if param == "set" then --set both WorldEdit positions
|
if param == "set" then --set both WorldEdit positions
|
||||||
worldedit.set_pos[name] = "pos1"
|
worldedit.set_pos[name] = "pos1"
|
||||||
minetest.chat_send_player(name, "Select positions by punching two nodes", false)
|
worldedit.player_notify(name, "select positions by punching two nodes")
|
||||||
elseif param == "set1" then --set WorldEdit position 1
|
elseif param == "set1" then --set WorldEdit position 1
|
||||||
worldedit.set_pos[name] = "pos1only"
|
worldedit.set_pos[name] = "pos1only"
|
||||||
minetest.chat_send_player(name, "Select position 1 by punching a node", false)
|
worldedit.player_notify(name, "select position 1 by punching a node")
|
||||||
elseif param == "set2" then --set WorldEdit position 2
|
elseif param == "set2" then --set WorldEdit position 2
|
||||||
worldedit.set_pos[name] = "pos2"
|
worldedit.set_pos[name] = "pos2"
|
||||||
minetest.chat_send_player(name, "Select position 2 by punching a node", false)
|
worldedit.player_notify(name, "select position 2 by punching a node")
|
||||||
elseif param == "get" then --display current WorldEdit positions
|
elseif param == "get" then --display current WorldEdit positions
|
||||||
if worldedit.pos1[name] ~= nil then
|
if worldedit.pos1[name] ~= nil then
|
||||||
minetest.chat_send_player(name, "WorldEdit position 1: " .. minetest.pos_to_string(worldedit.pos1[name]), false)
|
worldedit.player_notify(name, "position 1: " .. minetest.pos_to_string(worldedit.pos1[name]))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, "WorldEdit position 1 not set", false)
|
worldedit.player_notify(name, "position 1 not set")
|
||||||
end
|
end
|
||||||
if worldedit.pos2[name] ~= nil then
|
if worldedit.pos2[name] ~= nil then
|
||||||
minetest.chat_send_player(name, "WorldEdit position 2: " .. minetest.pos_to_string(worldedit.pos2[name]), false)
|
worldedit.player_notify(name, "position 2: " .. minetest.pos_to_string(worldedit.pos2[name]))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, "WorldEdit position 2 not set", false)
|
worldedit.player_notify(name, "position 2 not set")
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, "Unknown subcommand: " .. param, false)
|
worldedit.player_notify(name, "unknown subcommand: " .. param)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -132,17 +136,17 @@ minetest.register_on_punchnode(function(pos, node, puncher)
|
|||||||
worldedit.pos1[name] = pos
|
worldedit.pos1[name] = pos
|
||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
worldedit.set_pos[name] = "pos2" --set position 2 on the next invocation
|
worldedit.set_pos[name] = "pos2" --set position 2 on the next invocation
|
||||||
minetest.chat_send_player(name, "WorldEdit position 1 set to " .. minetest.pos_to_string(pos), false)
|
worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos))
|
||||||
elseif worldedit.set_pos[name] == "pos1only" then --setting position 1 only
|
elseif worldedit.set_pos[name] == "pos1only" then --setting position 1 only
|
||||||
worldedit.pos1[name] = pos
|
worldedit.pos1[name] = pos
|
||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
worldedit.set_pos[name] = nil --finished setting positions
|
worldedit.set_pos[name] = nil --finished setting positions
|
||||||
minetest.chat_send_player(name, "WorldEdit position 1 set to " .. minetest.pos_to_string(pos), false)
|
worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos))
|
||||||
elseif worldedit.set_pos[name] == "pos2" then --setting position 2
|
elseif worldedit.set_pos[name] == "pos2" then --setting position 2
|
||||||
worldedit.pos2[name] = pos
|
worldedit.pos2[name] = pos
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
worldedit.set_pos[name] = nil --finished setting positions
|
worldedit.set_pos[name] = nil --finished setting positions
|
||||||
minetest.chat_send_player(name, "WorldEdit position 2 set to " .. minetest.pos_to_string(pos), false)
|
worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -154,12 +158,12 @@ minetest.register_chatcommand("/volume", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local volume = worldedit.volume(pos1, pos2)
|
local volume = worldedit.volume(pos1, pos2)
|
||||||
minetest.chat_send_player(name, "Current WorldEdit region has a volume of " .. volume .. " nodes (" .. pos2.x - pos1.x .. "*" .. pos2.y - pos1.y .. "*" .. pos2.z - pos1.z .. ")", false)
|
worldedit.player_notify(name, "current region has a volume of " .. volume .. " nodes (" .. pos2.x - pos1.x .. "*" .. pos2.y - pos1.y .. "*" .. pos2.z - pos1.z .. ")")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -170,12 +174,12 @@ minetest.register_chatcommand("/set", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if param == "" or not worldedit.node_is_valid(param) then
|
if param == "" or not worldedit.node_is_valid(param) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -183,8 +187,9 @@ minetest.register_chatcommand("/set", {
|
|||||||
if worldedit.ENABLE_QUEUE then
|
if worldedit.ENABLE_QUEUE then
|
||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
|
|
||||||
local count = worldedit.set(pos1, pos2, param, tenv)
|
local count = worldedit.set(pos1, pos2, param, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes set", false)
|
worldedit.player_notify(name, count .. " nodes set")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -195,21 +200,21 @@ minetest.register_chatcommand("/replace", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, searchnode, replacenode = param:find("^([^%s]+)%s+([^%s]+)$")
|
local found, _, searchnode, replacenode = param:find("^([^%s]+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(searchnode) then
|
if not worldedit.node_is_valid(searchnode) then
|
||||||
minetest.chat_send_player(name, "Invalid search node name: " .. searchnode, false)
|
worldedit.player_notify(name, "invalid search node name: " .. searchnode)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(replacenode) then
|
if not worldedit.node_is_valid(replacenode) then
|
||||||
minetest.chat_send_player(name, "Invalid replace node name: " .. replacenode, false)
|
worldedit.player_notify(name, "invalid replace node name: " .. replacenode)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -218,7 +223,7 @@ minetest.register_chatcommand("/replace", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.replace(pos1, pos2, searchnode, replacenode, tenv)
|
local count = worldedit.replace(pos1, pos2, searchnode, replacenode, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes replaced", false)
|
worldedit.player_notify(name, count .. " nodes replaced")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -229,21 +234,21 @@ minetest.register_chatcommand("/replaceinverse", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, searchnode, replacenode = param:find("^([^%s]+)%s+([^%s]+)$")
|
local found, _, searchnode, replacenode = param:find("^([^%s]+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(searchnode) then
|
if not worldedit.node_is_valid(searchnode) then
|
||||||
minetest.chat_send_player(name, "Invalid search node name: " .. searchnode, false)
|
worldedit.player_notify(name, "invalid search node name: " .. searchnode)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(replacenode) then
|
if not worldedit.node_is_valid(replacenode) then
|
||||||
minetest.chat_send_player(name, "Invalid replace node name: " .. replacenode, false)
|
worldedit.player_notify(name, "invalid replace node name: " .. replacenode)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -252,7 +257,7 @@ minetest.register_chatcommand("/replaceinverse", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.replaceinverse(pos1, pos2, searchnode, replacenode, tenv)
|
local count = worldedit.replaceinverse(pos1, pos2, searchnode, replacenode, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes replaced", false)
|
worldedit.player_notify(name, count .. " nodes replaced")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -263,17 +268,17 @@ minetest.register_chatcommand("/hollowsphere", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -282,7 +287,7 @@ minetest.register_chatcommand("/hollowsphere", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.hollow_sphere(pos, tonumber(radius), nodename, tenv)
|
local count = worldedit.hollow_sphere(pos, tonumber(radius), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes added", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -293,17 +298,17 @@ minetest.register_chatcommand("/sphere", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -312,7 +317,7 @@ minetest.register_chatcommand("/sphere", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.sphere(pos, tonumber(radius), nodename, tenv)
|
local count = worldedit.sphere(pos, tonumber(radius), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes added", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -323,17 +328,17 @@ minetest.register_chatcommand("/hollowdome", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -342,7 +347,7 @@ minetest.register_chatcommand("/hollowdome", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.hollow_dome(pos, tonumber(radius), nodename, tenv)
|
local count = worldedit.hollow_dome(pos, tonumber(radius), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes added", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -353,17 +358,17 @@ minetest.register_chatcommand("/dome", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
local found, _, radius, nodename = param:find("^(%d+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -372,7 +377,7 @@ minetest.register_chatcommand("/dome", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.dome(pos, tonumber(radius), nodename, tenv)
|
local count = worldedit.dome(pos, tonumber(radius), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes added", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -383,13 +388,13 @@ minetest.register_chatcommand("/hollowcylinder", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+([^%s]+)$")
|
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
@ -397,7 +402,7 @@ minetest.register_chatcommand("/hollowcylinder", {
|
|||||||
length = length * sign
|
length = length * sign
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -406,7 +411,7 @@ minetest.register_chatcommand("/hollowcylinder", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.hollow_cylinder(pos, axis, tonumber(length), tonumber(radius), nodename, tenv)
|
local count = worldedit.hollow_cylinder(pos, axis, tonumber(length), tonumber(radius), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes added", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -417,13 +422,13 @@ minetest.register_chatcommand("/cylinder", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+([^%s]+)$")
|
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
@ -431,7 +436,7 @@ minetest.register_chatcommand("/cylinder", {
|
|||||||
length = length * sign
|
length = length * sign
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -440,7 +445,7 @@ minetest.register_chatcommand("/cylinder", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.cylinder(pos, axis, tonumber(length), tonumber(radius), nodename, tenv)
|
local count = worldedit.cylinder(pos, axis, tonumber(length), tonumber(radius), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes added", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -451,17 +456,17 @@ minetest.register_chatcommand("/pyramid", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, size, nodename = param:find("(%d+)%s+([^%s]+)$")
|
local found, _, size, nodename = param:find("(%d+)%s+([^%s]+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -470,7 +475,7 @@ minetest.register_chatcommand("/pyramid", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.pyramid(pos, tonumber(size), nodename, tenv)
|
local count = worldedit.pyramid(pos, tonumber(size), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes added", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -481,17 +486,17 @@ minetest.register_chatcommand("/spiral", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, width, height, space, nodename = param:find("(%d+)%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
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not worldedit.node_is_valid(nodename) then
|
if not worldedit.node_is_valid(nodename) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -500,7 +505,7 @@ minetest.register_chatcommand("/spiral", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.spiral(pos, tonumber(width), tonumber(height), tonumber(space), nodename, tenv)
|
local count = worldedit.spiral(pos, tonumber(width), tonumber(height), tonumber(space), nodename, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes changed", false)
|
worldedit.player_notify(name, count .. " nodes added")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -511,13 +516,13 @@ minetest.register_chatcommand("/copy", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, axis, amount = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
local found, _, axis, amount = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
@ -530,7 +535,7 @@ minetest.register_chatcommand("/copy", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.copy(pos1, pos2, axis, tonumber(amount), tenv)
|
local count = worldedit.copy(pos1, pos2, axis, tonumber(amount), tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes copied", false)
|
worldedit.player_notify(name, count .. " nodes copied")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -541,13 +546,13 @@ minetest.register_chatcommand("/move", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, axis, amount = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
local found, _, axis, amount = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
@ -567,7 +572,7 @@ minetest.register_chatcommand("/move", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.copy(pos1, pos2, axis, tonumber(amount), tenv)
|
local count = worldedit.copy(pos1, pos2, axis, tonumber(amount), tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes moved", false)
|
worldedit.player_notify(name, count .. " nodes moved")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -578,13 +583,13 @@ minetest.register_chatcommand("/stack", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, axis, count = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
local found, _, axis, count = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
@ -597,7 +602,7 @@ minetest.register_chatcommand("/stack", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.stack(pos1, pos2, axis, tonumber(count), tenv)
|
local count = worldedit.stack(pos1, pos2, axis, tonumber(count), tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes stacked", false)
|
worldedit.player_notify(name, count .. " nodes stacked")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -608,13 +613,13 @@ minetest.register_chatcommand("/transpose", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, axis1, axis2 = param:find("^([xyz%?])%s+([xyz%?])$")
|
local found, _, axis1, axis2 = param:find("^([xyz%?])%s+([xyz%?])$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if axis1 == "?" then
|
if axis1 == "?" then
|
||||||
@ -624,7 +629,7 @@ minetest.register_chatcommand("/transpose", {
|
|||||||
axis2 = worldedit.player_axis(name)
|
axis2 = worldedit.player_axis(name)
|
||||||
end
|
end
|
||||||
if axis1 == axis2 then
|
if axis1 == axis2 then
|
||||||
minetest.chat_send_player(name, "Invalid usage: axes are the same", false)
|
worldedit.player_notify(name, "invalid usage: axes must be different")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -640,7 +645,7 @@ minetest.register_chatcommand("/transpose", {
|
|||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
|
|
||||||
minetest.chat_send_player(name, count .. " nodes transposed", false)
|
worldedit.player_notify(name, count .. " nodes transposed")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -651,7 +656,7 @@ minetest.register_chatcommand("/flip", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -659,7 +664,7 @@ minetest.register_chatcommand("/flip", {
|
|||||||
param = worldedit.player_axis(name)
|
param = worldedit.player_axis(name)
|
||||||
end
|
end
|
||||||
if param ~= "x" and param ~= "y" and param ~= "z" then
|
if param ~= "x" and param ~= "y" and param ~= "z" then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -668,7 +673,7 @@ minetest.register_chatcommand("/flip", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.flip(pos1, pos2, param, tenv)
|
local count = worldedit.flip(pos1, pos2, param, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes flipped", false)
|
worldedit.player_notify(name, count .. " nodes flipped")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -679,20 +684,20 @@ minetest.register_chatcommand("/rotate", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, axis, angle = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
local found, _, axis, angle = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
axis = worldedit.player_axis(name)
|
axis = worldedit.player_axis(name)
|
||||||
end
|
end
|
||||||
if angle % 90 ~= 0 then
|
if angle % 90 ~= 0 then
|
||||||
minetest.chat_send_player(name, "Invalid usage: angle must be multiple of 90", false)
|
worldedit.player_notify(name, "invalid usage: angle must be multiple of 90")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -708,7 +713,7 @@ minetest.register_chatcommand("/rotate", {
|
|||||||
worldedit.mark_pos1(name)
|
worldedit.mark_pos1(name)
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
|
|
||||||
minetest.chat_send_player(name, count .. " nodes rotated", false)
|
worldedit.player_notify(name, count .. " nodes rotated")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -719,17 +724,17 @@ minetest.register_chatcommand("/orient", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local found, _, angle = param:find("^([+-]?%d+)$")
|
local found, _, angle = param:find("^([+-]?%d+)$")
|
||||||
if found == nil then
|
if found == nil then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if angle % 90 ~= 0 then
|
if angle % 90 ~= 0 then
|
||||||
minetest.chat_send_player(name, "Invalid usage: angle must be multiple of 90", false)
|
worldedit.player_notify(name, "invalid usage: angle must be multiple of 90")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -739,7 +744,7 @@ minetest.register_chatcommand("/orient", {
|
|||||||
end
|
end
|
||||||
local count = worldedit.orient(pos1, pos2, angle, tenv)
|
local count = worldedit.orient(pos1, pos2, angle, tenv)
|
||||||
|
|
||||||
minetest.chat_send_player(name, count .. " nodes oriented", false)
|
worldedit.player_notify(name, count .. " nodes oriented")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -750,7 +755,7 @@ minetest.register_chatcommand("/fixlight", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -759,7 +764,7 @@ minetest.register_chatcommand("/fixlight", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.fixlight(pos1, pos2, tenv)
|
local count = worldedit.fixlight(pos1, pos2, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes updated", false)
|
worldedit.player_notify(name, count .. " nodes updated")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -770,7 +775,7 @@ minetest.register_chatcommand("/hide", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -779,7 +784,7 @@ minetest.register_chatcommand("/hide", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.hide(pos1, pos2, tenv)
|
local count = worldedit.hide(pos1, pos2, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes hidden", false)
|
worldedit.player_notify(name, count .. " nodes hidden")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -790,12 +795,12 @@ minetest.register_chatcommand("/suppress", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if param == "" or not worldedit.node_is_valid(param) then
|
if param == "" or not worldedit.node_is_valid(param) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -804,7 +809,7 @@ minetest.register_chatcommand("/suppress", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.suppress(pos1, pos2, param, tenv)
|
local count = worldedit.suppress(pos1, pos2, param, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes suppressed", false)
|
worldedit.player_notify(name, count .. " nodes suppressed")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -815,12 +820,12 @@ minetest.register_chatcommand("/highlight", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if param == "" or not worldedit.node_is_valid(param) then
|
if param == "" or not worldedit.node_is_valid(param) then
|
||||||
minetest.chat_send_player(name, "Invalid node name: " .. param, false)
|
worldedit.player_notify(name, "invalid node name: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -829,7 +834,7 @@ minetest.register_chatcommand("/highlight", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.highlight(pos1, pos2, param, tenv)
|
local count = worldedit.highlight(pos1, pos2, param, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes highlighted", false)
|
worldedit.player_notify(name, count .. " nodes highlighted")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -840,7 +845,7 @@ minetest.register_chatcommand("/restore", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -849,7 +854,7 @@ minetest.register_chatcommand("/restore", {
|
|||||||
tenv = worldedit.quene_aliasenv
|
tenv = worldedit.quene_aliasenv
|
||||||
end
|
end
|
||||||
local count = worldedit.restore(pos1, pos2, tenv)
|
local count = worldedit.restore(pos1, pos2, tenv)
|
||||||
minetest.chat_send_player(name, count .. " nodes restored", false)
|
worldedit.player_notify(name, count .. " nodes restored")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -860,12 +865,12 @@ minetest.register_chatcommand("/save", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if param == "" then
|
if param == "" then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -876,14 +881,14 @@ minetest.register_chatcommand("/save", {
|
|||||||
os.execute("mkdir \"" .. path .. "\"") --create directory if it does not already exist
|
os.execute("mkdir \"" .. path .. "\"") --create directory if it does not already exist
|
||||||
local file, err = io.open(filename, "wb")
|
local file, err = io.open(filename, "wb")
|
||||||
if err ~= nil then
|
if err ~= nil then
|
||||||
minetest.chat_send_player(name, "Could not save file to \"" .. filename .. "\"", false)
|
worldedit.player_notify(name, "could not save file to \"" .. filename .. "\"")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
file:write(result)
|
file:write(result)
|
||||||
file:flush()
|
file:flush()
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
minetest.chat_send_player(name, count .. " nodes saved", false)
|
worldedit.player_notify(name, count .. " nodes saved")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -894,26 +899,26 @@ minetest.register_chatcommand("/allocate", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1 = worldedit.pos1[name]
|
local pos1 = worldedit.pos1[name]
|
||||||
if pos1 == nil then
|
if pos1 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if param == "" then
|
if param == "" then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local filename = minetest.get_worldpath() .. "/schems/" .. param .. ".we"
|
local filename = minetest.get_worldpath() .. "/schems/" .. param .. ".we"
|
||||||
local file, err = io.open(filename, "rb")
|
local file, err = io.open(filename, "rb")
|
||||||
if err ~= nil then
|
if err ~= nil then
|
||||||
minetest.chat_send_player(name, "Could not open file \"" .. filename .. "\"", false)
|
worldedit.player_notify(name, "could not open file \"" .. filename .. "\"")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local value = file:read("*a")
|
local value = file:read("*a")
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
if worldedit.valueversion(value) == 0 then --unknown version
|
if worldedit.valueversion(value) == 0 then --unknown version
|
||||||
minetest.chat_send_player(name, "Invalid file: file is invalid or created with newer version of WorldEdit", false)
|
worldedit.player_notify(name, "invalid file: file is invalid or created with newer version of WorldEdit")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local nodepos1, nodepos2, count = worldedit.allocate(pos1, value)
|
local nodepos1, nodepos2, count = worldedit.allocate(pos1, value)
|
||||||
@ -923,7 +928,7 @@ minetest.register_chatcommand("/allocate", {
|
|||||||
worldedit.pos2[name] = nodepos2
|
worldedit.pos2[name] = nodepos2
|
||||||
worldedit.mark_pos2(name)
|
worldedit.mark_pos2(name)
|
||||||
|
|
||||||
minetest.chat_send_player(name, count .. " nodes allocated", false)
|
worldedit.player_notify(name, count .. " nodes allocated")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -934,12 +939,12 @@ minetest.register_chatcommand("/load", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1 = worldedit.pos1[name]
|
local pos1 = worldedit.pos1[name]
|
||||||
if pos1 == nil then
|
if pos1 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if param == "" then
|
if param == "" then
|
||||||
minetest.chat_send_player(name, "Invalid usage: " .. param, false)
|
worldedit.player_notify(name, "invalid usage: " .. param)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -957,14 +962,14 @@ minetest.register_chatcommand("/load", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if err then
|
if err then
|
||||||
minetest.chat_send_player(name, "Could not open file \"" .. param .. "\"", false)
|
worldedit.player_notify(name, "could not open file \"" .. param .. "\"")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local value = file:read("*a")
|
local value = file:read("*a")
|
||||||
file:close()
|
file:close()
|
||||||
|
|
||||||
if worldedit.valueversion(value) == 0 then --unknown version
|
if worldedit.valueversion(value) == 0 then --unknown version
|
||||||
minetest.chat_send_player(name, "Invalid file: file is invalid or created with newer version of WorldEdit", false)
|
worldedit.player_notify(name, "invalid file: file is invalid or created with newer version of WorldEdit")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -974,7 +979,7 @@ minetest.register_chatcommand("/load", {
|
|||||||
end
|
end
|
||||||
local count = worldedit.deserialize(pos1, value, tenv)
|
local count = worldedit.deserialize(pos1, value, tenv)
|
||||||
|
|
||||||
minetest.chat_send_player(name, count .. " nodes loaded", false)
|
worldedit.player_notify(name, count .. " nodes loaded")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -985,9 +990,9 @@ minetest.register_chatcommand("/lua", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local err = worldedit.lua(param)
|
local err = worldedit.lua(param)
|
||||||
if err then
|
if err then
|
||||||
minetest.chat_send_player(name, "Code error: " .. err, false)
|
worldedit.player_notify(name, "code error: " .. err)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, "Code successfully executed", false)
|
worldedit.player_notify(name, "code successfully executed", false)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -999,15 +1004,15 @@ minetest.register_chatcommand("/luatransform", {
|
|||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
minetest.chat_send_player(name, "No WorldEdit region selected", false)
|
worldedit.player_notify(name, "no region selected")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local err = worldedit.luatransform(pos1, pos2, param)
|
local err = worldedit.luatransform(pos1, pos2, param)
|
||||||
if err then
|
if err then
|
||||||
minetest.chat_send_player(name, "Code error: " .. err, false)
|
worldedit.player_notify(name, "code error: " .. err, false)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, "Code successfully executed", false)
|
worldedit.player_notify(name, "code successfully executed", false)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user