mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-26 10:40:40 +01:00
Fix //mix and improve normalize_nodename.
This commit is contained in:
parent
4b178bf709
commit
38fbc0a046
@ -38,6 +38,7 @@ end
|
|||||||
|
|
||||||
--determines whether `nodename` is a valid node name, returning a boolean
|
--determines whether `nodename` is a valid node name, returning a boolean
|
||||||
worldedit.normalize_nodename = function(nodename)
|
worldedit.normalize_nodename = function(nodename)
|
||||||
|
nodename = nodename:gsub("^%s*(.-)%s*$", "%1")
|
||||||
if nodename == "" then return nil end
|
if nodename == "" then return nil end
|
||||||
local fullname = ItemStack({name=nodename}):get_name() --resolve aliases of node names to full names
|
local fullname = ItemStack({name=nodename}):get_name() --resolve aliases of node names to full names
|
||||||
if minetest.registered_nodes[fullname] or fullname == "air" then --directly found node name or alias of nodename
|
if minetest.registered_nodes[fullname] or fullname == "air" then --directly found node name or alias of nodename
|
||||||
@ -300,7 +301,7 @@ minetest.register_chatcommand("/mix", {
|
|||||||
privs = {worldedit=true},
|
privs = {worldedit=true},
|
||||||
func = safe_region(function(name, param)
|
func = safe_region(function(name, param)
|
||||||
local nodes = {}
|
local nodes = {}
|
||||||
for nodename in param:gmatch("[^,]+") do
|
for nodename in param:gmatch("[^%s]+") do
|
||||||
local node = get_node(name, nodename)
|
local node = get_node(name, nodename)
|
||||||
if not node then
|
if not node then
|
||||||
worldedit.player_notify(name, "Could not identify node \"" .. name .. "\"")
|
worldedit.player_notify(name, "Could not identify node \"" .. name .. "\"")
|
||||||
|
Loading…
Reference in New Issue
Block a user