diff options
| author | historia <workhorse@localhost.localdomain> | 2026-06-20 21:36:32 -0400 |
|---|---|---|
| committer | historia <workhorse@localhost.localdomain> | 2026-06-20 21:36:32 -0400 |
| commit | 010fa439399581391fcd509d2058191ff4fa74b3 (patch) | |
| tree | 2deb54f5b2724e34091e6fb97390e6958f973561 /internal/game | |
| parent | 00a0622dcb5eae90b4ec14ed16c527b81f963c3f (diff) | |
| download | thehouseoficarus-010fa439399581391fcd509d2058191ff4fa74b3.tar.gz | |
feat: stop command added
Diffstat (limited to 'internal/game')
| -rw-r--r-- | internal/game/action_identify.go | 8 | ||||
| -rw-r--r-- | internal/game/cmd_id.go | 4 | ||||
| -rw-r--r-- | internal/game/cmd_registry.go | 1 | ||||
| -rw-r--r-- | internal/game/cmd_stop.go | 18 | ||||
| -rw-r--r-- | internal/game/cmd_verbs.go | 1 | ||||
| -rw-r--r-- | internal/game/sys_science.go | 4 |
6 files changed, 28 insertions, 8 deletions
diff --git a/internal/game/action_identify.go b/internal/game/action_identify.go index b04bf97..fd7df20 100644 --- a/internal/game/action_identify.go +++ b/internal/game/action_identify.go @@ -11,9 +11,9 @@ func (g *Game) advanceIdentify(sess *net.Session, p *player.Player) { junkID := p.Action.Data["junk_id"].(string) xpPer := p.Action.Data["xp_per"].(int) - scrapCount := p.CountItem("scrap_metal") + scrapCount := p.CountItem("scrap") if scrapCount == 0 { - sess.WriteLine("You don't have any scrap metal.") + sess.WriteLine("You don't have any scrap.") g.cancelAction(p) return } @@ -38,7 +38,7 @@ func (g *Game) advanceIdentify(sess *net.Session, p *player.Player) { for i := 0; i < 28; i++ { slot := p.InvSlot(i) - if slot != nil && slot.ItemID == "scrap_metal" { + if slot != nil && slot.ItemID == "scrap" { p.SetInvSlot(i, nil) } } @@ -63,7 +63,7 @@ func (g *Game) advanceIdentify(sess *net.Session, p *player.Player) { junkName = def.Name } - msg := fmt.Sprintf("The altar hums. You identify %d scrap metal into %d %s.", scrapCount, totalJunk, junkName) + msg := fmt.Sprintf("The altar hums. You identify %d scrap into %d %s.", scrapCount, totalJunk, junkName) g.awardSkillXP(sess, p, player.Scavenging, totalXP) diff --git a/internal/game/cmd_id.go b/internal/game/cmd_id.go index cb886dc..6514463 100644 --- a/internal/game/cmd_id.go +++ b/internal/game/cmd_id.go @@ -113,9 +113,9 @@ func (g *Game) doIdentify(sess *net.Session, input string) { return } - scrapCount := p.CountItem("scrap_metal") + scrapCount := p.CountItem("scrap") if scrapCount == 0 { - sess.WriteLine("You don't have any scrap metal.") + sess.WriteLine("You don't have any scrap.") return } diff --git a/internal/game/cmd_registry.go b/internal/game/cmd_registry.go index 5073b02..ea09e94 100644 --- a/internal/game/cmd_registry.go +++ b/internal/game/cmd_registry.go @@ -122,6 +122,7 @@ var commandRegistry = map[string]commandDef{ "what": {(*Game).executeVerbs, ClassInstant}, "syntax": {(*Game).executeVerbs, ClassInstant}, "commands": {(*Game).executeVerbs, ClassInstant}, + "stop": {(*Game).executeStop, ClassInstant}, } func classifyCommand(cmd string) CommandClass { diff --git a/internal/game/cmd_stop.go b/internal/game/cmd_stop.go new file mode 100644 index 0000000..0db0ac2 --- /dev/null +++ b/internal/game/cmd_stop.go @@ -0,0 +1,18 @@ +package game + +import ( + "thehouseoficarus/internal/net" +) + +func (g *Game) executeStop(sess *net.Session, args []string, rawInput string) { + p := sess.Player + as, ok := p.ActionState.(*ActionState) + if !ok || as == nil || as.Type == "" { + sess.WriteLine("You're not doing anything.") + return + } + g.cancelAction(p) + g.cancelBgAction(p) + delete(g.activeQueue, p.Name) + sess.WriteLine("You stop what you were doing.") +} diff --git a/internal/game/cmd_verbs.go b/internal/game/cmd_verbs.go index 1ecd138..7801903 100644 --- a/internal/game/cmd_verbs.go +++ b/internal/game/cmd_verbs.go @@ -26,6 +26,7 @@ var alwaysAvailable = []string{ "help", "inspect", "queued", + "stop", "aps", "autotrigger", "auto", "trigger", diff --git a/internal/game/sys_science.go b/internal/game/sys_science.go index 376d7c7..1129fee 100644 --- a/internal/game/sys_science.go +++ b/internal/game/sys_science.go @@ -204,7 +204,7 @@ func (g *Game) effectiveJunkCost(p *player.Player, mod *ModDef) map[string]int { hasDeck := g.hasDeckEquipped(p) if hasDeck { - delete(cost, "scrap_metal") + delete(cost, "scrap") } providesJunk := g.providesJunk(p) @@ -263,7 +263,7 @@ func (g *Game) triggerModReward(sess *net.Session, p *player.Player, mod *ModDef func (g *Game) junkCostString(p *player.Player, mod *ModDef) string { cost := g.effectiveJunkCost(p, mod) - delete(cost, "scrap_metal") + delete(cost, "scrap") if len(cost) == 0 { return "free" } |
