Fix name tags not renaming mobs

This commit is contained in:
Wuzzy 2017-02-19 21:39:51 +01:00
parent 56e46ddbe9
commit 8219cae41b
1 changed files with 13 additions and 0 deletions

View File

@ -262,6 +262,12 @@ local function effect(pos, amount, texture, min_size, max_size, radius, gravity)
})
end
local function update_tag(self)
self.object:set_properties({
nametag = self.nametag
})
end
-- check if mob is dead or only hurt
local function check_for_death(self)
@ -296,6 +302,8 @@ local function check_for_death(self)
self.htimer = 2
update_tag(self)
return false
end
@ -2112,6 +2120,7 @@ local mob_activate = function(self, staticdata, dtime_s, def)
-- set anything changed above
self.object:set_properties(self)
update_tag(self)
end
local mob_step = function(self, dtime)
@ -2976,6 +2985,8 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
self.object:set_hp(self.health)
update_tag(self)
-- make children grow quicker
if self.child == true then
@ -3068,6 +3079,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- update nametag
mob_obj[name].nametag = fields.name
update_tag(mob_obj[name])
-- if not in creative then take item
if not creative then