ci/woodpecker/push/ebitengine Pipeline was successful
bootOpening built its actions in boot.go and appended the finale by hand, which made the one thing a player sees first the only content not authored as content. inkwell's OnStart takes a script name now, so the opening moves to script.opening.go and boot names it. The -finale flag becomes OnFinale, the engine's hook for a closing script queued after the start one, so the branch is a hook rather than a slice append. bootOpening's start parameter had been dead for a while; it goes with the function. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
package inc
|
|
|
|
import (
|
|
inkwell "git.teletypegames.org/engines/inkwell"
|
|
)
|
|
|
|
var (
|
|
BackgroundManager = inkwell.NewManager[Background]()
|
|
CharacterManager = inkwell.NewManager[Character]()
|
|
DialogManager = inkwell.NewManager[Dialog]()
|
|
ItemManager = inkwell.NewManager[Item]()
|
|
SceneManager = inkwell.NewManager[Scene]()
|
|
ScriptManager = inkwell.NewManager[Script]()
|
|
ThemeManager = inkwell.NewManager[Theme]()
|
|
)
|
|
|
|
type Opts struct {
|
|
Scene string
|
|
Finale bool
|
|
}
|
|
|
|
func New(o Opts) *inkwell.Game {
|
|
start := o.Scene
|
|
if start == "" {
|
|
start = SceneAlley
|
|
}
|
|
|
|
prepareScene()
|
|
|
|
g := inkwell.NewGame("Real World", ScreenW, ScreenH)
|
|
g.MaxLogLines = 64
|
|
g.SceneRect = inkwell.Rect(0, TopBarH, ScreenW, HUDTop-TopBarH)
|
|
g.ExitLook = func(e inkwell.Exit) inkwell.Action {
|
|
return inkwell.Say(Paul, "That way: "+e.Label+".")
|
|
}
|
|
g.ExitTake = func(inkwell.Exit) inkwell.Action {
|
|
return inkwell.Say(Paul, "It's a way out, not a thing.")
|
|
}
|
|
|
|
g.AssetManager = BackgroundManager
|
|
g.CharacterManager = CharacterManager
|
|
g.DialogueManager = DialogManager
|
|
g.ItemManager = ItemManager
|
|
g.SceneManager = SceneManager
|
|
g.ScriptManager = ScriptManager
|
|
ThemeManager.Each(g.ThemeManager.Register)
|
|
|
|
World.attach(g)
|
|
g.UseTheme(RealWorld)
|
|
registerUI()
|
|
|
|
g.StartAt(start)
|
|
g.OnStart(ScriptOpening)
|
|
if o.Finale {
|
|
g.OnFinale(ScriptFinale)
|
|
}
|
|
return g
|
|
}
|