Skip to content
Permalink
Browse files

Add eat sound (#7956)

  • Loading branch information...
Wuzzy2 authored and nerzhul committed Dec 10, 2018
1 parent 98a72b9 commit 5560ec8178053b27adac6f277f539975d46267b8
Showing with 6 additions and 0 deletions.
  1. +5 −0 builtin/game/item.lua
  2. +1 −0 doc/lua_api.txt
@@ -469,6 +469,11 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
if itemstack:take_item() ~= nil then
user:set_hp(user:get_hp() + hp_change)

local def = itemstack:get_definition()
if def and def.sound and def.sound.eat then
minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 })
end

if replace_with_item then
if itemstack:is_empty() then
itemstack:add_item(replace_with_item)
@@ -5795,6 +5795,7 @@ Used by `minetest.register_node`, `minetest.register_craftitem`, and
sound = {
breaks = "default_tool_break", -- tools only
place = <SimpleSoundSpec>,
eat = <SimpleSoundSpec>,
},

on_place = func(itemstack, placer, pointed_thing),

0 comments on commit 5560ec8

Please sign in to comment.
You can’t perform that action at this time.