forked from Sokomine/yl_speak_up
#5383 mobs_redo now uses get_properties() for hp_max; adjusted update_tag
This commit is contained in:
parent
1416ab39d3
commit
f60aaa8bd0
@ -126,38 +126,47 @@ mobs.mob_class.update_tag = function(self)
|
||||
return yl_speak_up.orig_mobs_update_tag(self)
|
||||
end
|
||||
|
||||
local qua = 0
|
||||
local floor = math.floor
|
||||
local col = "#00FF00"
|
||||
local qua = self.hp_max / 4
|
||||
local prop = self.object:get_properties()
|
||||
local hp_max = 0
|
||||
if(prop) then
|
||||
hp_max = prop.hp_max
|
||||
else
|
||||
hp_max = self.hp_max
|
||||
end
|
||||
local qua = hp_max / 6
|
||||
|
||||
if(self.force_nametag_color) then
|
||||
col = self.force_nametag_color
|
||||
elseif self.health <= floor(qua) then
|
||||
elseif self.health <= qua then
|
||||
col = "#FF0000"
|
||||
elseif self.health <= floor(qua * 2) then
|
||||
col = "#FF6600"
|
||||
elseif self.health <= floor(qua * 3) then
|
||||
elseif self.health <= (qua * 2) then
|
||||
col = "#FF7A00"
|
||||
elseif self.health <= (qua * 3) then
|
||||
col = "#FFB500"
|
||||
elseif self.health <= (qua * 4) then
|
||||
col = "#FFFF00"
|
||||
elseif self.health <= (qua * 5) then
|
||||
col = "#B4FF00"
|
||||
elseif self.health > (qua * 5) then
|
||||
col = "#00FF00"
|
||||
end
|
||||
|
||||
|
||||
local text = ""
|
||||
|
||||
if self.horny == true then
|
||||
|
||||
local HORNY_TIME = 30
|
||||
local HORNY_AGAIN_TIME = 60 * 5 -- 5 minutes
|
||||
|
||||
text = "\nLoving: " .. (self.hornytimer - (HORNY_TIME + HORNY_AGAIN_TIME))
|
||||
|
||||
elseif self.child == true then
|
||||
|
||||
local CHILD_GROW_TIME = 60 * 20 -- 20 minutes
|
||||
text = "\nGrowing: " .. (self.hornytimer - CHILD_GROW_TIME)
|
||||
|
||||
elseif self._breed_countdown then
|
||||
|
||||
text = "\nBreeding: " .. self._breed_countdown
|
||||
|
||||
end
|
||||
|
||||
if self.protected then
|
||||
@ -175,7 +184,7 @@ mobs.mob_class.update_tag = function(self)
|
||||
add_info = add_info..", "..tostring(self.yl_speak_up.npc_description)
|
||||
end
|
||||
end
|
||||
self.infotext = "Health: " .. self.health .. " / " .. self.hp_max
|
||||
self.infotext = "Health: " .. self.health .. " / " .. hp_max
|
||||
.. add_info
|
||||
.. (self.owner == "" and "" or "\nOwner: " .. self.owner)
|
||||
.. text
|
||||
|
Loading…
Reference in New Issue
Block a user