aboutsummaryrefslogtreecommitdiff
path: root/building_guide/tick_order.md
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 05:31:09 -0400
committerhistoria <[not public]>2026-09-18 05:31:09 -0400
commit153acb7f644d755c45533b7c5311e3ffa47e8973 (patch)
tree7645e6f7b65bc3830b078e3b9336d2e6b199d584 /building_guide/tick_order.md
parent87d08f0151e643951769e323995f1c5ed89ee200 (diff)
downloadthehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'building_guide/tick_order.md')
-rw-r--r--building_guide/tick_order.md23
1 files changed, 12 insertions, 11 deletions
diff --git a/building_guide/tick_order.md b/building_guide/tick_order.md
index b4d1f1e..b1246dd 100644
--- a/building_guide/tick_order.md
+++ b/building_guide/tick_order.md
@@ -107,9 +107,10 @@ stores initialized (`World`, `MobStore`, `Hub`, `queue`, etc. via
- Systems that touch the hub: guard with `if g.Hub == nil { return }` at the
top, *or* guard each `Hub.*` call with `if g.Hub != nil`. Either is fine.
- (Note: `Ticks.Start` runs *before* `SetHub` in `main.go`, so the master
- subscriber can fire with `Hub == nil` during startup — guards are not
- optional.)
+ (`main.go` now calls `SetHub` *before* `Ticks.Start`, so the production
+ server never ticks with a nil hub; the guards are belt-and-braces for a
+ `*Game` that tests construct without `SetHub`, such as
+ `newRunTickSystemsTestGame`.)
- Systems that iterate over maps/slices held on `*Game` (`sequences`,
`restTimers`, `guardWatchTimers`, `hackingStates`, …) must tolerate empty
/ freshly-initialized maps. `game.New` initializes all of them; tests that
@@ -126,16 +127,16 @@ When writing content that depends on per-tick ordering (a trigger that
should fire *after* regen, a sequence whose step messages should appear
*before* the move completes, etc.), consult the table above and remember:
-- `MoveTick` (step 2) runs before `SequenceTick` (step 3) — the table
+- `MoveTick` (table #3) runs before `SequenceTick` (table #4) — the table
fires top-to-bottom, so a move that completes this tick will have its
- enter-room knock-on triggers fire (inside step 1 or step 2) before
- trigger `sequences` advance in step 3.
+ enter-room knock-on triggers fire (inside `ProcessQueuedCommands`, #1, or
+ `MoveTick`, #3) before trigger `sequences` advance in #4.
- `on_enter` / `on_exit` room triggers fire from command execution, not
- from a per-tick system; they run inside `ProcessQueuedCommands` (step 1)
- or `MoveTick` (step 2) when the move actually completes.
-- Shop restock (step 6) happens *before* `RegenTick` (step 7) and *before*
- `AdvanceActions` (step 13); if a gathering action completes this tick
- it does so in step 13, by which point shop state for this tick has
+ from a per-tick system; they run inside `ProcessQueuedCommands` (#1)
+ or `MoveTick` (#3) when the move actually completes.
+- Shop restock (`MobStore.Tick`, #7) happens *before* `RegenTick` (#8) and
+ *before* `AdvanceActions` (#14); if a gathering action completes this tick
+ it does so in #14, by which point shop state for this tick has
already advanced.
When in doubt, the test in `tick_systems_test.go` is the executable