From 6afd4f05071030e51aaa62385d8614eee2e92adb Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Mon, 4 May 2020 02:47:22 +0200 Subject: [PATCH] addresses #86 And also fixes auto, which worked as goal but never got triggered --- MultiServer.py | 7 +++++-- host.yaml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/MultiServer.py b/MultiServer.py index 0159bfd9..1a8243c0 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -541,10 +541,10 @@ class ClientMessageProcessor(CommandProcessor): def _cmd_forfeit(self) -> bool: """Surrender and send your remaining items out to their recipients""" - if self.ctx.forfeit_mode == "enabled": + if "enabled" in self.ctx.forfeit_mode: forfeit_player(self.ctx, self.client.team, self.client.slot) return True - elif self.ctx.forfeit_mode == "disabled": + elif "disabled" in self.ctx.forfeit_mode: self.output( "Sorry, client forfeiting has been disabled on this server. You can ask the server admin for a /forfeit") return False @@ -804,6 +804,8 @@ async def process_client_cmd(ctx: Context, client: Client, cmd, args): finished_msg = f'{ctx.get_aliased_name(client.team, client.slot)} (Team #{client.team + 1}) has found the triforce.' notify_all(ctx, finished_msg) ctx.client_game_state[client.team, client.slot] = CLIENT_GOAL + if "auto" in ctx.forfeit_mode: + forfeit_player(ctx, client.team, client.slot) if cmd == 'Say': if type(args) is not str or not args.isprintable(): @@ -1009,6 +1011,7 @@ def parse_args() -> argparse.Namespace: enabled: !forfeit is always available disabled: !forfeit is never available goal: !forfeit can be used after goal completion + auto-enabled: !forfeit is available and automatically triggered on goal completion ''') parser.add_argument('--remaining_mode', default=defaults["remaining_mode"], nargs='?', choices=['enabled', 'disabled', "goal"], help='''\ diff --git a/host.yaml b/host.yaml index af78c906..7db95469 100644 --- a/host.yaml +++ b/host.yaml @@ -25,6 +25,7 @@ server_options: hint_cost: 1000 #set to 0 if you want free hints #forfeit modes: "disabled" -> clients can't forfeit, "enabled" -> clients can always forfeit # "auto" -> automatic forfeit on goal completion, "goal" -> clients can forfeit after achieving their goal + # "auto-enabled" -> automatic forfeit on goal completion and manual forfeit is also enabled # warning: only Berserker's Multiworld clients of version 2.1+ send game beaten information forfeit_mode: "goal" # !remaining handling, that tells a client which items remain in their pool