Allow functions for mobs_debug

This commit is contained in:
cora 2024-08-31 16:40:14 +02:00
parent 4fc7e61f28
commit 1ab378b248

View File

@ -29,8 +29,12 @@ function mcl_mobs.mob_class:get_nametag()
local name = self.nametag ~= "" and self.nametag or self.name
local elements = {}
for _, k in ipairs(mcl_mobs_debug.fields_default) do
if type(k) =="function" then
table.insert(elements, k(self))
else
table.insert(elements, k.." = "..tostring(self[k]))
end
end
for _, k in ipairs(self._debug_fields or {}) do
if type(k) == "function" then
table.insert(elements, k(self))