diff --git a/CLAUDE.md b/CLAUDE.md index 77e7b18..a6816af 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -173,6 +173,24 @@ derives the selector's pins by reading the exit graph backwards. And a manager swapped in this way must be in place before `inkwell.Run`, which is where the engine wires up the parts that hold a registry directly. +### What runs at boot + +`New` names two scripts and nothing else — the opening a player sees is content +like every other script, in `script.opening.go`, not a slice built in the +wiring: + +```go +g.StartAt(start) +g.OnStart(ScriptOpening) +if o.Finale { + g.OnFinale(ScriptFinale) +} +``` + +`OnFinale` is the engine's hook for a closing script, queued straight after the +opening. Here it is what `-finale` uses to drop into the ending, which is why it +is set from `Opts` rather than always. + ## The world There is exactly one game, so there is exactly one world: `World`, a diff --git a/README.md b/README.md index 35afaf8..6802d32 100644 --- a/README.md +++ b/README.md @@ -350,8 +350,8 @@ Also: the inkwell README gives the module path as hides them; the deck wanted them struck through but visible, so the list becomes a memory of what you already tried. Needs a thin override over `DialogBox`. -- **Only beat 3 exists.** The alley is a vertical slice; `bootOpening` sets the - police-tip flag that beat 2 will eventually set. +- **Only beat 3 exists.** The alley is a vertical slice; the opening script sets + the police-tip flag that beat 2 will eventually set. - **The render has only been inspected once, by the author of this repo.** Geometry is derived from one font cell and one screen size, but this environment cannot take a screenshot (both synthetic keystrokes and screen diff --git a/go.mod b/go.mod index 72c9829..7fa8040 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.teletypegames.org/games/realworld go 1.26.3 require ( - git.teletypegames.org/engines/inkwell v0.1.1-0.20260830083613-39af65f3c98f + git.teletypegames.org/engines/inkwell v0.1.1-0.20260830092549-e26f7345c14d github.com/hajimehoshi/ebiten/v2 v2.9.9 ) diff --git a/go.sum b/go.sum index 53c423c..fb3f8f1 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -git.teletypegames.org/engines/inkwell v0.1.1-0.20260830083613-39af65f3c98f h1:Qw/sUeJeCBEFvdiqwGUn919hsmoTILJyKSPlkKvNgh0= -git.teletypegames.org/engines/inkwell v0.1.1-0.20260830083613-39af65f3c98f/go.mod h1:/v6QtismTE8+e7kobbVR5B/CpTSrd4j2DYwJ8DvINhs= +git.teletypegames.org/engines/inkwell v0.1.1-0.20260830092549-e26f7345c14d h1:4AGtmrWwfnHkJvZ90on1+9bUmZOGSrcIG4KaJFiy+xo= +git.teletypegames.org/engines/inkwell v0.1.1-0.20260830092549-e26f7345c14d/go.mod h1:/v6QtismTE8+e7kobbVR5B/CpTSrd4j2DYwJ8DvINhs= github.com/ebitengine/gomobile v0.0.0-20250923094054-ea854a63cce1 h1:+kz5iTT3L7uU+VhlMfTb8hHcxLO3TlaELlX8wa4XjA0= github.com/ebitengine/gomobile v0.0.0-20250923094054-ea854a63cce1/go.mod h1:lKJoeixeJwnFmYsBny4vvCJGVFc3aYDalhuDsfZzWHI= github.com/ebitengine/hideconsole v1.0.0 h1:5J4U0kXF+pv/DhiXt5/lTz0eO5ogJ1iXb8Yj1yReDqE= diff --git a/inc/boot.go b/inc/boot.go index 3355a1e..c807b2f 100644 --- a/inc/boot.go +++ b/inc/boot.go @@ -50,18 +50,9 @@ func New(o Opts) *inkwell.Game { registerUI() g.StartAt(start) - g.OnStart(inkwell.Seq(bootOpening(start, o.Finale)...)) + g.OnStart(ScriptOpening) + if o.Finale { + g.OnFinale(ScriptFinale) + } return g } - -func bootOpening(start string, finale bool) []inkwell.Action { - acts := []inkwell.Action{ - inkwell.SetFlag(FlagPoliceTip), - inkwell.Say(Paul, "Back alley. Just like the clerk said."), - TapeSay(Dex, "A government office tipped you off to remove something from a scene. That doesn't strike you as odd?"), - } - if finale { - acts = append(acts, inkwell.RunScript(ScriptFinale)) - } - return acts -} diff --git a/inc/names.manager.go b/inc/names.manager.go index 31d1bfc..82f8cd9 100644 --- a/inc/names.manager.go +++ b/inc/names.manager.go @@ -20,6 +20,7 @@ const ( ) const ( + ScriptOpening = "opening" ScriptTapeInsert = "tape_insert" ScriptFinale = "awakening_finale" ) diff --git a/inc/script.opening.go b/inc/script.opening.go new file mode 100644 index 0000000..c5cb33d --- /dev/null +++ b/inc/script.opening.go @@ -0,0 +1,16 @@ +package inc + +import ( + inkwell "git.teletypegames.org/engines/inkwell" +) + +func init() { + ScriptManager.Register(Script{ + Name: ScriptOpening, + Actions: inkwell.Seq( + inkwell.SetFlag(FlagPoliceTip), + inkwell.Say(Paul, "Back alley. Just like the clerk said."), + TapeSay(Dex, "A government office tipped you off to remove something from a scene. That doesn't strike you as odd?"), + ), + }) +}