Fix research finished not syncing properly

Fix the research finished event not being sent to the controller, which
in turn meant it would not sync properly.
This commit is contained in:
Hornwitser committed 2023-12-02 01:43:28 +01:00
1 parent 11ffee646e
commit 42ae4d6897
3 files changed
+3 -2

No files matched your search

+1
View File
@@ -141,6 +141,7 @@ export class ControllerPlugin extends BaseControllerPlugin {
let { name, level } = event; let { name, level } = event;
let tech = this.technologies.get(name); let tech = this.technologies.get(name);
if (!tech || tech.level <= level) { if (!tech || tech.level <= level) {
this.controller.sendTo("allInstances", event);
this.progressToBroadcast.delete(name); this.progressToBroadcast.delete(name);
this.technologies.set(name, { level, progress: null, researched: true }); this.technologies.set(name, { level, progress: null, researched: true });
this.technologiesDirty = true; this.technologiesDirty = true;
+1 -1
View File
@@ -56,7 +56,7 @@ export class InstancePlugin extends BaseInstancePlugin {
} }
async researchFinished(tech: IpcFinished) { async researchFinished(tech: IpcFinished) {
this.instance.sendTo("allInstances", new FinishedEvent(tech.name, tech.level)); this.instance.sendTo("controller", new FinishedEvent(tech.name, tech.level));
} }
async handleFinishedEvent(event: FinishedEvent) { async handleFinishedEvent(event: FinishedEvent) {
+1 -1
View File
@@ -69,7 +69,7 @@ export class FinishedEvent {
declare ["constructor"]: typeof FinishedEvent; declare ["constructor"]: typeof FinishedEvent;
static type = "event" as const; static type = "event" as const;
static src = ["instance", "controller"] as const; static src = ["instance", "controller"] as const;
static dst = "instance" as const; static dst = ["instance", "controller"] as const;
static plugin = "research_sync" as const; static plugin = "research_sync" as const;
constructor( constructor(