diff --git a/FactorioClient.py b/FactorioClient.py index b7bf3243..2fa8ba9c 100644 --- a/FactorioClient.py +++ b/FactorioClient.py @@ -400,6 +400,7 @@ if __name__ == '__main__': "Refer to Factorio --help for those.") parser.add_argument('--rcon-port', default='24242', type=int, help='Port to use to communicate with Factorio') parser.add_argument('--rcon-password', help='Password to authenticate with RCON.') + parser.add_argument('--server-settings', help='Factorio server settings configuration file.') args, rest = parser.parse_known_args() colorama.init() @@ -410,6 +411,9 @@ if __name__ == '__main__': factorio_server_logger = logging.getLogger("FactorioServer") options = Utils.get_options() executable = options["factorio_options"]["executable"] + server_settings = args.server_settings if args.server_settings else options["factorio_options"].get("server_settings", None) + if server_settings: + server_settings = os.path.abspath(server_settings) if not os.path.exists(os.path.dirname(executable)): raise FileNotFoundError(f"Path {os.path.dirname(executable)} does not exist or could not be accessed.") @@ -421,7 +425,10 @@ if __name__ == '__main__': else: raise FileNotFoundError(f"Path {executable} is not an executable file.") - server_args = ("--rcon-port", rcon_port, "--rcon-password", rcon_password, *rest) + if server_settings and os.path.isfile(server_settings): + server_args = ("--rcon-port", rcon_port, "--rcon-password", rcon_password, "--server-settings", server_settings, *rest) + else: + server_args = ("--rcon-port", rcon_port, "--rcon-password", rcon_password, *rest) asyncio.run(main(args)) colorama.deinit() diff --git a/host.yaml b/host.yaml index 86f88de0..901e6cd7 100644 --- a/host.yaml +++ b/host.yaml @@ -101,7 +101,9 @@ sm_options: # Alternatively, a path to a program to open the .sfc file with rom_start: true factorio_options: - executable: "factorio\\bin\\x64\\factorio" + executable: "factorio/bin/x64/factorio" + # by default, no settings are loaded if this file does not exist. If this file does exist, then it will be used. + # server_settings: "factorio\\data\\server-settings.json" minecraft_options: forge_directory: "Minecraft Forge server" max_heap_size: "2G"