feat(editor): the simulation's properties in a sheet of their own, with a restart for everyone
Who started the simulation, "Pakete verwerfen" and the dropped packets move from the toolbar into a properties sheet beside the surface. New in it: restart the simulation, after asking. The room learns a restart message: stopped as by stop, every capture, dropped frame and program window emptied, started anew and named after who restarted; refused for readers and frozen projects, logged, and waiting for asked blobs like a start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -393,6 +393,9 @@ export class SimulationRoom {
|
||||
case 'stop':
|
||||
this.stop();
|
||||
return;
|
||||
case 'restart':
|
||||
this.restart(input.language, client.name);
|
||||
return;
|
||||
case 'drop':
|
||||
if (this.mode !== 'simulation') {
|
||||
client.send(message({ kind: 'error', code: 'notRunning' }));
|
||||
@@ -475,6 +478,28 @@ export class SimulationRoom {
|
||||
this.flush([...this.clients.values()], false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the simulation anew, as though nothing had run before: stopped as
|
||||
* by stop (what the devices wrote stays in the document), every card's
|
||||
* capture, the dropped frames and every program window emptied — Java's
|
||||
* outlive a stop — and started. Each watcher gets its lists and windows
|
||||
* anew, from their beginning (the dropped frames start does anew anyway; a
|
||||
* view is compared, so a changed one goes out by itself).
|
||||
*/
|
||||
restart(language?: PageLanguage, startedBy?: string): void {
|
||||
this.stop();
|
||||
this.engine.clearCapture();
|
||||
// The cables light up again with the first frame, not once a card has more than before.
|
||||
this.framesSeen.clear();
|
||||
this.terminalWindows.clear();
|
||||
this.browserWindows.clear();
|
||||
for (const client of this.clients.values()) {
|
||||
client.traceSent.clear();
|
||||
client.appSent.clear();
|
||||
}
|
||||
this.start(language, startedBy);
|
||||
}
|
||||
|
||||
/** Lets the simulation run to the wall clock's time, then sends what came of it. */
|
||||
tick(): void {
|
||||
if (this.mode !== 'simulation') return;
|
||||
|
||||
Reference in New Issue
Block a user