From 42ae4d6897da2071f8e982df009be6bd22713838 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Mon, 27 Nov 2023 05:08:41 +0100 Subject: [PATCH] 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. --- plugins/research_sync/controller.ts | 1 + plugins/research_sync/instance.ts | 2 +- plugins/research_sync/messages.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/research_sync/controller.ts b/plugins/research_sync/controller.ts index 79decf82..f1f3f12d 100644 --- a/plugins/research_sync/controller.ts +++ b/plugins/research_sync/controller.ts @@ -141,6 +141,7 @@ export class ControllerPlugin extends BaseControllerPlugin { let { name, level } = event; let tech = this.technologies.get(name); if (!tech || tech.level <= level) { + this.controller.sendTo("allInstances", event); this.progressToBroadcast.delete(name); this.technologies.set(name, { level, progress: null, researched: true }); this.technologiesDirty = true; diff --git a/plugins/research_sync/instance.ts b/plugins/research_sync/instance.ts index 77feb72d..0b47531f 100644 --- a/plugins/research_sync/instance.ts +++ b/plugins/research_sync/instance.ts @@ -56,7 +56,7 @@ export class InstancePlugin extends BaseInstancePlugin { } 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) { diff --git a/plugins/research_sync/messages.ts b/plugins/research_sync/messages.ts index b7768287..99eff2a5 100644 --- a/plugins/research_sync/messages.ts +++ b/plugins/research_sync/messages.ts @@ -69,7 +69,7 @@ export class FinishedEvent { declare ["constructor"]: typeof FinishedEvent; static type = "event" 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; constructor(