addresses #86
And also fixes auto, which worked as goal but never got triggered
This commit is contained in:
		
							parent
							
								
									815ec85da9
								
							
						
					
					
						commit
						6afd4f0507
					
				| 
						 | 
					@ -541,10 +541,10 @@ class ClientMessageProcessor(CommandProcessor):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _cmd_forfeit(self) -> bool:
 | 
					    def _cmd_forfeit(self) -> bool:
 | 
				
			||||||
        """Surrender and send your remaining items out to their recipients"""
 | 
					        """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)
 | 
					            forfeit_player(self.ctx, self.client.team, self.client.slot)
 | 
				
			||||||
            return True
 | 
					            return True
 | 
				
			||||||
        elif self.ctx.forfeit_mode == "disabled":
 | 
					        elif "disabled" in self.ctx.forfeit_mode:
 | 
				
			||||||
            self.output(
 | 
					            self.output(
 | 
				
			||||||
                "Sorry, client forfeiting has been disabled on this server. You can ask the server admin for a /forfeit")
 | 
					                "Sorry, client forfeiting has been disabled on this server. You can ask the server admin for a /forfeit")
 | 
				
			||||||
            return False
 | 
					            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.'
 | 
					                finished_msg = f'{ctx.get_aliased_name(client.team, client.slot)} (Team #{client.team + 1}) has found the triforce.'
 | 
				
			||||||
                notify_all(ctx, finished_msg)
 | 
					                notify_all(ctx, finished_msg)
 | 
				
			||||||
                ctx.client_game_state[client.team, client.slot] = CLIENT_GOAL
 | 
					                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 cmd == 'Say':
 | 
				
			||||||
            if type(args) is not str or not args.isprintable():
 | 
					            if type(args) is not str or not args.isprintable():
 | 
				
			||||||
| 
						 | 
					@ -1009,6 +1011,7 @@ def parse_args() -> argparse.Namespace:
 | 
				
			||||||
                             enabled:  !forfeit is always available
 | 
					                             enabled:  !forfeit is always available
 | 
				
			||||||
                             disabled: !forfeit is never available
 | 
					                             disabled: !forfeit is never available
 | 
				
			||||||
                             goal:     !forfeit can be used after goal completion
 | 
					                             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='?',
 | 
					    parser.add_argument('--remaining_mode', default=defaults["remaining_mode"], nargs='?',
 | 
				
			||||||
                        choices=['enabled', 'disabled', "goal"], help='''\
 | 
					                        choices=['enabled', 'disabled', "goal"], help='''\
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,7 @@ server_options:
 | 
				
			||||||
  hint_cost: 1000 #set to 0 if you want free hints
 | 
					  hint_cost: 1000 #set to 0 if you want free hints
 | 
				
			||||||
  #forfeit modes: "disabled" -> clients can't forfeit, "enabled" -> clients can always forfeit
 | 
					  #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" -> 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
 | 
					  # warning: only Berserker's Multiworld clients of version 2.1+ send game beaten information
 | 
				
			||||||
  forfeit_mode: "goal"
 | 
					  forfeit_mode: "goal"
 | 
				
			||||||
  # !remaining handling, that tells a client which items remain in their pool
 | 
					  # !remaining handling, that tells a client which items remain in their pool
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue