Set default owner to an invalid player name.

When placed by a machine, such as a constructor, the after_place_node
method might not be called and no owner will be set. Defaulting to an
invalid player owner prevents a constructor from placing another
constructor that can bypass protections.
This commit is contained in:
auouymous 2020-09-05 17:35:31 -06:00
parent b76247f2e9
commit 7f8fe2557d
1 changed files with 2 additions and 1 deletions

View File

@ -160,10 +160,11 @@ local function make_constructor(mark, length)
for i = 1, length do
inv:set_size("slot"..i, 1)
end
meta:set_string("owner", "?")
end,
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", (placer and placer:get_player_name() or ""))
meta:set_string("owner", (placer and placer:get_player_name() or "?"))
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)