Fixed auto-feeder

This commit is contained in:
rspx
2023-03-26 15:11:23 +02:00
committed by Kan18
parent aef1bfa186
commit a9202a7034

View File

@@ -58,9 +58,9 @@ local function getFood(food)
for slot,v in pairs(ni.getInventory().list()) do
local key = itemDB:makeKey(v)
if key == food then
local item = ni.getInventory().getItem(slot)
if item and item.consume then
return item
local item = ni.getInventory().getItemDetail(slot)
if item and item.saturation then
return slot
end
break
end
@@ -87,7 +87,7 @@ Event.onInterval(5, function()
if context.state.food and ni.getMetaOwner().food.hungry then
local item = getFood(context.state.food)
if item then
item.consume()
ni.getInventory().consume(item)
end
end
end)
@@ -101,4 +101,4 @@ return {
callback = function()
UI:setPage(page)
end,
}
}