Factorio: move prints from /sc (silent command) to /ap-print, to prevent two warnings getting printed by Factorio

This commit is contained in:
Fabian Dill 2021-07-27 14:59:16 +02:00
parent 3759f4c644
commit 884dece54c
3 changed files with 9 additions and 8 deletions

View File

@ -185,8 +185,8 @@ class FactorioContext(CommonContext):
logger.info(args["text"])
if self.rcon_client:
cleaned_text = args['text'].replace('"', '')
self.rcon_client.send_command(f"/sc game.print(\"[font=default-large-bold]Archipelago:[/font] "
f"{cleaned_text}\")")
self.rcon_client.send_command(f"/ap-print [font=default-large-bold]Archipelago:[/font] "
f"{cleaned_text}")
def on_print_json(self, args: dict):
text = self.raw_json_text_parser(copy.deepcopy(args["data"]))
@ -194,8 +194,8 @@ class FactorioContext(CommonContext):
if self.rcon_client:
text = self.factorio_json_text_parser(args["data"])
cleaned_text = text.replace('"', '')
self.rcon_client.send_command(f"/sc game.print(\"[font=default-large-bold]Archipelago:[/font] "
f"{cleaned_text}\")")
self.rcon_client.send_command(f"/ap-print [font=default-large-bold]Archipelago:[/font] "
f"{cleaned_text}")
@property
def savegame_name(self) -> str:
@ -280,11 +280,9 @@ async def factorio_server_watcher(ctx: FactorioContext):
factorio_server_logger.info(msg)
if not ctx.rcon_client and "Starting RCON interface at IP ADDR:" in msg:
ctx.rcon_client = factorio_rcon.RCONClient("localhost", rcon_port, rcon_password)
# trigger lua interface confirmation
ctx.rcon_client.send_command("/sc game.print('Starting Archipelago Bridge')")
ctx.rcon_client.send_command("/sc game.print('Starting Archipelago Bridge')")
if not ctx.awaiting_bridge and "Archipelago Bridge Data available for game tick " in msg:
ctx.awaiting_bridge = True
if ctx.rcon_client:
while ctx.send_index < len(ctx.items_received):
transfer_item: NetworkItem = ctx.items_received[ctx.send_index]

View File

@ -217,6 +217,9 @@ commands.add_command("ap-sync", "Used by the Archipelago client to get progress
rcon.print(game.table_to_json({["slot_name"] = SLOT_NAME, ["seed_name"] = SEED_NAME, ["info"] = data_collection}))
end)
commands.add_command("ap-print", "Used by the Archipelago client to print messages", function (call)
game.print(call.parameter)
end)
commands.add_command("ap-get-technology", "Grant a technology, used by the Archipelago Client.", function(call)
if global.index_sync == nil then

View File

@ -118,7 +118,7 @@ class Factorio(World):
return super(Factorio, self).collect(state, item)
def get_required_client_version(self) -> tuple:
return max((0, 1, 5), super(Factorio, self).get_required_client_version())
return max((0, 1, 6), super(Factorio, self).get_required_client_version())
options = factorio_options