| 1 | package control |
| 2 | |
| 3 | // goalActivationState is host-only; loading history never grants execution. |
| 4 | type goalActivationState struct { |
| 5 | disarmed bool |
| 6 | } |
| 7 | |
| 8 | // goalLaunchState is the one-shot "user just started this Goal" flag. |
| 9 | // It is host-only and never persisted. |
| 10 | type goalLaunchState struct { |
| 11 | explicit bool |
| 12 | } |
| 13 | |
| 14 | func (g *goalMachine) markExplicitStart() { |
| 15 | g.mu.Lock() |
| 16 | g.launch.explicit = true |
| 17 | g.mu.Unlock() |
| 18 | } |
| 19 | |
| 20 | func (g *goalMachine) consumeExplicitStart() bool { |
| 21 | g.mu.Lock() |
| 22 | defer g.mu.Unlock() |
| 23 | ok := g.launch.explicit |
| 24 | g.launch.explicit = false |
| 25 | return ok |
| 26 | } |
| 27 | |
| 28 | func (c *Controller) consumeExplicitGoalStart() bool { |
| 29 | if c == nil { |
| 30 | return false |
| 31 | } |
| 32 | return c.goals.consumeExplicitStart() |
| 33 | } |
| 34 |