diff --git a/server/states/IdleState.js b/server/states/IdleState.js new file mode 100644 index 0000000..d5171dc --- /dev/null +++ b/server/states/IdleState.js @@ -0,0 +1,24 @@ +/** + * IdleState - Turtle is idle, waiting for commands + */ +import { BaseState } from './BaseState.js'; + +export class IdleState extends BaseState { + get name() { + return 'idle'; + } + + get description() { + return 'Idle - waiting for commands'; + } + + async *act() { + // Send periodic status updates while idle + while (!this.cancelled) { + await this.checkFuel(); + await this.scanSurroundings(); + yield; + await this._sleep(5000); + } + } +}