Compare commits

...

2 Commits

Author SHA1 Message Date
a51b1471a6 update api respect upstream remove htimer and tweak update_tag() 2023-06-07 09:37:08 -04:00
tenplus1
70b562c371 remove htimer, tweak update_tag() 2023-06-07 08:21:34 +01:00

27
api.lua
View File

@ -27,7 +27,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20230606",
version = "20230607",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -191,7 +191,6 @@ mobs.mob_class = {
gotten = false,
health = 0,
reach = 3,
htimer = 0,
docile_by_day = false,
time_of_day = 0.5,
fear_height = 0,
@ -795,19 +794,21 @@ local CHILD_GROW_TIME = 60 * 20 -- 20 minutes
-- update nametag and infotext
function mob_class:update_tag()
local col = "#00FF00"
local qua = self.hp_max / 4
local col
local qua = self.hp_max / 6
if self.health <= floor(qua * 3) then
col = "#FFFF00"
end
if self.health <= floor(qua * 2) then
col = "#FF6600"
end
if self.health <= floor(qua) then
if self.health <= qua then
col = "#FF0000"
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 = ""