mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-14 07:01:06 +01:00
Use drinking sound for milk and soups
This commit is contained in:
parent
e3cea8ffdc
commit
c587d6316e
6 changed files with 39 additions and 26 deletions
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,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
|
||||
|
|
BIN
mods/PLAYER/mcl_hunger/sounds/survival_thirst_drink.ogg
Normal file
BIN
mods/PLAYER/mcl_hunger/sounds/survival_thirst_drink.ogg
Normal file
Binary file not shown.
Loading…
Reference in a new issue