From e4400c5f1e84c18d2126f2cb502ae10685977cbb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 20 Jun 2026 03:20:01 -0400 Subject: refactor: combined all station crafting --- internal/game/action_fletch.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'internal/game/action_fletch.go') diff --git a/internal/game/action_fletch.go b/internal/game/action_fletch.go index aa5dfc7..3d8c30f 100644 --- a/internal/game/action_fletch.go +++ b/internal/game/action_fletch.go @@ -115,13 +115,7 @@ func (g *Game) startTimedFletch(sess *net.Session, p *player.Player, recipe *act } p.BackgroundActionState = &ActionState{Type: ActionFletching, TargetName: outputName} - if g.Hub != nil { - for _, other := range g.Hub.PlayersInRoom(p.RoomID) { - if other != sess && other.Player != nil { - other.WriteLine(g.colorize(other, "broadcast", fmt.Sprintf("\n%s starts fletching.", p.Name))) - } - } - } + g.broadcastAction(sess, "\n%s starts fletching.", p.Name) sess.WriteLine(fmt.Sprintf("\nYou begin fletching %s.", outputName)) } @@ -132,9 +126,9 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) { wait, _ := p.BackgroundAction.Data["wait"].(float64) remaining, _ := p.BackgroundAction.Data["remaining"].(int) - recipe := g.loadProductionRecipe(recipeID) + recipe := g.loadRecipe(recipeID) if recipe == nil { - g.cancelBackgroundAction(p) + g.cancelBgAction(p) return } @@ -146,7 +140,7 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) { if !g.canDoFletchRecipe(p, recipe) { sess.WriteLine("\nYou've run out of fletching materials.") - g.cancelBackgroundAction(p) + g.cancelBgAction(p) return } @@ -175,7 +169,7 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) { freeSlot := p.FirstFreeSlot() if freeSlot == -1 { sess.WriteLine("\nYour inventory is too full!") - g.cancelBackgroundAction(p) + g.cancelBgAction(p) return } p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: recipe.Output, Quantity: outputQty}) @@ -205,14 +199,14 @@ func (g *Game) advanceFletch(sess *net.Session, p *player.Player) { p.BackgroundAction.Data["remaining"] = remaining if remaining <= 0 { sess.WriteLine("\nYou've finished fletching.") - g.cancelBackgroundAction(p) + g.cancelBgAction(p) return } } if !g.canContinueProduction(p, recipe) { sess.WriteLine("\nYou've run out of fletching materials.") - g.cancelBackgroundAction(p) + g.cancelBgAction(p) return } -- cgit v1.2.3