Add workaround for orphaned entities (increased delay)

This commit is contained in:
ClobberXD 2018-11-29 21:39:57 +05:30 committed by rubenwardy
parent c0fe21d01a
commit 7140e8430e
3 changed files with 9 additions and 5 deletions

View file

@ -61,7 +61,7 @@ end
if minetest.setting_getbool("health_bars") ~= false and if minetest.setting_getbool("health_bars") ~= false and
minetest.setting_getbool("enable_damage") then minetest.setting_getbool("enable_damage") then
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
minetest.after(1, gauges.add_HP_gauge, player:get_player_name()) minetest.after(2, gauges.add_HP_gauge, player:get_player_name())
end) end)
end end

View file

@ -136,9 +136,14 @@ end
minetest.after(10, step) minetest.after(10, step)
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
minetest.after(2, function(name)
player = minetest.get_player_by_name(name)
if player then
playertag.set(player, TYPE_ENTITY) playertag.set(player, TYPE_ENTITY)
end
end, player:get_player_name())
end) end)
minetest.register_on_leaveplayer(function (player) minetest.register_on_leaveplayer(function(player)
remove_entity_tag(player) remove_entity_tag(player)
end) end)

View file

@ -1,4 +1,4 @@
WIELD3D_INIT_DELAY = 1 WIELD3D_INIT_DELAY = 2
WIELD3D_RETRY_TIME = 10 WIELD3D_RETRY_TIME = 10
WIELD3D_UPDATE_TIME = 1 WIELD3D_UPDATE_TIME = 1
@ -129,4 +129,3 @@ minetest.register_on_joinplayer(function(player)
player_wielding[player:get_player_name()] = 0 player_wielding[player:get_player_name()] = 0
minetest.after(WIELD3D_INIT_DELAY, add_wield_entity, player) minetest.after(WIELD3D_INIT_DELAY, add_wield_entity, player)
end) end)