aboutsummaryrefslogtreecommitdiff
path: root/internal/game/game.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-20 23:43:35 -0400
committerhistoria <[not public]>2026-06-20 23:43:35 -0400
commit470bc5bd99b793e46305310b5fbeb3068eba45f1 (patch)
treeff268fab1a8e7699cd6404e6e86c2d4bd1c6f2f6 /internal/game/game.go
parent010fa439399581391fcd509d2058191ff4fa74b3 (diff)
downloadthehouseoficarus-470bc5bd99b793e46305310b5fbeb3068eba45f1.tar.gz
refactor: removed separate crafting recipes and combined them into item YAML
Diffstat (limited to 'internal/game/game.go')
-rw-r--r--internal/game/game.go14
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