And also fixes auto, which worked as goal but never got triggered
This commit is contained in:
Fabian Dill 2020-05-04 02:47:22 +02:00
parent 815ec85da9
commit 6afd4f0507
2 changed files with 6 additions and 2 deletions

View File

@ -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='''\

View File

@ -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