forked from mtcontrib/minetest_hbhunger
Use "minetest", not "core"
This commit is contained in:
parent
5305b1fc13
commit
5ada2b417c
@ -7,11 +7,11 @@ function hbhunger.load_hunger(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
|
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
|
||||||
local org_eat = core.do_item_eat
|
local org_eat = minetest.do_item_eat
|
||||||
core.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||||
local old_itemstack = itemstack
|
local old_itemstack = itemstack
|
||||||
itemstack = hbhunger.eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
itemstack = hbhunger.eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||||
for _, callback in pairs(core.registered_on_item_eats) do
|
for _, callback in pairs(minetest.registered_on_item_eats) do
|
||||||
local result = callback(hp_change, replace_with_item, itemstack, user, pointed_thing, old_itemstack)
|
local result = callback(hp_change, replace_with_item, itemstack, user, pointed_thing, old_itemstack)
|
||||||
if result then
|
if result then
|
||||||
return result
|
return result
|
||||||
@ -39,7 +39,7 @@ function hbhunger.eat(hp_change, replace_with_item, itemstack, user, pointed_thi
|
|||||||
def = {}
|
def = {}
|
||||||
if type(hp_change) ~= "number" then
|
if type(hp_change) ~= "number" then
|
||||||
hp_change = 1
|
hp_change = 1
|
||||||
core.log("error", "Wrong on_use() definition for item '" .. item .. "'")
|
minetest.log("error", "Wrong on_use() definition for item '" .. item .. "'")
|
||||||
end
|
end
|
||||||
def.saturation = hp_change * 1.3
|
def.saturation = hp_change * 1.3
|
||||||
def.replace = replace_with_item
|
def.replace = replace_with_item
|
||||||
|
Loading…
Reference in New Issue
Block a user