1
0
의 미러 https://github.com/minetest-mods/areas.git synced 2025-07-06 01:50:23 +02:00

Added optional support for using worledit for selections.

This commit is contained in:
Joseph Pickard
2016-01-17 19:33:13 -05:00
부모 8b0b8c1ad2
커밋 79821b0892
2개의 변경된 파일40개의 추가작업 그리고 12개의 파일을 삭제

1
depends.txt Normal file
파일 보기

@ -0,0 +1 @@
worldedit?

29
pos.lua
파일 보기

@ -118,8 +118,25 @@ minetest.register_chatcommand("area_pos", {
end,
})
function areas.useWorldedit(playerName)
if worldedit then
if nil == playerName then
return true;
elseif minetest.check_player_privs(playerName, {worldedit = true}) then
return true;
end
end
return false;
end
function areas:getPos(playerName)
local pos1, pos2 = areas.pos1[playerName], areas.pos2[playerName]
local pos1, pos2 = nil, nil;
if areas.useWorldedit(playerName) then
pos1, pos2 = worldedit.pos1[playerName], worldedit.pos2[playerName];
else
pos1, pos2 = areas.pos1[playerName], areas.pos2[playerName];
end
if not (pos1 and pos2) then
return nil
end
@ -130,13 +147,23 @@ function areas:getPos(playerName)
end
function areas:setPos1(playerName, pos)
if areas.useWorldedit(playerName) then
worldedit.pos1[playerName] = pos;
worldedit.mark_pos1(playerName);
else
areas.pos1[playerName] = pos
areas.markPos1(playerName)
end
end
function areas:setPos2(playerName, pos)
if areas.useWorldedit(playerName) then
worldedit.pos2[playerName] = pos;
worldedit.mark_pos2(playerName);
else
areas.pos2[playerName] = pos
areas.markPos2(playerName)
end
end