Fix gauges crash when player leaves less than 1 second after joining

This commit is contained in:
rubenwardy 2017-10-12 19:20:43 +01:00
parent 6a8e2bf0ea
commit 03ea18339e

View file

@ -44,6 +44,7 @@ minetest.register_entity("gauges:hp_bar", hp_bar)
local function add_HP_gauge(name)
local player = minetest.get_player_by_name(name)
if player then
local pos = player:get_pos()
local ent = minetest.add_entity(pos, "gauges:hp_bar")
if ent ~= nil then
@ -52,6 +53,7 @@ local function add_HP_gauge(name)
ent.wielder = player:get_player_name()
end
end
end
-- If health_bars not defined or set to true
if minetest.setting_getbool("health_bars") ~= false and