From 05827d25733698a26cc0f305966e6a8a03be4684 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 25 Sep 2025 18:26:53 -0400 Subject: Game talks through CommonClient now --- apworld/__init__.py | 50 +++----------------------------------------------- 1 file changed, 3 insertions(+), 47 deletions(-) (limited to 'apworld/__init__.py') diff --git a/apworld/__init__.py b/apworld/__init__.py index 523c00c..fc397a2 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py @@ -1,14 +1,8 @@ """ Archipelago init file for Lingo 2 """ -import asyncio -import os.path -import pkgutil -import subprocess from typing import ClassVar -import Utils -import settings from BaseClasses import ItemClassification, Item, Tutorial from settings import Group, UserFilePath from worlds.AutoWorld import WebWorld, World @@ -18,7 +12,7 @@ from .player_logic import Lingo2PlayerLogic from .regions import create_regions, shuffle_entrances, connect_ports_from_ut from .static_logic import Lingo2StaticLogic from .version import APWORLD_VERSION -from ..LauncherComponents import Component, Type, components +from ..LauncherComponents import Component, Type, components, launch as launch_component class Lingo2WebWorld(WebWorld): @@ -162,47 +156,9 @@ class Lingo2World(World): return slot_data -async def run_game(): - exe_file = settings.get_settings().lingo2_options.exe_file - - if Lingo2World.zip_path is not None: - # This is a packaged apworld. - init_scene = pkgutil.get_data(__name__, "client/run_from_apworld.tscn") - init_path = Utils.local_path("data", "lingo2_init.tscn") - - with open(init_path, "wb") as file_handle: - file_handle.write(init_scene) - - subprocess.Popen( - [ - exe_file, - "--scene", - init_path, - "--", - str(Lingo2World.zip_path.absolute()), - ], - cwd=os.path.dirname(exe_file), - ) - else: - # The world is unzipped and being run in source. - subprocess.Popen( - [ - exe_file, - "--scene", - Utils.local_path("worlds", "lingo2", "client", "run_from_source.tscn"), - "--", - Utils.local_path("worlds", "lingo2", "client"), - ], - cwd=os.path.dirname(exe_file), - ) - - -async def client_main(): - Utils.async_start(run_game()) - - def launch_client(*args): - asyncio.run(client_main()) + from .context import client_main + launch_component(client_main, name="Lingo2Client", args=args) component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, -- cgit 1.4.1