nth tick should only be used to do small updates.
inventory manipulation is a quite performance hungry task and should be spread across multiple ticks to prevent microstutters.
Code: Select all
function OnTick(event)
local offset = event.tick % UpdateInterval
for i=#global.Entities - offset, 1, -1 * UpdateInterval do
local entity = global.Entities[i]
-- do entity update
end
end