laife.web.snapshot
¶
The world as JSON: what GET /state returns.
Classes:
-
HistoryView–One action a player took on its mission, and what came of it.
-
PlayerView–What a client sees of a player.
-
UtensilView–One utensil in a player's inventory.
-
WorldSnapshot–The whole world at one moment.
Functions:
-
take_snapshot–Return the world held by runner, stamped with event number seq.
Attributes:
-
HISTORY_SHOWN–How many of a player's latest history entries a snapshot carries.
HISTORY_SHOWN
module-attribute
¶
How many of a player's latest history entries a snapshot carries.
HistoryView
¶
Bases: BaseModel
One action a player took on its mission, and what came of it.
action is the action's own fields; action_type is its class name,
as the action log event writes it.
PlayerView
¶
Bases: BaseModel
What a client sees of a player.
Methods:
-
from_player–Build the view of player, with its latest
HISTORY_SHOWNhistory entries.
from_player
classmethod
¶
Build the view of player, with its latest HISTORY_SHOWN history entries.
Source code in src/laife/web/snapshot.py
UtensilView
¶
Bases: BaseModel
One utensil in a player's inventory.
WorldSnapshot
¶
Bases: BaseModel
The whole world at one moment.
seq is the number of the last event published before the snapshot was
taken; a client drops streamed events at or below it. paused is
None when the run has no pause control.
take_snapshot
¶
Return the world held by runner, stamped with event number seq.