This commit is contained in:
Rainer 2025-08-22 02:04:48 +02:00
commit 2d26db1c5b
38 changed files with 2837 additions and 0 deletions

View file

@ -0,0 +1,19 @@
# Interoperability
The interoperability files (short *i14n* files) are supposed to be used as fallback created within Hunger NG when a mod author can not or will not add support for Hunger NG in their mod for whatever reason.
Hunger NG is meant to be used as library/API by other mods. The i14n files should not be seen as the first solution if in is desirable that another mod in some way interacts with Hunger NG (hunger definition in food items, for example).
Before an i14y file will be added the following things have to be checked/done.
1. Maybe informally contact the original mod author in the mods forum thread and point them to [the Hunger NG API definition][api] and ask them to look at this and if they want to add support.
2. Formally file an issue/ticket in the mods VCS or issue-tracker or proactively create a pull request at the mods VCS adding support for Hunger NG there.
3. If you are a server owner the easiest would be creating an interoperability mod depending on both the original mod and `hunger_ng` and incorporate the Hunger NG API on your own. Its actually quite simple. The i14y files to exactly the same. See [the i14y section of the API][i14y]) for more details on API things dedicated to the i14y functionality in addition to the regular API calls.
4. Create a pull request on *Hunger NG* adding the desired support. _**Important note:** The i14y code has to be self-contained within the corresponding i14y file. No code, files, or configuration outside the i14y file will be added. Hunger NG is a library/API providing hunger functionality. Interoperability with other mods is just an additional fallback solution if original mod authors wont add support to their mods._
5. [Start a discussion in the CDB][cdb] requesting interoperability with a specific mods giving as much information as possible (name, author, link to forum and VCS, optimally the item ID to add support for) and not just the mods name and “please add” 😊
Go through the list from 1 to 5. Advance by 1 step if the previous step did not result in anything\ or is not desirable.
[api]: https://git.0x7be.net/dirk/hunger_ng/src/branch/main/doc/README.md
[i14y]: https://git.0x7be.net/dirk/hunger_ng/src/branch/main/doc/README.API.md#additional-interoperability-functions
[cdb]: https://content.luanti.org/threads/new/?pid=133

View file

@ -0,0 +1,24 @@
-- Berry Bushes
--
-- Author jordan4ibanez
-- Forums https://forum.luanti.org/viewtopic.php?t=14068
-- VCS No VCS provided
local add = hunger_ng.add_hunger_data
local berries = {
'raspberry',
'blackberry',
'gooseberry',
'strawberry',
'mixed_berry',
'blueberry'
}
for _,berry in pairs(berries) do
add('bushes:'..berry..'_pie_raw', { satiates = 2, heals = -2 })
add('bushes:'..berry..'_pie_cooked', { satiates = 5 })
add('bushes:'..berry..'_pie_slice', { satiates = 0.8 })
add('bushes:'..berry, { satiates = 0.5 })
end

View file

@ -0,0 +1,12 @@
-- default (comes with Minetest Game)
--
-- Author Various Minetest Game developers and contributors
-- Forums https://forum.luanti.org/viewtopic.php?t=9724
-- VCS https://github.com/minetest/minetest_game
local add = hunger_ng.add_hunger_data
add('default:apple', { satiates = 4, heals = 0 })
add('default:blueberries', { satiates = 0.5 })

View file

@ -0,0 +1,49 @@
-- Ethereal
--
-- Author TenPlus1
-- Forums https://forum.luanti.org/viewtopic.php?t=14638
-- VCS https://notabug.org/TenPlus1/ethereal
local add = hunger_ng.add_hunger_data
-- fishing.lua
add('ethereal:fish_raw', { satiates = 1 })
add('ethereal:fish_cooked', { satiates = 2.5 })
add('ethereal:sashimi', { satiates = 2 })
-- food.lua
add('ethereal:banana', { satiates = 1.5 })
add('ethereal:banana_bunch', { satiates = 4.5 })
add('ethereal:orange', { satiates = 2 })
add('ethereal:pine_nuts', { satiates = 0.5 })
add('ethereal:banana_bread', { satiates = 6 })
add('ethereal:coconut_slice', { satiates = 0.5 })
add('ethereal:golden_apple', { satiates = 10, heals = 10 })
add('ethereal:hearty_stew', { satiates = 7, returns = 'ethereal:bowl' })
add('ethereal:bucket_cactus', { satiates = 1, returns = 'bucket:bucket_empty' })
add('ethereal:firethorn_jelly', { satiates = 1, returns = 'vessels:glass_bottle' })
add('ethereal:lemon', { satiates = 3 })
add('ethereal:candied_lemon', { satiates = 5 })
add('ethereal:olive', { satiates = 1 })
-- leaves.lua
add('ethereal:yellowleaves', { satiates = 0.5 })
-- mushroom.lua
add('ethereal:mushroom_soup', { satiates = 2.5, returns = 'ethereal:bowl' })
-- onion.lua
add('ethereal:wild_onion_plant', { satiates = 1.5, heals = -1 })
-- plantlife.lua
add('ethereal:fern_tubers', { satiates = 0.5 })
-- sapling.lua
add('ethereal:bamboo_sprout', { satiates = 1 })
-- sealife.lua
add('ethereal:seaweed', { satiates = 0.5 })
-- strawberry.lua
add('ethereal:strawberry', { satiates = 0.5 })

View file

@ -0,0 +1,84 @@
-- Farming Redo
--
-- Author TenPlus1
-- Forums https://forum.luanti.org/viewtopic.php?t=9019
-- VCS https://notabug.org/TenPlus1/Farming
local add = hunger_ng.add_hunger_data
-- `farming:bread` is also a part of the default `farming` mod. Its texture
-- is used for the hunger bar if not specified to not doing so.
local ubi = hunger_ng.interoperability.settings.hunger_bar.force_builtin_image
if ubi == false then hunger_ng.hunger_bar_image = 'farming_bread.png' end
-- Farming bread
add('farming:bread', { satiates = 5 })
-- Edible stuff from farming Redo
add('farming:apple_pie', { satiates = 6 })
add('farming:baked_potato', { satiates = 6 })
add('farming:beans', { satiates = 1 })
add('farming:beetroot', { satiates = 0.6 })
add('farming:beetroot_soup', { satiates = 4, returns = 'farming:bowl' })
add('farming:bibimbap', { satiates = 8 })
add('farming:blueberries', { satiates = 0.5 })
add('farming:blueberry_pie', { satiates = 5 })
add('farming:bread_multigrain', { satiates = 6 })
add('farming:bread_slice', { satiates = 1 })
add('farming:burger', { satiates = 13 })
add('farming:cabbage', { satiates = 1 })
add('farming:carrot', { satiates = 2.5 })
add('farming:carrot_gold', { satiates = 8, heals = 8 })
add('farming:chili_bowl', { satiates = 7, returns = 'farming:bowl' })
add('farming:chili_pepper', { satiates = 1, heals= -1 })
add('farming:chocolate_dark', { satiates = 2 })
add('farming:cookie', { satiates = 1 })
add('farming:corn', { satiates = 2 })
add('farming:corn_cob', { satiates = 4 })
add('farming:cucumber', { satiates = 2 })
add('farming:donut', { satiates = 2 })
add('farming:donut_apple', { satiates = 3 })
add('farming:donut_chocolate', { satiates = 2 })
add('farming:garlic', { satiates = 1 })
add('farming:garlic_bread', { satiates = 2 })
add('farming:grapes', { satiates = 2 })
add('farming:jaffa_cake', { satiates = 1.5 })
add('farming:lettuce', { satiates = 2 })
add('farming:melon_slice', { satiates = 1 })
add('farming:muffin_blueberry', { satiates = 4 })
add('farming:onion', { satiates = 3, heals = -1 })
add('farming:onion_soup', { satiates = 6, returns = 'farming:bowl' })
add('farming:pea_pod', { satiates = 0.6 })
add('farming:pea_soup', { satiates = 7, returns = 'farming:bowl' })
add('farming:peas', { satiates = 0.5 })
add('farming:pepper', { satiates = 2 })
add('farming:pepper_yellow', { satiates = 3 })
add('farming:pepper_red', { satiates = 4 })
add('farming:pineapple', { satiates = 3 })
add('farming:pineapple_ring', { satiates = 0.6 })
add('farming:porridge', { satiates = 7 })
add('farming:potato', { satiates = 0.5 })
add('farming:potato_salad', { satiates = 3 })
add('farming:pumpkin_bread', { satiates = 6 })
add('farming:pumpkin_slice', { satiates = 1 })
add('farming:raspberries', { satiates = 0.5 })
add('farming:rhubarb', { satiates = 1 })
add('farming:rhubarb_pie', { satiates = 5 })
add('farming:rice_bread', { satiates = 2 })
add('farming:salad', { satiates = 8 })
add('farming:soy_beans', { satiates = 1 })
add('farming:spaghetti', { satiates = 8 })
add('farming:toast', { satiates = 1 })
add('farming:toast_sandwich', { satiates = 2.5 })
add('farming:tomato', { satiates = 3 })
add('farming:turkish_delight', { satiates = 1 })
add('farming:vanilla', { satiates = 1 })
add('farming:mint_tea', { satiates = 0.25, heals = 1, returns = 'vessels:drinking_glass' })
add('farming:coffee_cup', { satiates = 0.5, returns = 'vessels:drinking_glass' })
add('farming:smoothie_berry', { satiates = 6, returns = 'vessels:drinking_glass' })
add('farming:smoothie_raspberry', { satiates = 2.5, returns = 'vessels:drinking_glass' })
add('farming:popcorn', { satiates = 2 })

View file

@ -0,0 +1,12 @@
-- Ferns
--
-- Author Mossmanikin
-- Forums https://forum.luanti.org/viewtopic.php?id=6921
-- VCS https://github.com/Mossmanikin/ferns
local add = hunger_ng.add_hunger_data
add('ferns:fiddlehead', { satiates = 0.5, heals = -1.5 })
add('ferns:fiddlehead_roasted', { satiates = 1.2 })
add('ferns:ferntuber_roasted', { satiates = 2.5 })

View file

@ -0,0 +1,11 @@
-- flowers (comes with Minetest Game)
--
-- Author Various Minetest Game developers and contributors
-- Forums https://forum.luanti.org/viewtopic.php?t=9724
-- VCS https://github.com/minetest/minetest_game
local add = hunger_ng.add_hunger_data
add('flowers:mushroom_brown', { satiates = 1 })
add('flowers:mushroom_red', { satiates = 1, heals = -2 })

View file

@ -0,0 +1,85 @@
-- HUD bars
--
-- Author Wuzzy
-- Forums https://forum.luanti.org/viewtopic.php?t=11153
-- VCS https://repo.or.cz/w/minetest_hudbars.git
-- Localize and Prepare
local a = hunger_ng.interoperability.attributes
local s = hunger_ng.interoperability.settings
local S = hunger_ng.interoperability.translator
local get_data = hunger_ng.interoperability.get_data
local set_data = hunger_ng.interoperability.set_data
local bar_id = 'hungernghudbar'
local hudbar_image_filters = '^[noalpha^[colorize:#c17d11ff^[resize:2x16'
local hudbar_image = s.hunger_bar.image..hudbar_image_filters
-- register the hud bar
hb.register_hudbar(
bar_id,
'0xFFFFFF',
S('Satiation'),
{
bar = hudbar_image,
icon = s.hunger_bar.image
},
s.hunger.maximum,
s.hunger.maximum,
false
)
-- Remove normal hunger bar and add hudbar version of it
core.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
local hud_id = tonumber(get_data(player_name, a.hunger_bar_id))
local current_hunger = get_data(player_name, a.hunger_value)
local hunger_ceiled = math.ceil(current_hunger)
if s.hunger_bar.use then
-- Since we dont have register_after_joinplayer() we need to delay
-- the removal of the default hunger bar because without delay this
-- results in a race condition with Hunger NGs register_on_joinplayer
-- callback that defines and sets the default hunger bar.
--
-- If for some reason the hud bar is not hidden try raising the delay
-- before the bar is hidden by adding hunger_ng_i14y_hudbars_delay to
-- your configuration and setting it to a value of your liking (the
-- value is giving in seconds and decimals are allowed).
local parameter_name = 'hunger_ng_i14y_hudbars_delay'
local delay = core.settings:get(parameter_name) or 0.5
if core.settings:get('hunger_ng_debug_mode') and delay ~= 0.5 then
local message = 'Using delay of +d to hide the hunger bar for +p.'
core.log('action', '[hungerng] '..message:gsub('%+%a+', {
['+d'] = delay..'s',
['+p'] = player_name
}))
end
core.after(delay, function () player:hud_remove(hud_id) end)
end
hb.init_hudbar(player, bar_id, hunger_ceiled, s.hunger.maximum, false)
end)
-- Globalstep for updating the hundbar version of the hunger bar without
-- any additional code outside the interoperability system.
local hudbars_timer = 0
core.register_globalstep(function(dtime)
hudbars_timer = hudbars_timer + dtime
if hudbars_timer >= 1 then
hudbars_timer = 0
for _,player in ipairs(core.get_connected_players()) do
if player ~= nil then
local playername = player:get_player_name()
local hunger = get_data(playername, a.hunger_value)
local ceiled = math.ceil(hunger)
hb.change_hudbar(player, bar_id, ceiled, s.hunger.maximum)
end
end
end
end)

View file

@ -0,0 +1,34 @@
-- Ice Cream
-- Hunger NG data for the Ice Cream mod by Dog_sl
-- https://forum.minetest.net/viewtopic.php?t=10321
local add = hunger_ng.add_hunger_data
-- Cones and Ingredients (Original item_eat: 1, 1, 4)
add('icecream:dough', { satiates = 0.25 })
add('icecream:notcone', { satiates = 0.25 }) -- Cone-shaped dough
add('icecream:cone', { satiates = 1.0 })
-- Fruit & Vegetable Ice Creams
add('icecream:apple', { satiates = 2.0 }) -- Original: 8
add('icecream:pineapple', { satiates = 1.0 }) -- Original: 4
add('icecream:banana', { satiates = 2.0 }) -- Original: 8
add('icecream:carrot', { satiates = 1.5 }) -- Original: 6
add('icecream:orange', { satiates = 2.0 }) -- Original: 8
add('icecream:watermelon', { satiates = 1.5 }) -- Original: 6
add('icecream:pumpkin', { satiates = 1.5 }) -- Original: 6
add('icecream:blueberries', { satiates = 1.5 }) -- Original: 6
add('icecream:strawberry', { satiates = 2.5 }) -- Original: 10
add('icecream:grapes', { satiates = 2.0 }) -- Original: 8
add('icecream:raspberry', { satiates = 2.0 }) -- Original: 8
add('icecream:garlic', { satiates = 1.0 }) -- Original: 4
-- Sweet & Special Ice Creams
add('icecream:chocolate', { satiates = 2.0 }) -- Original: 8
add('icecream:vanilla', { satiates = 2.5 }) -- Original: 10
add('icecream:chocolate_with_cookies', { satiates = 3.0 }) -- Original: 12
add('icecream:vanilla_with_cookies', { satiates = 3.0 }) -- Original: 12
add('icecream:mint', { satiates = 3.0 }) -- Original: 12

27
interoperability/mobs.lua Normal file
View file

@ -0,0 +1,27 @@
-- Mobs Redo Animals
--
-- Author TenPlus1
-- Forums https://forum.luanti.org/viewtopic.php?t=9917
-- VCS https://notabug.org/TenPlus1/mobs_animal
--
-- The mob mods register their stuff with the `mobs` prefix in the `mobs` mod.
local add = hunger_ng.add_hunger_data
add('mobs:cheese', { satiates = 2.5 })
add('mobs:chicken_cooked', { satiates = 5 })
add('mobs:chicken_egg_fried', { satiates = 2 })
add('mobs:chicken_raw', { satiates = 2, heals = -2 })
add('mobs:honey', { satiates = 2 })
add('mobs:meat', { satiates = 5.5 })
add('mobs:meat_raw', { satiates = 2.5, heals = -1 })
add('mobs:meatblock', { satiates = 5.5 * 9 })
add('mobs:meatblock_raw', { satiates = 2.5 * 9, heals = -1 * 9 })
add('mobs:mutton_cooked', { satiates = 6, heals = 1 })
add('mobs:mutton_raw', { satiates = 2, heals = -1 })
add('mobs:pork_cooked', { satiates = 4 })
add('mobs:pork_raw', { satiates = 1 })
add('mobs:rabbit_cooked', { satiates = 4.5 })
add('mobs:rabbit_raw', { satiates = 2, heals = -1 })
add('mobs:rat_cooked', { satiates = 1.5 })

View file

@ -0,0 +1,26 @@
-- More Trees!
--
-- Author VanessaE
-- Forums https://forum.luanti.org/viewtopic.php?t=4394
-- VCS https://gitlab.com/VanessaE/moretrees
local add = hunger_ng.add_hunger_data
-- Base items
add('moretrees:acorn', { satiates = 1, heals = -1 })
add('moretrees:cedar_nuts', { satiates = 1 })
add('moretrees:raw_coconut', { satiates = 1 })
add('moretrees:date', { satiates = 1 })
add('moretrees:fir_nuts', { satiates = 1 })
add('moretrees:spruce_nuts', { satiates = 1 })
-- Mixed base items
add('moretrees:acorn_muffin_batter', { satiates = 2, heals = -3 })
add('moretrees:date_nut_batter', { satiates = 2, heals = -3 })
-- Processed food
add('moretrees:acorn_muffin', { satiates = 2 })
add('moretrees:date_nut_bar', { satiates = 5, heals = 2 })
add('moretrees:date_nut_cake', { satiates = 5 })
add('moretrees:date_nut_snack', { satiates = 3, heals = 1 })

View file

@ -0,0 +1,12 @@
-- Waffles
-- Hunger NG data for the Waffles mod by apercy
-- https://content.minetest.net/packages/apercy/waffles/
local add = hunger_ng.add_hunger_data
-- Quarter of Waffle (Base value as requested)
add('waffles:waffle_quarter', { satiates = 0.5 })
-- Whole Waffle (Calculated as 4x the quarter)
add('waffles:waffle', { satiates = 2.0 })