diff options
| author | historia <[not public]> | 2026-09-19 03:52:04 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-19 03:52:04 -0400 |
| commit | bab5dd653039d026eb3d4e46da7aafef7137fe7c (patch) | |
| tree | 9a1d8686dbcef8c145e3593511153768ae08962c /internal/game/act.go | |
| parent | 0e60567a7a0addb9421769ee7be7853bfa8788cb (diff) | |
| download | thehouseoficarus-bab5dd653039d026eb3d4e46da7aafef7137fe7c.tar.gz | |
fix: journal in-game room insert/remove, rewrite non-room room refs on rename/swap, seed admin grid from edited room, type action switches
Diffstat (limited to 'internal/game/act.go')
| -rw-r--r-- | internal/game/act.go | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/internal/game/act.go b/internal/game/act.go index 449b2da..7ff805c 100644 --- a/internal/game/act.go +++ b/internal/game/act.go @@ -19,8 +19,8 @@ import ( // cut, talk/speak/ask, steal/thieve, hide) must not be duplicated here: a // registered command is looked up first, so an entry would be dead and its // removal untested. Only shear remains as a pure action alias. -var verbAliases = map[string]string{ - "shear": "gather", +var verbAliases = map[string]behavior.ActionType{ + "shear": behavior.TypeGather, } var verbSkill = map[string]string{ @@ -35,7 +35,7 @@ var verbSkill = map[string]string{ func normalizeVerb(v string) string { if a, ok := verbAliases[v]; ok { - return a + return string(a) } return v } @@ -161,14 +161,14 @@ func (g *Game) startAction(sess *net.Session, verb, target string) { return } - switch bhType { - case "gather": + switch behavior.ActionType(bhType) { + case behavior.TypeGather: if obj == nil || chosen == nil { sess.WriteLine(fmt.Sprintf("You can't %s that.", verb)) return } g.startGather(sess, p, obj, chosen) - case "talk": + case behavior.TypeTalk: if mob != nil { g.startMobTalk(sess, p, mob) } else { @@ -205,27 +205,27 @@ func (g *Game) AdvanceActions() { continue } switch p.Action.Type { - case "gather": + case behavior.TypeGather: g.advanceGather(sess, p) - case "burn": + case behavior.TypeBurn: g.advanceBurn(sess, p) - case "stoke": + case behavior.TypeStoke: g.advanceStoke(sess, p) - case "identify": + case behavior.TypeIdentify: g.advanceIdentify(sess, p) - case "steal": + case behavior.TypeSteal: g.advanceSteal(sess, p) - case "plant": + case behavior.TypePlant: g.advancePlant(sess, p) - case "harvest": + case behavior.TypeHarvest: g.advanceHarvest(sess, p) - case "rake": + case behavior.TypeRake: g.advanceRake(sess, p) - case "water": + case behavior.TypeWater: g.advanceWater(sess, p) - case "cure": + case behavior.TypeCure: g.advanceCure(sess, p) - case "obstacle": + case behavior.TypeObstacle: g.advanceObstacle(sess, p) case behavior.TypeTalk: g.advanceTalk(sess, p) @@ -234,7 +234,7 @@ func (g *Game) AdvanceActions() { case behavior.TypeCombine: g.advanceCombine(sess, p) default: - if productionActionTypes[string(p.Action.Type)] { + if productionActionTypes[p.Action.Type] { g.advanceProduction(sess, p) } } @@ -252,9 +252,9 @@ func (g *Game) AdvanceActions() { continue } switch p.BackgroundAction.Type { - case "fletch": + case behavior.TypeFletch: g.advanceFletch(sess, p) - case "cleaning": + case behavior.TypeClean: g.advanceClean(sess, p) } if p.BackgroundAction == nil { |
