add {eatable} group to food items and update infotext

This commit is contained in:
tenplus1 2024-07-26 14:31:27 +01:00
parent 937e1c6cb5
commit 71431a298d
2 changed files with 5 additions and 28 deletions

View File

@ -14,7 +14,7 @@ local S = wine.S
-- blue agave -- blue agave
minetest.register_node("wine:blue_agave", { minetest.register_node("wine:blue_agave", {
description = S("Blue Agave"), description = S("Blue Agave") .. " (♥2)",
drawtype = "plantlike", drawtype = "plantlike",
visual_scale = 0.8, visual_scale = 0.8,
tiles = {"wine_blue_agave.png"}, tiles = {"wine_blue_agave.png"},
@ -28,7 +28,7 @@ minetest.register_node("wine:blue_agave", {
type = "fixed", type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.3, 0.2} fixed = {-0.2, -0.5, -0.2, 0.2, 0.3, 0.2}
}, },
groups = {snappy = 3, attached_node = 1, plant = 1}, groups = {snappy = 3, attached_node = 1, plant = 1, eatable = 2},
sounds = snd_l, sounds = snd_l,
on_use = minetest.item_eat(2), on_use = minetest.item_eat(2),

View File

@ -19,36 +19,14 @@ if mcl then
glass_item = "mcl_core:glass" glass_item = "mcl_core:glass"
end end
-- check for Unified Inventory -- check for Unified Inventory
local is_uninv = minetest.global_exists("unified_inventory") or false local is_uninv = minetest.global_exists("unified_inventory") or false
-- is thirsty mod active -- is thirsty mod active
local thirsty_mod = minetest.get_modpath("thirsty") local thirsty_mod = minetest.get_modpath("thirsty")
-- translation support -- translation support
local S local S = minetest.get_translator("wine") ; wine.S = S
if minetest.get_translator then
S = minetest.get_translator("wine")
else
S = function(s, a, ...)
if a == nil then
return s
end
a = {a, ...}
return s:gsub("(@?)@(%(?)(%d+)(%)?)", function(e, o, n, c)
if e == ""then
return a[tonumber(n)] .. (o == "" and c or "")
else
return "@" .. o .. n .. c
end
end)
end
end
wine.S = S
-- Unified Inventory hints -- Unified Inventory hints
if is_uninv then if is_uninv then
@ -61,7 +39,6 @@ if is_uninv then
}) })
end end
-- fermentation list (drinks added in drinks.lua) -- fermentation list (drinks added in drinks.lua)
local ferment = {} local ferment = {}
@ -98,7 +75,7 @@ function wine:add_drink(name, desc, has_bottle, num_hunger, num_thirst, alcoholi
-- glass -- glass
minetest.register_node("wine:glass_" .. name, { minetest.register_node("wine:glass_" .. name, {
description = S("Glass of " .. desc), description = S("Glass of " .. desc) .. " (♥" .. num_hunger .. ")",
drawtype = "plantlike", drawtype = "plantlike",
visual_scale = 0.5, visual_scale = 0.5,
tiles = {"wine_" .. name .. "_glass.png"}, tiles = {"wine_" .. name .. "_glass.png"},
@ -113,7 +90,7 @@ function wine:add_drink(name, desc, has_bottle, num_hunger, num_thirst, alcoholi
fixed = {-0.15, -0.5, -0.15, 0.15, 0, 0.15} fixed = {-0.15, -0.5, -0.15, 0.15, 0, 0.15}
}, },
groups = { groups = {
vessel = 1, dig_immediate = 3, vessel = 1, dig_immediate = 3, eatable = num_hunger,
attached_node = 1, drink = 1, alcohol = alcoholic attached_node = 1, drink = 1, alcohol = alcoholic
}, },
sounds = snd_g, sounds = snd_g,