forked from VoxeLibre/VoxeLibre
Fix name tags not renaming mobs
This commit is contained in:
parent
56e46ddbe9
commit
8219cae41b
|
@ -262,6 +262,12 @@ local function effect(pos, amount, texture, min_size, max_size, radius, gravity)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function update_tag(self)
|
||||||
|
self.object:set_properties({
|
||||||
|
nametag = self.nametag
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- check if mob is dead or only hurt
|
-- check if mob is dead or only hurt
|
||||||
local function check_for_death(self)
|
local function check_for_death(self)
|
||||||
|
|
||||||
|
@ -296,6 +302,8 @@ local function check_for_death(self)
|
||||||
|
|
||||||
self.htimer = 2
|
self.htimer = 2
|
||||||
|
|
||||||
|
update_tag(self)
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2112,6 +2120,7 @@ local mob_activate = function(self, staticdata, dtime_s, def)
|
||||||
|
|
||||||
-- set anything changed above
|
-- set anything changed above
|
||||||
self.object:set_properties(self)
|
self.object:set_properties(self)
|
||||||
|
update_tag(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
local mob_step = function(self, dtime)
|
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)
|
self.object:set_hp(self.health)
|
||||||
|
|
||||||
|
update_tag(self)
|
||||||
|
|
||||||
-- make children grow quicker
|
-- make children grow quicker
|
||||||
if self.child == true then
|
if self.child == true then
|
||||||
|
|
||||||
|
@ -3068,6 +3079,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
-- update nametag
|
-- update nametag
|
||||||
mob_obj[name].nametag = fields.name
|
mob_obj[name].nametag = fields.name
|
||||||
|
|
||||||
|
update_tag(mob_obj[name])
|
||||||
|
|
||||||
-- if not in creative then take item
|
-- if not in creative then take item
|
||||||
if not creative then
|
if not creative then
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue