mirror of
https://github.com/minetest-mods/areas.git
synced 2025-02-26 16:00:20 +01:00
Keep area marker when running '/area_posX' twice
Regression from c9f1cf2fac054
This commit is contained in:
parent
01c261cbe4
commit
8cb684da30
30
pos.lua
30
pos.lua
@ -184,14 +184,6 @@ function areas:setPos1(name, pos)
|
||||
pos = posLimit(pos)
|
||||
areas.pos1[name] = pos
|
||||
|
||||
local entity = minetest.add_entity(pos, "areas:pos1")
|
||||
if entity then
|
||||
local luaentity = entity:get_luaentity()
|
||||
if luaentity then
|
||||
luaentity.player = name
|
||||
end
|
||||
end
|
||||
|
||||
if old_pos then
|
||||
-- TODO: use `core.objects_inside_radius` after Luanti 5.10.0 is well established.
|
||||
for _, object in ipairs(core.get_objects_inside_radius(old_pos, 0.01)) do
|
||||
@ -201,20 +193,20 @@ function areas:setPos1(name, pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function areas:setPos2(name, pos)
|
||||
local old_pos = areas.pos2[name]
|
||||
pos = posLimit(pos)
|
||||
areas.pos2[name] = pos
|
||||
|
||||
local entity = minetest.add_entity(pos, "areas:pos2")
|
||||
local entity = core.add_entity(pos, "areas:pos1")
|
||||
if entity then
|
||||
local luaentity = entity:get_luaentity()
|
||||
if luaentity then
|
||||
luaentity.player = name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function areas:setPos2(name, pos)
|
||||
local old_pos = areas.pos2[name]
|
||||
pos = posLimit(pos)
|
||||
areas.pos2[name] = pos
|
||||
|
||||
if old_pos then
|
||||
-- TODO: use `core.objects_inside_radius` after Luanti 5.10.0 is well established.
|
||||
@ -225,6 +217,14 @@ function areas:setPos2(name, pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local entity = core.add_entity(pos, "areas:pos2")
|
||||
if entity then
|
||||
local luaentity = entity:get_luaentity()
|
||||
if luaentity then
|
||||
luaentity.player = name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node, puncher)
|
||||
|
Loading…
x
Reference in New Issue
Block a user