1
0
Fork 0

Fix nametags

This commit is contained in:
jordan4ibanez 2021-04-25 04:09:35 -04:00
parent a3ff108cd4
commit 1616cb7538
4 changed files with 10 additions and 30 deletions

View File

@ -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

View File

@ -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

View File

@ -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()
@ -281,3 +283,9 @@ 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

View File

@ -200,10 +200,6 @@ mobs.mob_activate = function(self, staticdata, def, dtime)
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)