mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-18 16:20:38 +01:00
Solved on_use bug with strange on_item_eat behavior
- Removed the sound on_item_eat call so that hunger's function will be called
This commit is contained in:
parent
b494d7b990
commit
c4ff82dae4
@ -91,7 +91,7 @@ minetest.register_on_respawnplayer(function(player)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||||
if user:get_hp() >= 20 then return itemstack end
|
if user:get_hp() >= 20 then return end
|
||||||
local pos = user:getpos()
|
local pos = user:getpos()
|
||||||
minetest.sound_play("health_gain", {pos = pos, gain = 0.4})
|
minetest.sound_play("health_gain", {pos = pos, gain = 0.4})
|
||||||
end)
|
end)
|
||||||
|
@ -169,11 +169,6 @@ function hunger.register_food(name, hunger_change, replace_with_item, poisen, he
|
|||||||
food[name].poisen = poisen -- time its poisening
|
food[name].poisen = poisen -- time its poisening
|
||||||
food[name].healing = heal -- amount of HP
|
food[name].healing = heal -- amount of HP
|
||||||
food[name].sound = sound -- special sound that is played when eating
|
food[name].sound = sound -- special sound that is played when eating
|
||||||
-- copied overwrite
|
|
||||||
local def = minetest.registered_items[name]
|
|
||||||
if not def then return end
|
|
||||||
def.on_use = hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound)
|
|
||||||
minetest.registered_items[name] = def
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Poison player
|
-- Poison player
|
||||||
|
Loading…
Reference in New Issue
Block a user