Fix gauges crash when player leaves less than 1 second after joining
This commit is contained in:
parent
6a8e2bf0ea
commit
03ea18339e
1 changed files with 8 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue