MultiServer: declare spectators as default goal-finished

This commit is contained in:
Fabian Dill 2021-11-06 08:19:10 +01:00
parent 739d4d0038
commit f43475f33b
3 changed files with 9 additions and 3 deletions

View File

@ -78,6 +78,7 @@ class Context:
"compatibility": int} "compatibility": int}
# team -> slot id -> list of clients authenticated to slot. # team -> slot id -> list of clients authenticated to slot.
clients: typing.Dict[int, typing.Dict[int, typing.List[Client]]] clients: typing.Dict[int, typing.Dict[int, typing.List[Client]]]
locations: typing.Dict[int, typing.Dict[int, typing.Tuple[int, int]]]
def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int, def __init__(self, host: str, port: int, server_password: str, password: str, location_check_points: int,
hint_cost: int, item_cheat: bool, forfeit_mode: str = "disabled", collect_mode="disabled", hint_cost: int, item_cheat: bool, forfeit_mode: str = "disabled", collect_mode="disabled",
@ -99,7 +100,7 @@ class Context:
self.remote_items = set() self.remote_items = set()
self.remote_start_inventory = set() self.remote_start_inventory = set()
# player location_id item_id target_player_id # player location_id item_id target_player_id
self.locations: typing.Dict[int, typing.Dict[int, typing.Tuple[int, int]]] = {} self.locations = {}
self.host = host self.host = host
self.port = port self.port = port
self.server_password = server_password self.server_password = server_password
@ -279,6 +280,11 @@ class Context:
self.received_items[team, slot] = [NetworkItem(item_code, -2, 0) for item_code in item_codes] self.received_items[team, slot] = [NetworkItem(item_code, -2, 0) for item_code in item_codes]
for slot, hints in decoded_obj["precollected_hints"].items(): for slot, hints in decoded_obj["precollected_hints"].items():
self.hints[team, slot].update(hints) self.hints[team, slot].update(hints)
# declare slots without checks as done, as they're assumed to be spectators
for slot, locations in self.locations.items():
if not locations:
for team in self.clients:
self.client_game_state[team, slot] = ClientStatus.CLIENT_GOAL
if use_embedded_server_options: if use_embedded_server_options:
server_options = decoded_obj.get("server_options", {}) server_options = decoded_obj.get("server_options", {})
self._set_options(server_options) self._set_options(server_options)

View File

@ -29,7 +29,7 @@ ArchitecturesAllowed=x64
AllowNoIcons=yes AllowNoIcons=yes
SetupIconFile={#MyAppIcon} SetupIconFile={#MyAppIcon}
UninstallDisplayIcon={app}\{#MyAppExeName} UninstallDisplayIcon={app}\{#MyAppExeName}
; you will likely have to remove the following signtool line when testing/debugging localy. Don't include that change in PRs. ; you will likely have to remove the following signtool line when testing/debugging locally. Don't include that change in PRs.
SignTool= signtool SignTool= signtool
LicenseFile= LICENSE LicenseFile= LICENSE
WizardStyle= modern WizardStyle= modern

View File

@ -29,7 +29,7 @@ ArchitecturesAllowed=x64
AllowNoIcons=yes AllowNoIcons=yes
SetupIconFile={#MyAppIcon} SetupIconFile={#MyAppIcon}
UninstallDisplayIcon={app}\{#MyAppExeName} UninstallDisplayIcon={app}\{#MyAppExeName}
; you will likely have to remove the following signtool line when testing/debugging localy. Don't include that change in PRs. ; you will likely have to remove the following signtool line when testing/debugging locally. Don't include that change in PRs.
SignTool= signtool SignTool= signtool
LicenseFile= LICENSE LicenseFile= LICENSE
WizardStyle= modern WizardStyle= modern