From 3f53502a5907ed1982d28a392c54331f0c1c2c42 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Thu, 25 Sep 2025 12:09:50 -0400 Subject: Move the client into the apworld Only works on source right now, not as an apworld. --- apworld/__init__.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'apworld/__init__.py') diff --git a/apworld/__init__.py b/apworld/__init__.py index 2213e33..6ac2926 100644 --- a/apworld/__init__.py +++ b/apworld/__init__.py @@ -1,7 +1,15 @@ """ Archipelago init file for Lingo 2 """ +import asyncio +import os.path +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 from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS from .options import Lingo2Options @@ -9,6 +17,30 @@ 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 + + +async def run_game(): + exe_file = settings.get_settings().lingo2_options.exe_file + + 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()) class Lingo2WebWorld(WebWorld): @@ -24,6 +56,14 @@ class Lingo2WebWorld(WebWorld): )] +class Lingo2Settings(Group): + class ExecutableFile(UserFilePath): + """Path to the Lingo 2 executable""" + is_exe = True + + exe_file: ExecutableFile = ExecutableFile() + + class Lingo2World(World): """ Lingo 2 is a first person indie puzzle game where you solve word puzzles in a labyrinthe world. Compared to its @@ -33,6 +73,9 @@ class Lingo2World(World): game = "Lingo 2" web = Lingo2WebWorld() + settings: ClassVar[Lingo2Settings] + settings_key = "lingo2_options" + topology_present = True options_dataclass = Lingo2Options -- cgit 1.4.1