there's a query for that
This commit is contained in:
parent
ba3994a97e
commit
ed1f4deddf
1 changed files with 6 additions and 7 deletions
|
@ -132,7 +132,7 @@ func walk(c interface{}, p []interface{}, v func(interface{}, []interface{}) err
|
||||||
// builds the component databases and then calls Prepare on every Preparer.
|
// builds the component databases and then calls Prepare on every Preparer.
|
||||||
// LoadAndPrepare must be called before any calls to Component or Query.
|
// LoadAndPrepare must be called before any calls to Component or Query.
|
||||||
func (g *Game) LoadAndPrepare(assets fs.FS) error {
|
func (g *Game) LoadAndPrepare(assets fs.FS) error {
|
||||||
// Load all the Loaders
|
// Load all the Loaders.
|
||||||
if err := Walk(g, func(c interface{}, _ []interface{}) error {
|
if err := Walk(g, func(c interface{}, _ []interface{}) error {
|
||||||
l, ok := c.(Loader)
|
l, ok := c.(Loader)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -153,11 +153,10 @@ func (g *Game) LoadAndPrepare(assets fs.FS) error {
|
||||||
g.dbmu.Unlock()
|
g.dbmu.Unlock()
|
||||||
|
|
||||||
// Prepare all the Preppers
|
// Prepare all the Preppers
|
||||||
return Walk(g, func(c interface{}, _ []interface{}) error {
|
for _, p := range g.Query(g, PrepperType) {
|
||||||
p, ok := c.(Prepper)
|
if err := p.(Prepper).Prepare(g); err != nil {
|
||||||
if !ok {
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return p.Prepare(g)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue