diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 5a6ece86b..02311c8d1 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -173,40 +173,6 @@ function minetest.item_drop(itemstack, dropper, pos) end end ---add food particles -function core.item_eat(hp_change, replace_with_item) - return function(itemstack, user, pointed_thing) -- closure - local pos = user:getpos() - pos.y = pos.y + item_drop_settings.player_collect_height - local itemname = itemstack:get_name() - local texture = minetest.registered_items[itemname].inventory_image - 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("bite_item_drop", { - pos = pos, - max_hear_distance = 100, - gain = 10.0, - }) - return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing) - end -end - --modify builtin:item local time_to_live = tonumber(core.setting_get("item_entity_ttl")) diff --git a/mods/PLAYER/mcl_hunger/README.md b/mods/PLAYER/mcl_hunger/README.md index 03ca9c1dd..d015ac40b 100644 --- a/mods/PLAYER/mcl_hunger/README.md +++ b/mods/PLAYER/mcl_hunger/README.md @@ -42,11 +42,12 @@ This mod is free software. * Forked from `hbhunger` for MineClone 2. `hbhunger` in turn was forked from the “Better HUD (and hunger)” mod by BlockMen (2013-2015), most code comes from this mod. -### Textures +### Textures and sounds * `hbhunger_icon.png`—PilzAdam ([WTFPL](http://www.wtfpl.net/txt/copying/)), modified by BlockMen * `hbhunger_bgicon.png`—PilzAdam (WTFPL), modified by BlockMen * `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 +* `bite_item_drop.1.ogg`, `bite_item_drop.2.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 b02b02650..9dd336d82 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -72,11 +72,39 @@ end function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound) return function(itemstack, user, pointed_thing) + local itemname = itemstack:get_name() if itemstack:take_item() ~= nil and user ~= nil then local name = user:get_player_name() local h = tonumber(mcl_hunger.hunger[name]) local hp = user:get_hp() - minetest.sound_play({name = sound or "mcl_hunger_eat_generic", gain = 1}, {pos=user:getpos(), max_hear_distance = 16}) + + -- 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 + 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("bite_item_drop", { + pos = pos, + max_hear_distance = 8, + gain = 10.0, + }) -- Saturation if h < 20 and hunger_change then diff --git a/mods/PLAYER/mcl_hunger/sounds/bite_item_drop.1.ogg b/mods/PLAYER/mcl_hunger/sounds/bite_item_drop.1.ogg new file mode 100644 index 000000000..065ba06c1 Binary files /dev/null and b/mods/PLAYER/mcl_hunger/sounds/bite_item_drop.1.ogg differ diff --git a/mods/PLAYER/mcl_hunger/sounds/bite_item_drop.2.ogg b/mods/PLAYER/mcl_hunger/sounds/bite_item_drop.2.ogg new file mode 100644 index 000000000..51a3a90e9 Binary files /dev/null and b/mods/PLAYER/mcl_hunger/sounds/bite_item_drop.2.ogg differ diff --git a/mods/PLAYER/mcl_hunger/sounds/hbhunger_eat_generic.ogg b/mods/PLAYER/mcl_hunger/sounds/hbhunger_eat_generic.ogg deleted file mode 100644 index b6acd0784..000000000 Binary files a/mods/PLAYER/mcl_hunger/sounds/hbhunger_eat_generic.ogg and /dev/null differ