Skip to content

Commit

Permalink
Factorio: Client in folder, TextClient: always available (Archipelago…
Browse files Browse the repository at this point in the history
…MW#1829)

* Factorio: move Client into world folder

* Factorio: declare Client as Client Component

* FactorioClient: use centralized launch_subprocess

* TextClient: make always available
  • Loading branch information
Berserker66 authored Jun 25, 2023
1 parent a96ff8d commit 46f2f3d
Show file tree
Hide file tree
Showing 5 changed files with 588 additions and 552 deletions.
13 changes: 7 additions & 6 deletions CommonClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,9 @@ def get_base_parser(description: typing.Optional[str] = None):
return parser


if __name__ == '__main__':
# Text Mode to use !hint and such with games that have no text entry

def run_as_textclient():
class TextContext(CommonContext):
# Text Mode to use !hint and such with games that have no text entry
tags = {"AP", "TextOnly"}
game = "" # empty matches any game since 0.3.2
items_handling = 0b111 # receive all items for /received
Expand All @@ -859,12 +858,11 @@ async def server_auth(self, password_requested: bool = False):
def on_package(self, cmd: str, args: dict):
if cmd == "Connected":
self.game = self.slot_info[self.slot].game

async def disconnect(self, allow_autoreconnect: bool = False):
self.game = ""
await super().disconnect(allow_autoreconnect)


async def main(args):
ctx = TextContext(args.connect, args.password)
ctx.auth = args.name
Expand All @@ -877,7 +875,6 @@ async def main(args):
await ctx.exit_event.wait()
await ctx.shutdown()


import colorama

parser = get_base_parser(description="Gameless Archipelago Client, for text interfacing.")
Expand All @@ -897,3 +894,7 @@ async def main(args):

asyncio.run(main(args))
colorama.deinit()


if __name__ == '__main__':
run_as_textclient()
Loading

0 comments on commit 46f2f3d

Please sign in to comment.