Merge pull request 'Fix nametags (Fixes #1649)' (#1651) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1651mineclone5
commit
d5e0632ebc
|
@ -53,7 +53,6 @@ local vector_multiply = vector.multiply
|
|||
local vector_divide = vector.divide
|
||||
|
||||
-- mob constants
|
||||
local MAX_MOB_NAME_LENGTH = 30
|
||||
local BREED_TIME = 30
|
||||
local BREED_TIME_AGAIN = 300
|
||||
local CHILD_GROW_TIME = 60*20
|
||||
|
|
|
@ -940,30 +940,7 @@ local smart_mobs = function(self, s, p, dist, dtime)
|
|||
end
|
||||
end
|
||||
|
||||
local update_tag = function(self)
|
||||
local tag
|
||||
if mobs_debug then
|
||||
tag = "nametag = '"..tostring(self.nametag).."'\n"..
|
||||
"state = '"..tostring(self.state).."'\n"..
|
||||
"order = '"..tostring(self.order).."'\n"..
|
||||
"attack = "..tostring(self.attack).."\n"..
|
||||
"health = "..tostring(self.health).."\n"..
|
||||
"breath = "..tostring(self.breath).."\n"..
|
||||
"gotten = "..tostring(self.gotten).."\n"..
|
||||
"tamed = "..tostring(self.tamed).."\n"..
|
||||
"horny = "..tostring(self.horny).."\n"..
|
||||
"hornytimer = "..tostring(self.hornytimer).."\n"..
|
||||
"runaway_timer = "..tostring(self.runaway_timer).."\n"..
|
||||
"following = "..tostring(self.following)
|
||||
else
|
||||
tag = self.nametag
|
||||
end
|
||||
self.object:set_properties({
|
||||
nametag = tag,
|
||||
})
|
||||
|
||||
update_roll(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ local math_random = math.random
|
|||
local vector_direction = vector.direction
|
||||
local vector_multiply = vector.multiply
|
||||
|
||||
local MAX_MOB_NAME_LENGTH = 30
|
||||
|
||||
mobs.feed_tame = function(self)
|
||||
return nil
|
||||
end
|
||||
|
@ -28,7 +30,7 @@ local on_rightclick_prefix = function(self, clicker)
|
|||
end
|
||||
self.nametag = tag
|
||||
|
||||
update_tag(self)
|
||||
mobs.update_tag(self)
|
||||
|
||||
if not mobs.is_creative(clicker:get_player_name()) then
|
||||
item:take_item()
|
||||
|
@ -280,4 +282,10 @@ mobs.shoot_projectile = function(self)
|
|||
|
||||
--call internal shoot_arrow function
|
||||
self.shoot_arrow(self,pos1,dir)
|
||||
end
|
||||
|
||||
mobs.update_tag = function(self)
|
||||
self.object:set_properties({
|
||||
nametag = self.nametag,
|
||||
})
|
||||
end
|
|
@ -199,11 +199,7 @@ mobs.mob_activate = function(self, staticdata, def, dtime)
|
|||
else
|
||||
self.object:set_texture_mod("")
|
||||
end
|
||||
|
||||
-- check existing nametag
|
||||
if not self.nametag then
|
||||
self.nametag = def.nametag
|
||||
end
|
||||
|
||||
|
||||
-- set anything changed above
|
||||
self.object:set_properties(self)
|
||||
|
|
Loading…
Reference in New Issue