1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2025-07-02 16:30:21 +02:00

alternative to using on_punch for hearing ability, remove food xp desc

This commit is contained in:
tenplus1
2024-08-03 23:47:21 +01:00
parent b1da38456d
commit 1f6867bf25
2 changed files with 4 additions and 22 deletions

View File

@ -4,8 +4,6 @@ local FS = function(...) return minetest.formspec_escape(S(...)) end
local mc2 = minetest.get_modpath("mcl_core")
-- helper function to add {eatable} group to food items
local mod_tt_base = minetest.get_modpath("tt_base") -- mod does similar to infotext
function mobs.add_eatable(item, hp)
local def = minetest.registered_items[item]
@ -13,16 +11,10 @@ function mobs.add_eatable(item, hp)
if def then
local groups = table.copy(def.groups) or {}
local txt = " (" ; if hp > 0 then txt = txt .. "+" end
txt = txt .. hp .. " HP)"
groups.eatable = hp ; groups.flammable = 2
if mod_tt_base == nil then
def.description = def.description .. txt
end
minetest.override_item(item, {description = def.description, groups = groups})
minetest.override_item(item, {groups = groups})
end
end