aboutsummaryrefslogtreecommitdiff
path: root/internal/game/production_engine.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-01 03:21:52 -0400
committerhistoria <[not public]>2026-07-01 03:21:52 -0400
commitfbe5090ac3325ff8ea6989cdf4515c7f077c975b (patch)
tree1811ad9c6a596e7177bb2c42944c389c0a120066 /internal/game/production_engine.go
parent5f37dc9b6f6b79da04da70ae0c33ec8d02998587 (diff)
downloadthehouseoficarus-fbe5090ac3325ff8ea6989cdf4515c7f077c975b.tar.gz
feat: item messaging standardized, custom messages for production paths implemented
Diffstat (limited to 'internal/game/production_engine.go')
-rw-r--r--internal/game/production_engine.go31
1 files changed, 10 insertions, 21 deletions
diff --git a/internal/game/production_engine.go b/internal/game/production_engine.go
index 048e152..1d54714 100644
--- a/internal/game/production_engine.go
+++ b/internal/game/production_engine.go
@@ -113,8 +113,8 @@ func (g *Game) startProduction(sess *net.Session, p *player.Player, item *item.I
ItemID: item.ID,
Phase: 0,
Wait: wait,
- StartMsg: startMsg,
- EndMsg: endMsg,
+ StartMessage: startMsg,
+ EndMessage: endMsg,
Remaining: count,
},
WaitLeft: engine.ToTicks(1),
@@ -129,6 +129,11 @@ func (g *Game) startProductionFromItem(sess *net.Session, p *player.Player, item
return
}
+ if craft.Type == "combine" {
+ g.startCombine(sess, p, item, craft, count)
+ return
+ }
+
_, stationName := g.findStation(p.RoomID, craft.Station)
if stationName == "" {
stationName = "inventory"
@@ -177,8 +182,8 @@ func (g *Game) advanceProduction(sess *net.Session, p *player.Player) bool {
itemID := d.ItemID
phase := d.Phase
wait := d.Wait
- startMsg := d.StartMsg
- endMsg := d.EndMsg
+ startMsg := d.StartMessage
+ endMsg := d.EndMessage
remaining := d.Remaining
item := g.loadCraftItem(itemID)
@@ -192,27 +197,11 @@ func (g *Game) advanceProduction(sess *net.Session, p *player.Player) bool {
if startMsg != "" {
sess.WriteLine(startMsg)
}
- if len(craft.Steps) > 0 {
- d.NextStepIndex = 0
- d.StepsAccumulatedTicks = 0
- }
d.Phase = 1
p.Action.WaitLeft = engine.ToTicks(wait)
return true
}
- if stepsIdx := d.NextStepIndex; stepsIdx < len(craft.Steps) {
- accTicks := d.StepsAccumulatedTicks
- accTicks += wait
- d.StepsAccumulatedTicks = accTicks
- for i := stepsIdx; i < len(craft.Steps); i++ {
- if accTicks >= craft.Steps[i].Tick {
- sess.WriteLine(g.resolveCraftVar(sess, craft.Steps[i].Message, craft, item.ID, nil, p.HasItem))
- d.NextStepIndex = i + 1
- }
- }
- }
-
skill := craft.EffectiveSkill()
skillLevel := p.Level(player.SkillName(skill))
chance := 1.0
@@ -278,7 +267,7 @@ func (g *Game) advanceProduction(sess *net.Session, p *player.Player) bool {
} else {
defaultSuccess = "You produce %n."
}
- msg := g.resolveCraftMessage(sess, craft.Message, defaultSuccess, craft, item.ID, byproducts, p.HasItem)
+ msg := g.resolveCraftMessage(sess, craft.SuccessMessage, defaultSuccess, craft, item.ID, byproducts, p.HasItem)
if p.OptionBool("xp_drops") && craft.XP > 0 {
msg += g.formatXpDropSingle(sess, p, player.SkillName(skill), craft.XP)
}