diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-25 18:26:53 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-25 18:26:53 -0400 |
commit | 05827d25733698a26cc0f305966e6a8a03be4684 (patch) | |
tree | 75dbec594a0bd0c2494df31b712bb6435730197c /apworld/__init__.py | |
parent | cb2eca4fed1eb3692eaa13715f65ebcaf8472b64 (diff) | |
download | lingo2-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__.py | 50 |
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 | """ |
2 | Archipelago init file for Lingo 2 | 2 | Archipelago init file for Lingo 2 |
3 | """ | 3 | """ |
4 | import asyncio | ||
5 | import os.path | ||
6 | import pkgutil | ||
7 | import subprocess | ||
8 | from typing import ClassVar | 4 | from typing import ClassVar |
9 | 5 | ||
10 | import Utils | ||
11 | import settings | ||
12 | from BaseClasses import ItemClassification, Item, Tutorial | 6 | from BaseClasses import ItemClassification, Item, Tutorial |
13 | from settings import Group, UserFilePath | 7 | from settings import Group, UserFilePath |
14 | from worlds.AutoWorld import WebWorld, World | 8 | from worlds.AutoWorld import WebWorld, World |
@@ -18,7 +12,7 @@ from .player_logic import Lingo2PlayerLogic | |||
18 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut | 12 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut |
19 | from .static_logic import Lingo2StaticLogic | 13 | from .static_logic import Lingo2StaticLogic |
20 | from .version import APWORLD_VERSION | 14 | from .version import APWORLD_VERSION |
21 | from ..LauncherComponents import Component, Type, components | 15 | from ..LauncherComponents import Component, Type, components, launch as launch_component |
22 | 16 | ||
23 | 17 | ||
24 | class Lingo2WebWorld(WebWorld): | 18 | class Lingo2WebWorld(WebWorld): |
@@ -162,47 +156,9 @@ class Lingo2World(World): | |||
162 | return slot_data | 156 | return slot_data |
163 | 157 | ||
164 | 158 | ||
165 | async 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 | |||
200 | async def client_main(): | ||
201 | Utils.async_start(run_game()) | ||
202 | |||
203 | |||
204 | def launch_client(*args): | 159 | def 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 | ||
208 | component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, | 164 | component = Component("Lingo 2 Client", component_type=Type.CLIENT, func=launch_client, |