aboutsummaryrefslogtreecommitdiff
path: root/building_guide/state.md
blob: 2e0b5cc7772326f39df457a9a6b7e75c835556b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
## State: World vs Player

**World flags** (`set_flags`, checked with `flag`) are shared by every player on the server. A door opened by one player is open for everyone. A lever pulled once changes the world for all. Stored in memory (`FlagStore`) — **lost on server restart**. Numeric values are compared by coercion (int/int64/float64 are normalized), so a YAML-decoded `3` matches a code-set `int(3)`.

**Player flags** (`set_player_flags`, checked with `player_flag`) are per-character. Quest progress, "has read the sign," "paid the toll" — these are different for each player. Saved to the character YAML and persist across logins.

### Triggers — flag-change events

Any flag change (world or player) can activate a **trigger** — a timed sequence of
messages, broadcasts, spawns, and further flag mutations. See `triggers.md` for
the full system. This is how you turn "player looked at the sign" into "spaceship
landed and stairs opened."