mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-09-12 08:08:30 +02:00
fixed single nodename crash
This commit is contained in:
parent
8718e59206
commit
24569c37d3
@ -11,23 +11,22 @@ worldedit.register_command("wcompass", {
|
|||||||
require_pos = 1,
|
require_pos = 1,
|
||||||
parse = function(params_text)
|
parse = function(params_text)
|
||||||
local parts = wea.split(params_text," ",true)
|
local parts = wea.split(params_text," ",true)
|
||||||
|
if not parts[1] then
|
||||||
|
return false, "Error: too few arguments! Expected: \"<replace_node> [<bead_node>]\""
|
||||||
|
elseif not parts[2] then
|
||||||
|
parts[2] = parts[1]
|
||||||
|
end
|
||||||
local node1 = worldedit.normalize_nodename(parts[1])
|
local node1 = worldedit.normalize_nodename(parts[1])
|
||||||
local node2 = worldedit.normalize_nodename(parts[2])
|
local node2 = worldedit.normalize_nodename(parts[2])
|
||||||
if not node1 then
|
if not node1 then
|
||||||
return false, "Invalid <replace_node>: " .. parts[1]
|
return false, "Invalid <replace_node>: " .. parts[1]
|
||||||
elseif parts[2] and not node2 then
|
elseif not node2 then
|
||||||
return false, "Invalid <bead_node>: " .. parts[2]
|
return false, "Invalid <bead_node>: " .. parts[2]
|
||||||
elseif not parts[2] then
|
|
||||||
node2 = node1
|
|
||||||
end
|
end
|
||||||
return true, node1, node2
|
return true, node1, node2
|
||||||
end,
|
end,
|
||||||
nodes_needed = function(name)
|
nodes_needed = function(name)
|
||||||
local p1, p2, total = worldedit.pos1[name], worldedit.pos2[name], 1
|
return 26
|
||||||
for k,v in pairs({"x","y","z"}) do
|
|
||||||
if p1[v] ~= p2[v] then total = total*2 end
|
|
||||||
end
|
|
||||||
return total
|
|
||||||
end,
|
end,
|
||||||
func = function(name, node1, node2)
|
func = function(name, node1, node2)
|
||||||
local _, count = wea.make_compass(worldedit.pos1[name], node1, node2)
|
local _, count = wea.make_compass(worldedit.pos1[name], node1, node2)
|
||||||
|
Loading…
Reference in New Issue
Block a user