1
0
mirror of https://github.com/Uberi/Minetest-WorldEdit.git synced 2024-12-25 18:20:38 +01:00

Fix a few assignments to undeclared globals

This commit is contained in:
sfan5 2017-11-07 14:19:57 +01:00
parent 7b1deb1b61
commit 415000e797
2 changed files with 8 additions and 2 deletions

View File

@ -301,7 +301,7 @@ function worldedit.stack(pos1, pos2, axis, count)
local amount = 0 local amount = 0
local copy = worldedit.copy local copy = worldedit.copy
local i = 1 local i = 1
function next_one() local function next_one()
if i <= count then if i <= count then
i = i + 1 i = i + 1
amount = amount + length amount = amount + length

View File

@ -203,7 +203,7 @@ minetest.register_on_punchnode(function(pos, node, puncher)
local name = puncher:get_player_name() local name = puncher:get_player_name()
if worldedit.inspect[name] then if worldedit.inspect[name] then
local axis, sign = worldedit.player_axis(name) local axis, sign = worldedit.player_axis(name)
message = string.format("inspector: %s at %s (param1=%d, param2=%d, received light=%d) punched facing the %s axis", local message = string.format("inspector: %s at %s (param1=%d, param2=%d, received light=%d) punched facing the %s axis",
node.name, minetest.pos_to_string(pos), node.param1, node.param2, get_node_rlight(pos), axis .. (sign > 0 and "+" or "-")) node.name, minetest.pos_to_string(pos), node.param1, node.param2, get_node_rlight(pos), axis .. (sign > 0 and "+" or "-"))
worldedit.player_notify(name, message) worldedit.player_notify(name, message)
end end
@ -642,6 +642,7 @@ minetest.register_chatcommand("/hollowcylinder", {
end end
length = tonumber(length) length = tonumber(length)
if axis == "?" then if axis == "?" then
local sign
axis, sign = worldedit.player_axis(name) axis, sign = worldedit.player_axis(name)
length = length * sign length = length * sign
end end
@ -665,6 +666,7 @@ minetest.register_chatcommand("/cylinder", {
end end
length = tonumber(length) length = tonumber(length)
if axis == "?" then if axis == "?" then
local sign
axis, sign = worldedit.player_axis(name) axis, sign = worldedit.player_axis(name)
length = length * sign length = length * sign
end end
@ -698,6 +700,7 @@ minetest.register_chatcommand("/hollowpyramid", {
local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$")
height = tonumber(height) height = tonumber(height)
if axis == "?" then if axis == "?" then
local sign
axis, sign = worldedit.player_axis(name) axis, sign = worldedit.player_axis(name)
height = height * sign height = height * sign
end end
@ -715,6 +718,7 @@ minetest.register_chatcommand("/pyramid", {
local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$")
height = tonumber(height) height = tonumber(height)
if axis == "?" then if axis == "?" then
local sign
axis, sign = worldedit.player_axis(name) axis, sign = worldedit.player_axis(name)
height = height * sign height = height * sign
end end
@ -762,6 +766,7 @@ minetest.register_chatcommand("/copy", {
end end
amount = tonumber(amount) amount = tonumber(amount)
if axis == "?" then if axis == "?" then
local sign
axis, sign = worldedit.player_axis(name) axis, sign = worldedit.player_axis(name)
amount = amount * sign amount = amount * sign
end end
@ -811,6 +816,7 @@ minetest.register_chatcommand("/stack", {
local found, _, axis, repetitions = param:find("^([xyz%?])%s+([+-]?%d+)$") local found, _, axis, repetitions = param:find("^([xyz%?])%s+([+-]?%d+)$")
repetitions = tonumber(repetitions) repetitions = tonumber(repetitions)
if axis == "?" then if axis == "?" then
local sign
axis, sign = worldedit.player_axis(name) axis, sign = worldedit.player_axis(name)
repetitions = repetitions * sign repetitions = repetitions * sign
end end