nth tick should only be used to do small updates.psihius wrote: Thu Feb 21, 2019 7:17 am You can also use `on_nth_tick` event instead of doing division in the `if` statement every tick
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