diff --git a/API.md b/API.md index fd88aa34..c1eb2894 100644 --- a/API.md +++ b/API.md @@ -81,7 +81,7 @@ These groups are used mostly for informational purposes * `minecart=1`: Minecart * `food`: Item is a comestible item which can be consumed (healthy or unhealthy) * `food=2`: Food - * `food=3`: Drink + * `food=3`: Drink (including soups) * `food=1`: Other/unsure * `eatable`: Item can be *directly* eaten by wielding + left click (`on_use=item_eat`). Rating is the satiation gain * `ammo=1`: Item is used as ammo for a weapon diff --git a/mods/ITEMS/mcl_farming/beetroot.lua b/mods/ITEMS/mcl_farming/beetroot.lua index 06702bad..f1a20037 100644 --- a/mods/ITEMS/mcl_farming/beetroot.lua +++ b/mods/ITEMS/mcl_farming/beetroot.lua @@ -102,7 +102,7 @@ minetest.register_craftitem("mcl_farming:beetroot_soup", { inventory_image = "mcl_farming_beetroot_soup.png", wield_image = "mcl_farming_beetroot_soup.png", on_use = minetest.item_eat(6, "mcl_core:bowl"), - groups = { food = 1, eatable = 6 }, + groups = { food = 3, eatable = 6 }, }) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_farming/mushrooms.lua b/mods/ITEMS/mcl_farming/mushrooms.lua index 8cb12044..0dc4f525 100644 --- a/mods/ITEMS/mcl_farming/mushrooms.lua +++ b/mods/ITEMS/mcl_farming/mushrooms.lua @@ -37,7 +37,7 @@ minetest.register_craftitem("mcl_farming:mushroom_stew", { description = "Mushroom Stew", inventory_image = "farming_mushroom_stew.png", on_use = minetest.item_eat(6, "mcl_core:bowl"), - groups = { food = 2, eatable = 6 }, + groups = { food = 3, eatable = 6 }, stack_max = 1, }) diff --git a/mods/PLAYER/mcl_hunger/README.md b/mods/PLAYER/mcl_hunger/README.md index 2e6b3dfd..47a7fce8 100644 --- a/mods/PLAYER/mcl_hunger/README.md +++ b/mods/PLAYER/mcl_hunger/README.md @@ -49,5 +49,6 @@ This mod is free software. * `hbhunger_bar.png—Wuzzy` (WTFPL) * `hbhunger_icon_health_poison.png`—celeron55 ([CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/)), modified by BlockMen, modified again by Wuzzy * `mcl_hunger_bite.1.ogg`, `mcl_hungr_bite.2.ogg`: WTFPL +* `survival_thirst_drink.ogg`: WTFPL * Everything else: WTFPL, by BlockMen and Wuzzy diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index 4b7abb25..ed2556d2 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -78,33 +78,45 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou local h = tonumber(mcl_hunger.hunger[name]) local hp = user:get_hp() - -- Add eat particle effect and sound local pos = user:getpos() pos.y = pos.y + item_drop_settings.player_collect_height local texture = minetest.registered_items[itemname].inventory_image + -- FIXME: Is this correct? o_O minetest.add_item(pos, drop) - minetest.add_particlespawner({ - amount = 20, - time = 0.1, - minpos = {x=pos.x, y=pos.y, z=pos.z}, - maxpos = {x=pos.x, y=pos.y, z=pos.z}, - minvel = {x=-1, y=1, z=-1}, - maxvel = {x=1, y=2, z=1}, - minacc = {x=0, y=-5, z=0}, - maxacc = {x=0, y=-9, z=0}, - minexptime = 1, - maxexptime = 1, - minsize = 1, - maxsize = 2, - collisiondetection = true, - vertical = false, - texture = texture, - }) - minetest.sound_play("mcl_hunger_bite", { - pos = pos, - max_hear_distance = 8, - gain = 10.0, - }) + local foodtype = minetest.get_item_group(itemname, "food") + if foodtype == 3 then + -- Item is a drink, only play drinking sound (no particle) + minetest.sound_play("survival_thirst_drink", { + pos = pos, + max_hear_distance = 12, + gain = 1.0, + }) + else + -- Assume the item is a food + -- Add eat particle effect and sound + minetest.add_particlespawner({ + amount = 20, + time = 0.1, + minpos = {x=pos.x, y=pos.y, z=pos.z}, + maxpos = {x=pos.x, y=pos.y, z=pos.z}, + minvel = {x=-1, y=1, z=-1}, + maxvel = {x=1, y=2, z=1}, + minacc = {x=0, y=-5, z=0}, + maxacc = {x=0, y=-9, z=0}, + minexptime = 1, + maxexptime = 1, + minsize = 1, + maxsize = 2, + collisiondetection = true, + vertical = false, + texture = texture, + }) + minetest.sound_play("mcl_hunger_bite", { + pos = pos, + max_hear_distance = 12, + gain = 1.0, + }) + end -- Saturation if h < 20 and hunger_change then diff --git a/mods/PLAYER/mcl_hunger/sounds/survival_thirst_drink.ogg b/mods/PLAYER/mcl_hunger/sounds/survival_thirst_drink.ogg new file mode 100644 index 00000000..8a97dfff Binary files /dev/null and b/mods/PLAYER/mcl_hunger/sounds/survival_thirst_drink.ogg differ