diff options
| author | workhorse <workhorse@localhost.localdomain> | 2026-06-19 11:51:17 -0400 |
|---|---|---|
| committer | workhorse <workhorse@localhost.localdomain> | 2026-06-19 11:51:17 -0400 |
| commit | 575a71dcfed3b9fa44af244836f638a23df05a9a (patch) | |
| tree | eb5eff16eab86247a3dd93ff4d7fd3781f291b64 /internal/game/game.go | |
| parent | 52a3ce6a4b4a254dc5d3067979a09e93c060fa20 (diff) | |
| download | thehouseoficarus-575a71dcfed3b9fa44af244836f638a23df05a9a.tar.gz | |
feat: farming roughly implemented
Diffstat (limited to 'internal/game/game.go')
| -rw-r--r-- | internal/game/game.go | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/internal/game/game.go b/internal/game/game.go index 8b99731..e800a78 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -55,6 +55,7 @@ type Game struct { consumeQueue map[string]*QueuedCommand pendingDepletions []pendingDepletion guardWatchTimers map[string]int + farmTickCounter int } func New(dataDir string, colorConfig *config.ColorsConfig) *Game { @@ -147,7 +148,7 @@ func classifyCommand(cmd string) CommandClass { "colortable", "prompt", "style", "stats", "tech", "t", "sneak", "autocast", "auto", "mods", "modlist", - "task": + "task", "inspect": return ClassInstant case "equip", "eq", "equipment", "wear", "wield", "remove", "unwear", "unwield": return ClassFree @@ -158,7 +159,8 @@ func classifyCommand(cmd string) CommandClass { "quit", "use", "burn", "stoke", "search", "walk", "cook", "smelt", "smith", "craft", "mix", "id", "identify", "steal", "thieve", - "trigger", "cast": + "trigger", "cast", + "plant", "harvest", "rake", "water", "cure": return ClassActive case "eat", "fletch", "clean": return ClassFree @@ -461,6 +463,52 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI g.doSteal(sess, strings.Join(args, " ")) } return + case "plant": + g.CancelAction(p) + if len(args) == 0 { + sess.WriteLine("Plant what?") + } else { + g.doPlant(sess, strings.Join(args, " ")) + } + return + case "harvest": + g.CancelAction(p) + if len(args) == 0 { + g.doHarvest(sess, "") + } else { + g.doHarvest(sess, strings.Join(args, " ")) + } + return + case "rake": + g.CancelAction(p) + if len(args) == 0 { + g.doRake(sess, "") + } else { + g.doRake(sess, strings.Join(args, " ")) + } + return + case "water": + g.CancelAction(p) + if len(args) == 0 { + g.doWater(sess, "") + } else { + g.doWater(sess, strings.Join(args, " ")) + } + return + case "cure": + g.CancelAction(p) + if len(args) == 0 { + g.doCure(sess, "") + } else { + g.doCure(sess, strings.Join(args, " ")) + } + return + case "inspect": + if len(args) == 0 { + g.doInspect(sess, "") + } else { + g.doInspect(sess, strings.Join(args, " ")) + } case "walk": g.doWalk(sess, args) return @@ -517,7 +565,7 @@ func (g *Game) ProcessQueuedCommands() { switch as.Type { case ActionGathering, ActionCombating, ActionUsing, ActionTalking, ActionToggling, ActionBurning, ActionStoking, ActionResting, ActionWalking, ActionProducing, - ActionStealing: + ActionStealing, ActionPlanting, ActionHarvesting, ActionRaking, ActionWatering, ActionCuring: default: if as.Type != ActionMoving || p.MoveTicks <= 0 { p.ActionState = nil |
