Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2021-03-25 21:37:40 +01:00
commit bcdd82980b
2 changed files with 6 additions and 3 deletions

View File

@ -638,17 +638,19 @@ end
armor.get_valid_player = function(self, player, msg)
msg = msg or ""
if not player then
minetest.log("warning", S("3d_armor: Player reference is nil @1", msg))
minetest.log("warning", ("3d_armor%s: Player reference is nil"):format(msg))
return
end
local name = player:get_player_name()
if not name then
minetest.log("warning", S("3d_armor: Player name is nil @1", msg))
minetest.log("warning", ("3d_armor%s: Player name is nil"):format(msg))
return
end
local inv = minetest.get_inventory({type="detached", name=name.."_armor"})
if not inv then
minetest.log("warning", S("3d_armor: Detached armor inventory is nil @1", msg))
-- This check may fail when called inside `on_joinplayer`
-- in that case, the armor will be initialized/updated later on
minetest.log("warning", ("3d_armor%s: Detached armor inventory is nil"):format(msg))
return
end
return name, inv

View File

@ -331,6 +331,7 @@ minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
minetest.after(0, function()
-- TODO: Added in 7566ecc - What's the prupose?
local pplayer = minetest.get_player_by_name(player_name)
if pplayer and init_player_armor(pplayer) == false then
pending_players[pplayer] = 0