Use *_meta instead of *_attribute
This commit is contained in:
parent
81a041f067
commit
5ae958a396
4
init.lua
4
init.lua
@ -1,7 +1,7 @@
|
||||
local EATING_DELAY = 5 -- time in seconds player must wait before being allowed to eat again
|
||||
|
||||
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||
local last_eat_time = user:get_attribute("last_eat_time")
|
||||
local last_eat_time = user:get_meta():get_int("last_eat_time")
|
||||
local can_eat = true
|
||||
if last_eat_time ~= nil then
|
||||
last_eat_time = tonumber(last_eat_time)
|
||||
@ -13,7 +13,7 @@ minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack,
|
||||
end
|
||||
end
|
||||
if can_eat then
|
||||
user:set_attribute("last_eat_time", minetest.get_gametime())
|
||||
user:get_meta():set_int("last_eat_time", minetest.get_gametime())
|
||||
local def = itemstack:get_definition()
|
||||
local eat_sound
|
||||
if def.sounds and def.sounds.eat then
|
||||
|
Loading…
x
Reference in New Issue
Block a user