Core/SNIClient/LttP/Factorio: switch to get_settings (#3208)

This commit is contained in:
Fabian Dill 2024-04-24 06:24:44 +02:00 committed by GitHub
parent cca9778871
commit 2f78860d8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 7 deletions

View File

@ -2198,7 +2198,7 @@ async def console(ctx: Context):
def parse_args() -> argparse.Namespace: def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
defaults = Utils.get_options()["server_options"].as_dict() defaults = Utils.get_settings()["server_options"].as_dict()
parser.add_argument('multidata', nargs="?", default=defaults["multidata"]) parser.add_argument('multidata', nargs="?", default=defaults["multidata"])
parser.add_argument('--host', default=defaults["host"]) parser.add_argument('--host', default=defaults["host"])
parser.add_argument('--port', default=defaults["port"], type=int) parser.add_argument('--port', default=defaults["port"], type=int)

View File

@ -282,7 +282,7 @@ class SNESState(enum.IntEnum):
def launch_sni() -> None: def launch_sni() -> None:
sni_path = Utils.get_options()["sni_options"]["sni_path"] sni_path = Utils.get_settings()["sni_options"]["sni_path"]
if not os.path.isdir(sni_path): if not os.path.isdir(sni_path):
sni_path = Utils.local_path(sni_path) sni_path = Utils.local_path(sni_path)
@ -654,7 +654,7 @@ async def game_watcher(ctx: SNIContext) -> None:
async def run_game(romfile: str) -> None: async def run_game(romfile: str) -> None:
auto_start = typing.cast(typing.Union[bool, str], auto_start = typing.cast(typing.Union[bool, str],
Utils.get_options()["sni_options"].get("snes_rom_start", True)) Utils.get_settings()["sni_options"].get("snes_rom_start", True))
if auto_start is True: if auto_start is True:
import webbrowser import webbrowser
webbrowser.open(romfile) webbrowser.open(romfile)

View File

@ -201,7 +201,7 @@ def cache_path(*path: str) -> str:
def output_path(*path: str) -> str: def output_path(*path: str) -> str:
if hasattr(output_path, 'cached_path'): if hasattr(output_path, 'cached_path'):
return os.path.join(output_path.cached_path, *path) return os.path.join(output_path.cached_path, *path)
output_path.cached_path = user_path(get_options()["general_options"]["output_path"]) output_path.cached_path = user_path(get_settings()["general_options"]["output_path"])
path = os.path.join(output_path.cached_path, *path) path = os.path.join(output_path.cached_path, *path)
os.makedirs(os.path.dirname(path), exist_ok=True) os.makedirs(os.path.dirname(path), exist_ok=True)
return path return path

View File

@ -3021,7 +3021,7 @@ def get_base_rom_bytes(file_name: str = "") -> bytes:
def get_base_rom_path(file_name: str = "") -> str: def get_base_rom_path(file_name: str = "") -> str:
options = Utils.get_options() options = Utils.get_settings()
if not file_name: if not file_name:
file_name = options["lttp_options"]["rom_file"] file_name = options["lttp_options"]["rom_file"]
if not os.path.exists(file_name): if not os.path.exists(file_name):

View File

@ -521,7 +521,7 @@ rcon_port = args.rcon_port
rcon_password = args.rcon_password if args.rcon_password else ''.join( rcon_password = args.rcon_password if args.rcon_password else ''.join(
random.choice(string.ascii_letters) for x in range(32)) random.choice(string.ascii_letters) for x in range(32))
factorio_server_logger = logging.getLogger("FactorioServer") factorio_server_logger = logging.getLogger("FactorioServer")
options = Utils.get_options() options = Utils.get_settings()
executable = options["factorio_options"]["executable"] executable = options["factorio_options"]["executable"]
server_settings = args.server_settings if args.server_settings \ server_settings = args.server_settings if args.server_settings \
else options["factorio_options"].get("server_settings", None) else options["factorio_options"].get("server_settings", None)