diff options
| author | historia <[not public]> | 2026-06-17 02:27:20 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-17 02:27:20 -0400 |
| commit | 731adf2e0fbcac9a32179da077299ed6465af41e (patch) | |
| tree | 29d368917f258350d426f2680bec59feeb464eaf /internal/game/game.go | |
| parent | 389e307f205f9b7edf604fb9f86e1038ead736ef (diff) | |
| download | thehouseoficarus-731adf2e0fbcac9a32179da077299ed6465af41e.tar.gz | |
feat: movement overhauled. agility-enhancing items added.
Diffstat (limited to 'internal/game/game.go')
| -rw-r--r-- | internal/game/game.go | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/internal/game/game.go b/internal/game/game.go index 9d07ead..5af35be 100644 --- a/internal/game/game.go +++ b/internal/game/game.go @@ -448,7 +448,9 @@ func (g *Game) ProcessQueuedCommands() { case ActionGathering, ActionCombating, ActionUsing, ActionTalking, ActionToggling, ActionBurning, ActionStoking, ActionResting, ActionWalking, ActionCooking: default: - p.ActionState = nil + if as.Type != ActionMoving || p.MoveTicks <= 0 { + p.ActionState = nil + } } } @@ -483,11 +485,14 @@ func (g *Game) ProcessQueuedCommands() { if !ok || p == nil { continue } + if p.MoveTicks > 0 { + p.ClearMoveState() + } wasBusy := p.Action != nil || len(p.WalkSequence) > 0 || combat.GetCombat(p.Name) != nil if len(parts) > 0 { g.executeCommand(qc.Session, parts[0], parts[1:], qc.Command+" "+qc.Args) } - isBusy := p.Action != nil || len(p.WalkSequence) > 0 || combat.GetCombat(p.Name) != nil + isBusy := p.Action != nil || len(p.WalkSequence) > 0 || combat.GetCombat(p.Name) != nil || p.MoveTicks > 0 _, isResting := g.restTimers[p.Name] if !isResting && (wasBusy || !isBusy) { g.writePrompt(qc.Session) @@ -501,7 +506,7 @@ func (g *Game) ProcessQueuedCommands() { continue } g.advanceWalk(sess, p) - if len(p.WalkSequence) == 0 { + if len(p.WalkSequence) == 0 && p.MoveTicks == 0 { g.writePrompt(sess) } } @@ -516,6 +521,27 @@ type pendingDepletion struct { playerNames []string } -func (g *Game) TickCombat() { - combat.TickCombat() +func (g *Game) MoveTick() { + if g.Hub == nil { + return + } + for _, sess := range g.Hub.AllSessions() { + p, ok := sess.Player.(*player.Player) + if !ok || p == nil || p.MoveTicks <= 0 { + continue + } + p.MoveTicks-- + if p.MoveTicks > 0 { + if combat.GetCombat(p.Name) != nil && p.OptionBool("run_countdown") { + if p.MoveTicks > 1 { + sess.WriteLine(fmt.Sprintf("Running in %d ticks...", p.MoveTicks)) + } else { + sess.WriteLine("Running next tick!") + } + } + } else { + g.completeMove(sess, p) + g.writePrompt(sess) + } + } } |
