mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2025-07-06 10:00:33 +02:00
initialize sign
fix spelling error in variable debug info for testing
This commit is contained in:
@ -463,6 +463,7 @@ minetest.register_chatcommand("/hollowcylinder", {
|
|||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(.+)$")
|
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(.+)$")
|
||||||
length = tonumber(length)
|
length = tonumber(length)
|
||||||
|
sign = 1
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
axis, sign = worldedit.player_axis(name)
|
axis, sign = worldedit.player_axis(name)
|
||||||
length = length * sign
|
length = length * sign
|
||||||
@ -483,6 +484,7 @@ minetest.register_chatcommand("/cylinder", {
|
|||||||
local pos = worldedit.pos1[name]
|
local pos = worldedit.pos1[name]
|
||||||
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(.+)$")
|
local found, _, axis, length, radius, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(.+)$")
|
||||||
length = tonumber(length)
|
length = tonumber(length)
|
||||||
|
sign = 1
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
axis, sign = worldedit.player_axis(name)
|
axis, sign = worldedit.player_axis(name)
|
||||||
length = length * sign
|
length = length * sign
|
||||||
@ -503,6 +505,7 @@ minetest.register_chatcommand("/pyramid", {
|
|||||||
local pos = get_position(name)
|
local pos = get_position(name)
|
||||||
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)
|
||||||
|
sign = 1
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
axis, sign = worldedit.player_axis(name)
|
axis, sign = worldedit.player_axis(name)
|
||||||
height = height * sign
|
height = height * sign
|
||||||
@ -572,6 +575,7 @@ minetest.register_chatcommand("/copy", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
amount = tonumber(amount)
|
amount = tonumber(amount)
|
||||||
|
sign = 1
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
axis, sign = worldedit.player_axis(name)
|
axis, sign = worldedit.player_axis(name)
|
||||||
amount = amount * sign
|
amount = amount * sign
|
||||||
@ -599,6 +603,7 @@ minetest.register_chatcommand("/move", {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
amount = tonumber(amount)
|
amount = tonumber(amount)
|
||||||
|
sign = 1
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
axis, sign = worldedit.player_axis(name)
|
axis, sign = worldedit.player_axis(name)
|
||||||
amount = amount * sign
|
amount = amount * sign
|
||||||
@ -623,11 +628,12 @@ minetest.register_chatcommand("/stack", {
|
|||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
local found, _, axis, repetitions = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
local found, _, axis, repetitions = param:find("^([xyz%?])%s+([+-]?%d+)$")
|
||||||
repetitions = tonumber(repetitions)
|
repetitions = tonumber(repetitions)
|
||||||
|
sign = 1
|
||||||
if axis == "?" then
|
if axis == "?" then
|
||||||
axis, sign = worldedit.player_axis(name)
|
axis, sign = worldedit.player_axis(name)
|
||||||
repetitions = repetitions * sign
|
repetitions = repetitions * sign
|
||||||
end
|
end
|
||||||
if worldedit.can_edit_volume(name, {{x=(axis=="x" and pos2.x+1*sign or pos1.x), y=(axis=="y" and pos2.y+1*sign or pos1.x), z=(axis=="z" and pos2.z+1*sign or pos1.z)}, {x=pos2.x+repetitions*(axis=="x" and pos2.x-pos1.x+1*sign or 0), y=pos2.y+repititions*(axis=="y" and pos2.y-pos1.y+1*sign or 0), z=pos2.z+repititions*(axis=="z" and pos2.z-pos1.z+1*sign or 0)}}) then
|
if worldedit.can_edit_volume(name, {{x=(axis=="x" and pos2.x+1*sign or pos1.x), y=(axis=="y" and pos2.y+1*sign or pos1.x), z=(axis=="z" and pos2.z+1*sign or pos1.z)}, {x=pos2.x+repetitions*(axis=="x" and pos2.x-pos1.x+1*sign or 0), y=pos2.y+repetitions*(axis=="y" and pos2.y-pos1.y+1*sign or 0), z=pos2.z+repetitions*(axis=="z" and pos2.z-pos1.z+1*sign or 0)}}) then
|
||||||
local count = worldedit.stack(pos1, pos2, axis, repetitions)
|
local count = worldedit.stack(pos1, pos2, axis, repetitions)
|
||||||
worldedit.player_notify(name, count .. " nodes stacked")
|
worldedit.player_notify(name, count .. " nodes stacked")
|
||||||
end
|
end
|
||||||
|
@ -81,6 +81,12 @@ end
|
|||||||
--//move has disconnected sections, so it's passed as a list of points.
|
--//move has disconnected sections, so it's passed as a list of points.
|
||||||
--which are deduplicated.
|
--which are deduplicated.
|
||||||
worldedit.can_edit_volume = function(name, volume) --does not return a function like .privs does
|
worldedit.can_edit_volume = function(name, volume) --does not return a function like .privs does
|
||||||
|
--debug info, remove after testing
|
||||||
|
minetest.chat_send_player(name, minetest.pos_to_string(volume[1])..minetest.pos_to_string(volume[2]))
|
||||||
|
if volume[3] ~= nil then
|
||||||
|
minetest.chat_send_player(name, minetest.pos_to_string(volume[3])..minetest.pos_to_string(volume[4]))
|
||||||
|
end
|
||||||
|
|
||||||
--volume is before func, unlike safe_region having func before count
|
--volume is before func, unlike safe_region having func before count
|
||||||
--because func may be removed to have can_edit_volume in an if statement
|
--because func may be removed to have can_edit_volume in an if statement
|
||||||
--like worldedit.privs can be
|
--like worldedit.privs can be
|
||||||
|
Reference in New Issue
Block a user