Don't run external turns when space is paused
This commit is contained in:
parent
4e1475a176
commit
e2e72467cd
|
@ -304,6 +304,13 @@ export class Turn {
|
||||||
if (facet.actor.exitReason !== null) return;
|
if (facet.actor.exitReason !== null) return;
|
||||||
if (!facet.isLive) return;
|
if (!facet.isLive) return;
|
||||||
}
|
}
|
||||||
|
if (!facet.actor.space.isRunning()) {
|
||||||
|
facet.actor.space.queueTask({
|
||||||
|
perform() { Turn.for(facet, f, zombieTurn); },
|
||||||
|
describe() { return { type: 'externalTurn' } },
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
const t = new Turn(facet);
|
const t = new Turn(facet);
|
||||||
try {
|
try {
|
||||||
const saved = Turn.active;
|
const saved = Turn.active;
|
||||||
|
|
|
@ -55,6 +55,10 @@ export class ActorSpace {
|
||||||
this.inboundAssertions.delete(handle);
|
this.inboundAssertions.delete(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isRunning() {
|
||||||
|
return this.state === ActorSpaceState.RUNNING;
|
||||||
|
}
|
||||||
|
|
||||||
shutdown(reason: Exclude<ExitReason, null>) {
|
shutdown(reason: Exclude<ExitReason, null>) {
|
||||||
if (this.state === ActorSpaceState.TERMINATED) return;
|
if (this.state === ActorSpaceState.TERMINATED) return;
|
||||||
this.state = ActorSpaceState.TERMINATED;
|
this.state = ActorSpaceState.TERMINATED;
|
||||||
|
|
|
@ -15,6 +15,7 @@ export interface StructuredTask<T> {
|
||||||
export type TaskDescription =
|
export type TaskDescription =
|
||||||
| { type: 'bootActor', detail: q.OptionalAny }
|
| { type: 'bootActor', detail: q.OptionalAny }
|
||||||
| { type: 'turn', tasks: TaskAction[] }
|
| { type: 'turn', tasks: TaskAction[] }
|
||||||
|
| { type: 'externalTurn' }
|
||||||
;
|
;
|
||||||
|
|
||||||
export type TaskAction = { targetFacet: Facet, action: ActionDescription };
|
export type TaskAction = { targetFacet: Facet, action: ActionDescription };
|
||||||
|
|
Loading…
Reference in New Issue