ci/woodpecker/push/ebitengine Pipeline was successful
The engine already had the registry the game was reimplementing: inkwell.Manager[T Named], and every entity type here is an alias of an engine struct, so they all carry GetName() already. manager.manager.go and manager.interface.go are gone; a category manager is now one call to inkwell.NewManager. registerAll goes with it — Each does the hand-off — and the selector writes its derived pins back with Set, which keeps the scene in place in the registration order. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
62 lines
958 B
Go
62 lines
958 B
Go
package inc
|
|
|
|
import (
|
|
inkwell "git.teletypegames.org/engines/inkwell"
|
|
)
|
|
|
|
type Scene = inkwell.Scene
|
|
|
|
var SceneManager = inkwell.NewManager[Scene]()
|
|
|
|
func registerScene() {
|
|
fillSelectorPins()
|
|
SceneManager.Each(func(entity Scene) {
|
|
World.G.SceneManager.Register(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)
|
|
}
|
|
})
|
|
}
|