feat: Implement IdleState class for turtle state machine to handle idle behavior
This commit is contained in:
24
server/states/IdleState.js
Normal file
24
server/states/IdleState.js
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user