1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-11-13 05:50:17 +01:00

add mob protection to infotext

This commit is contained in:
tenplus1 2022-07-31 10:20:32 +01:00
parent 7ac8506dda
commit e4ac59609a

14
api.lua
View File

@ -28,7 +28,7 @@ local use_cmi = minetest.global_exists("cmi")
mobs = {
mod = "redo",
version = "20220729",
version = "20220731",
intllib = S,
invis = minetest.global_exists("invisibility") and invisibility or {}
}
@ -750,7 +750,7 @@ local HORNY_AGAIN_TIME = 60 * 5 -- 5 minutes
local CHILD_GROW_TIME = 60 * 20 -- 20 minutes
-- update nametag colour
-- update nametag and infotext
function mob_class:update_tag()
local col = "#00FF00"
@ -784,8 +784,16 @@ function mob_class:update_tag()
end
if self.protected then
if self.protected == 2 then
text = text .. "\nProtection: Level 2"
else
text = text .. "\nProtection: Level 1"
end
end
self.infotext = "Health: " .. self.health .. " / " .. self.hp_max
.. (self.owner == "" and "" or "\n" .. "Owner: " .. self.owner)
.. (self.owner == "" and "" or "\nOwner: " .. self.owner)
.. text
-- set changes