update {eatable} function

This commit is contained in:
tenplus1 2024-07-27 18:29:06 +01:00
parent 9aa9fb2d58
commit 69f2827805

View File

@ -70,8 +70,7 @@ function wine:add_item(list)
end end
-- helper function -- helper function
local mod_tt_base = minetest.get_modpath("tt_base") -- mod does similar to infotext
local mod_tt_base = minetest.get_modpath("tt_base")
function wine.add_eatable(item, hp) function wine.add_eatable(item, hp)
@ -79,17 +78,17 @@ function wine.add_eatable(item, hp)
if def then if def then
local grps = def.groups or {} local groups = table.copy(def.groups) or {}
local txt = " (" ; if hp > 0 then txt = txt .. "+" end local txt = " (" ; if hp > 0 then txt = txt .. "+" end
txt = txt .. hp .. " HP)" txt = txt .. hp .. " HP)"
grps.eatable = hp ; grps.flammable = 2 groups.eatable = hp ; groups.flammable = 2
if mod_tt_base == nil then if mod_tt_base == nil then
def.description = def.description .. txt def.description = def.description .. txt
end end
minetest.override_item(item, {description = def.description, groups = grps}) minetest.override_item(item, {description = def.description, groups = groups})
end end
end end