Factorio: Client in folder, TextClient: always available (#1829)

* Factorio: move Client into world folder

* Factorio: declare Client as Client Component

* FactorioClient: use centralized launch_subprocess

* TextClient: make always available
This commit is contained in:
Fabian Dill
2023-06-25 02:31:25 +02:00
committed by GitHub
parent a96ff8de16
commit 46f2f3d7cd
5 changed files with 588 additions and 552 deletions

View File

@@ -48,6 +48,10 @@ class Component:
def __repr__(self):
return f"{self.__class__.__name__}({self.display_name})"
def launch_subprocess(func: Callable, name: str = None):
import multiprocessing
process = multiprocessing.Process(target=func, name=name, daemon=True)
process.start()
class SuffixIdentifier:
suffixes: Iterable[str]
@@ -63,6 +67,11 @@ class SuffixIdentifier:
return False
def launch_textclient():
import CommonClient
launch_subprocess(CommonClient.run_as_textclient, name="TextClient")
components: List[Component] = [
# Launcher
Component('Launcher', 'Launcher', component_type=Type.HIDDEN),
@@ -70,7 +79,7 @@ components: List[Component] = [
Component('Host', 'MultiServer', 'ArchipelagoServer', cli=True,
file_identifier=SuffixIdentifier('.archipelago', '.zip')),
Component('Generate', 'Generate', cli=True),
Component('Text Client', 'CommonClient', 'ArchipelagoTextClient'),
Component('Text Client', 'CommonClient', 'ArchipelagoTextClient', func=launch_textclient),
# SNI
Component('SNI Client', 'SNIClient',
file_identifier=SuffixIdentifier('.apz3', '.apm3', '.apsoe', '.aplttp', '.apsm', '.apsmz3', '.apdkc3',