forked from MineClone5/MineClone5
Use drinking sound for milk and soups
This commit is contained in:
parent
e3cea8ffdc
commit
c587d6316e
2
API.md
2
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
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -78,11 +78,22 @@ 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)
|
||||
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,
|
||||
|
@ -102,9 +113,10 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
|
|||
})
|
||||
minetest.sound_play("mcl_hunger_bite", {
|
||||
pos = pos,
|
||||
max_hear_distance = 8,
|
||||
gain = 10.0,
|
||||
max_hear_distance = 12,
|
||||
gain = 1.0,
|
||||
})
|
||||
end
|
||||
|
||||
-- Saturation
|
||||
if h < 20 and hunger_change then
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue