Additional timer functions

#1

Hi everyone.
It would be good to have additional timer functions, like -

  • timer.pause(handle) - pauses the current timer.
  • timer.resume(handle) - resumes the current timer.
  • timer.is_running(handle) - returns true if the current timer is running.
4 Likes

#2

As always, when we add new functions, we’d like to know actual use cases.
Sometimes there are multiple ways of doing the same thing, and each function we add adds more size to the engine.

E.g. what’s the use case for pause/resuming a timer?
For instance, when pausing an entire collection, you send the set_time_step with a value of 0.

E.g. is the is_running() really necessary? You either called cancel() (or pause()) so isn’t it enough to keep track of that yourself? I’m assuming most users won’t need this, and I think it’s perfectly reasonable for the developer to keep track of this.

7 Likes

#3

A very suitable use case would be to do time based things, which have interventions in them, like

  • A pickup system, where each pickup lasts a time t. A player picks a pickup, then goes to an NPC where some dialogues are said. It would be good that we could pause the timer there, and then show all the dialogues, and then resume it again.

  • Similarly, I cast a spell that does 10 damage to enemy each second. But after casting the spell, I want to show some cinematics, during which, the enemy should not be affected by the spell(or the spell should pause). After it is done, resume the spell damage system.

2 Likes