From 6a061177860690ba3be6b61d00079865f75bf8f8 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Tue, 13 Apr 2021 20:09:26 +0200 Subject: [PATCH] Factorio: use game.print --- FactorioClient.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FactorioClient.py b/FactorioClient.py index b210cf3c..b8dc31e6 100644 --- a/FactorioClient.py +++ b/FactorioClient.py @@ -81,7 +81,8 @@ class FactorioContext(CommonContext): def on_print(self, args: dict): logger.info(args["text"]) if self.rcon_client: - self.rcon_client.send_command(f"Archipelago: {args['text']}") + cleaned_text = args['text'].replace('"', '') + self.rcon_client.send_command(f"/sc game.print(\"Archipelago: {cleaned_text}\")") def on_print_json(self, args: dict): if not self.found_items and args.get("type", None) == "ItemSend" and args["receiving"] == args["sending"]: @@ -89,7 +90,8 @@ class FactorioContext(CommonContext): copy_data = copy.deepcopy(args["data"]) # jsontotextparser is destructive currently logger.info(self.jsontotextparser(args["data"])) if self.rcon_client: - self.rcon_client.send_command(f"Archipelago: {self.raw_json_text_parser(copy_data)}") + cleaned_text = self.raw_json_text_parser(copy_data).replace('"', '') + self.rcon_client.send_command(f"/sc game.print(\"Archipelago: {cleaned_text}\")") async def game_watcher(ctx: FactorioContext): bridge_logger = logging.getLogger("FactorioWatcher")