ci/woodpecker/push/ebitengine Pipeline was successful
boot.manager.go becomes boot.go and carries all seven managers as one block, so what the game holds reads in one place instead of a line hidden in each category file. The category files keep their entity alias. The hand-off stops copying. Our managers are the same *inkwell.Manager[T] the Game holds, so New assigns them onto it and engine and game share one registry per category. content.manager.go is gone with the copy loop. Themes stay additive — NewGame seeds four presets we would otherwise throw away — and registerScene becomes prepareScene, which now has to run before the hand-off: with no copy pass left, the scene defaults are written back into SceneManager with Set. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
60 lines
900 B
Go
60 lines
900 B
Go
package inc
|
|
|
|
import (
|
|
inkwell "git.teletypegames.org/engines/inkwell"
|
|
)
|
|
|
|
type Scene = inkwell.Scene
|
|
|
|
func prepareScene() {
|
|
fillSelectorPins()
|
|
for _, entity := range SceneManager.All() {
|
|
SceneManager.Set(sceneDefaults(entity))
|
|
}
|
|
}
|
|
|
|
var sceneFloor = []inkwell.Polygon{
|
|
inkwell.Poly(
|
|
inkwell.Point{
|
|
X: 16,
|
|
Y: 196,
|
|
}, inkwell.Point{
|
|
X: 624,
|
|
Y: 196,
|
|
},
|
|
inkwell.Point{
|
|
X: 624,
|
|
Y: 258,
|
|
}, inkwell.Point{
|
|
X: 16,
|
|
Y: 258,
|
|
},
|
|
),
|
|
}
|
|
|
|
func sceneDefaults(s Scene) Scene {
|
|
if s.Actors == nil {
|
|
s.Actors = []inkwell.SceneActor{
|
|
{
|
|
CharacterName: Paul,
|
|
At: inkwell.Point{
|
|
X: 320,
|
|
Y: 232,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
if s.Walkboxes == nil {
|
|
s.Walkboxes = sceneFloor
|
|
}
|
|
return s
|
|
}
|
|
|
|
func setVarIfEmpty(name string, v any) inkwell.Action {
|
|
return Fn(func(ctx *inkwell.Ctx) {
|
|
if ctx.Game.State.Var(name) == nil {
|
|
ctx.Game.State.SetVar(name, v)
|
|
}
|
|
})
|
|
}
|