diff options
Diffstat (limited to 'apworld/__init__.py')
-rw-r--r-- | apworld/__init__.py | 43 |
1 files changed, 43 insertions, 0 deletions
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 @@ | |||
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 subprocess | ||
7 | from typing import ClassVar | ||
8 | |||
9 | import Utils | ||
10 | import settings | ||
4 | from BaseClasses import ItemClassification, Item, Tutorial | 11 | from BaseClasses import ItemClassification, Item, Tutorial |
12 | from settings import Group, UserFilePath | ||
5 | from worlds.AutoWorld import WebWorld, World | 13 | from worlds.AutoWorld import WebWorld, World |
6 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS | 14 | from .items import Lingo2Item, ANTI_COLLECTABLE_TRAPS |
7 | from .options import Lingo2Options | 15 | from .options import Lingo2Options |
@@ -9,6 +17,30 @@ from .player_logic import Lingo2PlayerLogic | |||
9 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut | 17 | from .regions import create_regions, shuffle_entrances, connect_ports_from_ut |
10 | from .static_logic import Lingo2StaticLogic | 18 | from .static_logic import Lingo2StaticLogic |
11 | from .version import APWORLD_VERSION | 19 | from .version import APWORLD_VERSION |
20 | from ..LauncherComponents import Component, Type, components | ||
21 | |||
22 | |||
23 | async def run_game(): | ||
24 | exe_file = settings.get_settings().lingo2_options.exe_file | ||
25 | |||
26 | subprocess.Popen( | ||
27 | [ | ||
28 | exe_file, | ||
29 | "--scene", | ||
30 | Utils.local_path("worlds", "lingo2", "client", "run_from_source.tscn"), | ||
31 | "--", | ||
32 | Utils.local_path("worlds", "lingo2", "client"), | ||
33 | ], | ||
34 | cwd=os.path.dirname(exe_file), | ||
35 | ) | ||
36 | |||
37 | |||
38 | async def client_main(): | ||
39 | Utils.async_start(run_game()) | ||
40 | |||
41 | |||
42 | def launch_client(*args): | ||
43 | asyncio.run(client_main()) | ||
12 | 44 | ||
13 | 45 | ||
14 | class Lingo2WebWorld(WebWorld): | 46 | class Lingo2WebWorld(WebWorld): |
@@ -24,6 +56,14 @@ class Lingo2WebWorld(WebWorld): | |||
24 | )] | 56 | )] |
25 | 57 | ||
26 | 58 | ||
59 | class Lingo2Settings(Group): | ||
60 | class ExecutableFile(UserFilePath): | ||
61 | """Path to the Lingo 2 executable""" | ||
62 | is_exe = True | ||
63 | |||
64 | exe_file: ExecutableFile = ExecutableFile() | ||
65 | |||
66 | |||
27 | class Lingo2World(World): | 67 | class Lingo2World(World): |
28 | """ | 68 | """ |
29 | Lingo 2 is a first person indie puzzle game where you solve word puzzles in a labyrinthe world. Compared to its | 69 | 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): | |||
33 | game = "Lingo 2" | 73 | game = "Lingo 2" |
34 | web = Lingo2WebWorld() | 74 | web = Lingo2WebWorld() |
35 | 75 | ||
76 | settings: ClassVar[Lingo2Settings] | ||
77 | settings_key = "lingo2_options" | ||
78 | |||
36 | topology_present = True | 79 | topology_present = True |
37 | 80 | ||
38 | options_dataclass = Lingo2Options | 81 | options_dataclass = Lingo2Options |