25 lines
473 B
JavaScript
25 lines
473 B
JavaScript
/**
|
|
* 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);
|
|
}
|
|
}
|
|
}
|