mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Typo correction of OnDemandHandler.md
Small Typo - registes to registers
This commit is contained in:
parent
6307213245
commit
96702e948c
1 changed files with 2 additions and 2 deletions
|
|
@ -11,7 +11,7 @@ Now, you _could_ use `utils.delay` to track each phase, or use the [TickerHandle
|
|||
This will work fine, but if no one comes back to that room, that's a lot of updating that no one will see. While maybe not a big deal for a single player, what if you have flowers in thousands of rooms, all growing indepedently? Or some even more complex system requiring calculation on every state change. You should avoid spending computing on things that bring nothing extra to your player base.
|
||||
|
||||
Using the The on-demand style would instead work like this for the flower:
|
||||
1. When the player plants the seed, we register a new on-demand task with the `OnDemandHandler` (described below). This registes _the current timestamp_ when the plant starts to grow.
|
||||
1. When the player plants the seed, we register a new on-demand task with the `OnDemandHandler` (described below). This registers _the current timestamp_ when the plant starts to grow.
|
||||
2. When a player enters the room and/or looks at the plant, _then_ (and only then) we call the `OnDemandHandler` to see what state the flower it's in. It will then use the _current time_ to figure out how much time passed and which state the plant is thus in. Until someone looks, the plant is in its previous found state, because no-one needed to know until then. Same thing, if some other system needs to know this - they just figure out the state on the fly.
|
||||
|
||||
## A blooming flower using the OnDemandHandler
|
||||
|
|
@ -171,4 +171,4 @@ before reversing and go back:
|
|||
|
||||
Over and over. The `OnDemandTask` instance has an `.iterations` property that will step up by one every time the sequence reverses.
|
||||
|
||||
If the state is not checked for a long time, the bounce function will correctly update the `.iterations` property to the amount of iterations it would have done in that time, and figure out where in the cycle it must be right now.
|
||||
If the state is not checked for a long time, the bounce function will correctly update the `.iterations` property to the amount of iterations it would have done in that time, and figure out where in the cycle it must be right now.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue