about summary refs log tree commit diff stats
path: root/apworld/__init__.py
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-09-25 18:26:53 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-09-25 18:26:53 -0400
commit05827d25733698a26cc0f305966e6a8a03be4684 (patch)
tree75dbec594a0bd0c2494df31b712bb6435730197c /apworld/__init__.py
parentcb2eca4fed1eb3692eaa13715f65ebcaf8472b64 (diff)
downloadlingo2-archipelago-05827d25733698a26cc0f305966e6a8a03be4684.tar.gz
lingo2-archipelago-05827d25733698a26cc0f305966e6a8a03be4684.tar.bz2
lingo2-archipelago-05827d25733698a26cc0f305966e6a8a03be4684.zip
Game talks through CommonClient now
Diffstat (limited to 'apworld/__init__.py')
-rw-r--r--apworld/__init__.py50
1 files changed, 3 insertions, 47 deletions
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 @@
1""" 1"""
2Archipelago init file for Lingo 2 2Archipelago init file for Lingo 2
3""" 3"""
4import asyncio
5import os.path
6import pkgutil
7import subprocess
8from typing import ClassVar 4from typing import ClassVar
9 5
10import Utils
11import settings
12from BaseClasses import ItemClassification, Item, Tutorial 6from BaseClasses import ItemClassification, Item, Tutorial
13from settings import Group, UserFilePath 7from settings import Group, UserFilePath
14from worlds.AutoWorld import WebWorld, World 8from worlds.AutoWorld import WebWorld, World
@@ -18,7 +12,7 @@ from .player_logic import Lingo2PlayerLogic
18from .regions import create_regions, shuffle_entrances, connect_ports_from_ut 12from .regions import create_regions, shuffle_entrances, connect_ports_from_ut
19from .static_logic import Lingo2StaticLogic 13from .static_logic import Lingo2StaticLogic
20from .version import APWORLD_VERSION 14from .version import APWORLD_VERSION
21from ..LauncherComponents import Component, Type, components 15from ..LauncherComponents import Component, Type, components, launch as launch_component
22 16
23 17
24class Lingo2WebWorld(WebWorld): 18class Lingo2WebWorld(WebWorld):
@@ -162,47 +156,9 @@ class Lingo2World(World):
162 return slot_data 156 return slot_data
163 157
164 158
165async def run_game():
166 exe_file = settings.get_settings().lingo2_options.exe_file
167
168 if Lingo2World.zip_path is not None:
169 # This is a packaged apworld.
170 init_scene = pkgutil.get_data(__name__, "client/run_from_apworld.tscn")
171 init_path = Utils.local_path("data", "lingo2_init.tscn")
172
173 with open(init_path, "wb") as file_handle:
174 file_handle.write(init_scene)
175
176 subprocess.Popen(
177 [
178 exe_file,
179 "--scene",
180 init_path,
181 "--",
182 str(Lingo2World.zip_path.absolute()),
183 ],
184 cwd=os.path.dirname(exe_file),
185 )
186 else:
187 # The world is unzipped and being run in source.
188 subprocess.Popen(
189 [
190 exe_file,
191 "--scene",
192 Utils.local_path("worlds", "lingo2", "client", "run_from_source.tscn"),
193 "--",
194 Utils.local_path("worlds", "lingo2", "client"),
195 ],
196 cwd=os.path.dirname(exe_file),
197 )
198
199
200async def client_main():
201 Utils.async_start(run_game())
202
203
204def launch_client(*args): 159def launch_client(*args):
205 asyncio.run(client_main()) 160 from .context import client_main
161 launch_component(client_main, name="Lingo2Client", args=args)
206 162
207 163
208component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, 164component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client,