From 7f8fe2557de8756245d465fc2099357853985012 Mon Sep 17 00:00:00 2001 From: auouymous Date: Sat, 5 Sep 2020 17:35:31 -0600 Subject: [PATCH] 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. --- technic/machines/other/constructor.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/technic/machines/other/constructor.lua b/technic/machines/other/constructor.lua index 71efa69..9117224 100644 --- a/technic/machines/other/constructor.lua +++ b/technic/machines/other/constructor.lua @@ -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)