From 8219cae41b23864ba9296d8ff6b2f818329935a5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 19 Feb 2017 21:39:51 +0100 Subject: [PATCH] Fix name tags not renaming mobs --- mods/ENTITIES/mobs/api.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mods/ENTITIES/mobs/api.lua b/mods/ENTITIES/mobs/api.lua index c0c7865d0..8c0d11e36 100644 --- a/mods/ENTITIES/mobs/api.lua +++ b/mods/ENTITIES/mobs/api.lua @@ -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