- Fabric
- Working
- NeoForge
- Working
This library will allow you to dynamically implement timers that don't need infinite amount of variables to track, you can toggle whether or not a delay should tick, get all the delays you made, tick them one at a time or all at the same time, basically a happy thing, usage is mostly as follows
and in case you lost track at some point (which shouldn't really happen)
you can get the list of all delays and their data via
returns a table [{"name", delay:{datahere}}...]
LUA:
local dm = require("delaymanager")
dm.add("attack", 8) -- create a delay for 8 tick units
dm.setDelay("attack", 10) -- update the delay to 10 tick units
dm.toggle("attack") -- switch the delay off, tick value persists and will start decreasing once back on
local attackActive = dm.isActive("attack") -- will return false because we toggled it
dm.toggle("attack") -- switch the delay on
-- if the delay is toggled off dm.ready() will always return false regardless of ready state
if dm.ready("attack") then print("attacked!") end -- will print out attacked! and make curtick 10
dm.update() -- will update ALL active delays and tick them down if they are not ready
dm.update("attack") -- will only update the "attack" delay if it is active
dm.remove("attack") -- remove the delay we created
and in case you lost track at some point (which shouldn't really happen)
you can get the list of all delays and their data via
LUA:
dm.getAll()