diff options
Diffstat (limited to 'internal/game/action.go')
| -rw-r--r-- | internal/game/action.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/game/action.go b/internal/game/action.go index a62ccec..3d0223a 100644 --- a/internal/game/action.go +++ b/internal/game/action.go @@ -53,6 +53,7 @@ func (g *Game) StartAction(sess *net.Session, verb, target string) { if p.Action != nil { g.CancelAction(p) } + g.CancelBackgroundAction(p) lower := strings.ToLower(target) instanceIdx := -1 @@ -202,6 +203,11 @@ func (g *Game) CancelAction(p *player.Player) { p.ClearMoveState() } +func (g *Game) CancelBackgroundAction(p *player.Player) { + p.BackgroundAction = nil + p.BackgroundActionState = nil +} + func (g *Game) AdvanceActions() { if g.Hub == nil { return @@ -238,6 +244,23 @@ func (g *Game) AdvanceActions() { g.writePrompt(sess) } } + + for _, sess := range g.Hub.AllSessions() { + p, ok := sess.Player.(*player.Player) + if !ok || p.BackgroundAction == nil { + continue + } + if !p.BackgroundAction.Advance() { + continue + } + switch p.BackgroundAction.Type { + case "fletch": + g.advanceFletch(sess, p) + } + if p.BackgroundAction == nil { + g.writePrompt(sess) + } + } } func (g *Game) checkCondition(sess *net.Session, c *action.Condition) bool { |
