Disable builtin hunger and use default minetest.do_item_eat if
* adapted the PR https://github.com/MultiCraft/MultiCraft/pull/172
do not remove but disable by default any refernce and only use it
if enable explicit
* adapted commit 0a54481b29
This commit is contained in:
parent
cd18cab6d3
commit
c047d31989
@ -589,14 +589,10 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
|
|||||||
pos = pos,
|
pos = pos,
|
||||||
max_hear_distance = 16
|
max_hear_distance = 16
|
||||||
}, true)
|
}, true)
|
||||||
else
|
|
||||||
core.sound_play("player_eat", {
|
|
||||||
pos = pos,
|
|
||||||
max_hear_distance = 16,
|
|
||||||
gain = 0.3
|
|
||||||
}, true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if enable_hunger then
|
||||||
|
|
||||||
local dir = user:get_look_dir()
|
local dir = user:get_look_dir()
|
||||||
local ppos = {x = pos.x, y = pos.y + 1.3, z = pos.z}
|
local ppos = {x = pos.x, y = pos.y + 1.3, z = pos.z}
|
||||||
core.add_particlespawner({
|
core.add_particlespawner({
|
||||||
@ -616,6 +612,8 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
|
|||||||
texture = def.inventory_image
|
texture = def.inventory_image
|
||||||
})
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
if replace_with_item then
|
if replace_with_item then
|
||||||
if itemstack:is_empty() then
|
if itemstack:is_empty() then
|
||||||
itemstack:add_item(replace_with_item)
|
itemstack:add_item(replace_with_item)
|
||||||
@ -625,7 +623,9 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
|
|||||||
if inv and inv:room_for_item("main", {name=replace_with_item}) then
|
if inv and inv:room_for_item("main", {name=replace_with_item}) then
|
||||||
inv:add_item("main", replace_with_item)
|
inv:add_item("main", replace_with_item)
|
||||||
else
|
else
|
||||||
pos.y = pos.y + 0.5
|
local pos = user:get_pos()
|
||||||
|
if not core.is_valid_pos(pos) then return end
|
||||||
|
pos.y = floor(pos.y + 0.5)
|
||||||
core.add_item(pos, replace_with_item)
|
core.add_item(pos, replace_with_item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -641,8 +641,11 @@ function core.item_eat(hp_change, replace_with_item, poison)
|
|||||||
pointed_thing.ref:right_click(user)
|
pointed_thing.ref:right_click(user)
|
||||||
return user:get_wielded_item()
|
return user:get_wielded_item()
|
||||||
end
|
end
|
||||||
|
if enable_hunger then
|
||||||
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing, poison)
|
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing, poison)
|
||||||
|
else
|
||||||
|
return core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user