runebook · rune
runebook · rune
No capabilities requested.
manifest: sha256:32493e636e29295d7610a5fc502ea2e6724d06e4fa4aba69b714002ce8fe24d8
rune add @rune/cooldowns@0.1.0rune add @rune/cooldowns
import { createCooldowns } from "@rune/cooldowns";
const abilities = createCooldowns();
const result = abilities.tryStart(playerId + ":dash", 3_000);
if (result.allowed) dash();
else if (result.reason === "cooldown") showRetry(result.retryAfterMs);
Use remaining(key) for feedback, clear(key) to release a cooldown, and
sweep() to remove expired entries. An exhausted key budget rejects new
cooldowns until space becomes available. Each instance lives in memory.