diff options
Diffstat (limited to 'internal/game/game.go')
| -rw-r--r-- | internal/game/game.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/internal/game/game.go b/internal/game/game.go index ac8622e..0dd5bdc 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -7,7 +7,6 @@ import ( "sync" "time" - "thehouseoficarus/internal/action" "thehouseoficarus/internal/combat" "thehouseoficarus/internal/config" "thehouseoficarus/internal/engine" @@ -40,7 +39,7 @@ type Game struct { ItemStore *object.ItemStore AccountStore *player.AccountStore MobStore *world.MobStore - RecipeStore *action.RecipeStore + CraftIndex *CraftIndex CourseStore *CourseStore Hub *net.Hub Ticks *engine.Engine @@ -67,7 +66,7 @@ func New(dataDir string, colorConfig *config.ColorsConfig, valConfig config.Vali ItemStore: object.NewItemStore(dataDir), AccountStore: player.NewAccountStore(dataDir), MobStore: world.NewMobStore(dataDir), - RecipeStore: action.NewRecipeStore(dataDir), + CraftIndex: NewCraftIndex(), CourseStore: NewCourseStore(dataDir), Ticks: engine.New(), WorldFlags: make(map[string]any), @@ -85,6 +84,7 @@ func New(dataDir string, colorConfig *config.ColorsConfig, valConfig config.Vali } g.CourseStore.LoadAll() g.LoadMods() + g.buildCraftIndex() g.ValidateAndLog() return g } @@ -331,6 +331,14 @@ func (g *Game) ProcessQueuedCommands() { g.flushPendingDepletions() } +func (g *Game) buildCraftIndex() { + items, err := g.ItemStore.LoadAll() + if err != nil { + return + } + g.CraftIndex.Build(items) +} + type pendingDepletion struct { instanceKey string objDefID string |
