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 function add_HP_gauge(name)
|
||||||
local player = minetest.get_player_by_name(name)
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if player then
|
||||||
local pos = player:get_pos()
|
local pos = player:get_pos()
|
||||||
local ent = minetest.add_entity(pos, "gauges:hp_bar")
|
local ent = minetest.add_entity(pos, "gauges:hp_bar")
|
||||||
if ent ~= nil then
|
if ent ~= nil then
|
||||||
|
@ -51,6 +52,7 @@ local function add_HP_gauge(name)
|
||||||
ent = ent:get_luaentity()
|
ent = ent:get_luaentity()
|
||||||
ent.wielder = player:get_player_name()
|
ent.wielder = player:get_player_name()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If health_bars not defined or set to true
|
-- If health_bars not defined or set to true
|
||||||
|
|
Loading…
Reference in a new issue