local exhaustStorage = 19874
local maxItemsPerSecond = 1
local exhaustTime = 0.5 -- Total exhaust time of 0.5 seconds
local lastMoveTime = 0
local itemsMoved = 0
local tile = Tile(fromCylinder:getPosition())
if tile then
local topCreature = tile:getTopCreature()
if topCreature and topCreature:isPlayer() then
local targetPlayer = topCreature:getPlayer()
local currentTime = os.time()
if currentTime > lastMoveTime + exhaustTime then
lastMoveTime = currentTime
itemsMoved = 1
else
itemsMoved = itemsMoved + 1
if itemsMoved > maxItemsPerSecond then
targetPlayer:setStorageValue(exhaustStorage, lastMoveTime + exhaustTime)
return false
end
end
if targetPlayer:getStorageValue(exhaustStorage) > currentTime then
return false
end
end
end