mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 14:44:55 +02:00
Full Distribution
This commit is contained in:
12
data/actions/scripts/misc/food.lua
Normal file
12
data/actions/scripts/misc/food.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
function onUse(player, item, fromPosition, target, toPosition)
|
||||
local itemType = ItemType(item:getId())
|
||||
local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
|
||||
if condition and math.floor(condition:getTicks() / 1000 + (itemType:getNutrition() * 12)) >= 1200 then
|
||||
player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are full.")
|
||||
else
|
||||
player:feed(itemType:getNutrition() * 12)
|
||||
item:remove(1)
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
Reference in New Issue
Block a user