parent
df3757657e
commit
8e68aa0ccd
|
@ -182,6 +182,7 @@ class Context:
|
||||||
self.minimum_client_versions: typing.Dict[int, Utils.Version] = {}
|
self.minimum_client_versions: typing.Dict[int, Utils.Version] = {}
|
||||||
self.seed_name = ""
|
self.seed_name = ""
|
||||||
self.groups = {}
|
self.groups = {}
|
||||||
|
self.group_collected: typing.Dict[int, typing.Set[int]] = {}
|
||||||
self.random = random.Random()
|
self.random = random.Random()
|
||||||
self.stored_data = {}
|
self.stored_data = {}
|
||||||
self.stored_data_notification_clients = collections.defaultdict(weakref.WeakSet)
|
self.stored_data_notification_clients = collections.defaultdict(weakref.WeakSet)
|
||||||
|
@ -433,6 +434,7 @@ class Context:
|
||||||
"client_connection_timers": tuple(
|
"client_connection_timers": tuple(
|
||||||
(key, value.timestamp()) for key, value in self.client_connection_timers.items()),
|
(key, value.timestamp()) for key, value in self.client_connection_timers.items()),
|
||||||
"random_state": self.random.getstate(),
|
"random_state": self.random.getstate(),
|
||||||
|
"group_collected": dict(self.group_collected),
|
||||||
"stored_data": self.stored_data,
|
"stored_data": self.stored_data,
|
||||||
"game_options": {"hint_cost": self.hint_cost, "location_check_points": self.location_check_points,
|
"game_options": {"hint_cost": self.hint_cost, "location_check_points": self.location_check_points,
|
||||||
"server_password": self.server_password, "password": self.password, "forfeit_mode":
|
"server_password": self.server_password, "password": self.password, "forfeit_mode":
|
||||||
|
@ -487,6 +489,9 @@ class Context:
|
||||||
self.item_cheat = savedata["game_options"]["item_cheat"]
|
self.item_cheat = savedata["game_options"]["item_cheat"]
|
||||||
self.compatibility = savedata["game_options"]["compatibility"]
|
self.compatibility = savedata["game_options"]["compatibility"]
|
||||||
|
|
||||||
|
if "group_collected" in savedata:
|
||||||
|
self.group_collected = savedata["group_collected"]
|
||||||
|
|
||||||
if "stored_data" in savedata:
|
if "stored_data" in savedata:
|
||||||
self.stored_data = savedata["stored_data"]
|
self.stored_data = savedata["stored_data"]
|
||||||
# count items and slots from lists for item_handling = remote
|
# count items and slots from lists for item_handling = remote
|
||||||
|
@ -765,7 +770,7 @@ def forfeit_player(ctx: Context, team: int, slot: int):
|
||||||
update_checked_locations(ctx, team, slot)
|
update_checked_locations(ctx, team, slot)
|
||||||
|
|
||||||
|
|
||||||
def collect_player(ctx: Context, team: int, slot: int):
|
def collect_player(ctx: Context, team: int, slot: int, is_group: bool = False):
|
||||||
"""register any locations that are in the multidata, pointing towards this player"""
|
"""register any locations that are in the multidata, pointing towards this player"""
|
||||||
all_locations = collections.defaultdict(set)
|
all_locations = collections.defaultdict(set)
|
||||||
for source_slot, location_data in ctx.locations.items():
|
for source_slot, location_data in ctx.locations.items():
|
||||||
|
@ -778,6 +783,14 @@ def collect_player(ctx: Context, team: int, slot: int):
|
||||||
register_location_checks(ctx, team, source_player, location_ids, count_activity=False)
|
register_location_checks(ctx, team, source_player, location_ids, count_activity=False)
|
||||||
update_checked_locations(ctx, team, source_player)
|
update_checked_locations(ctx, team, source_player)
|
||||||
|
|
||||||
|
if not is_group:
|
||||||
|
for group, group_players in ctx.groups.items():
|
||||||
|
if slot in group_players:
|
||||||
|
group_collected_players = ctx.group_collected.setdefault(group, set())
|
||||||
|
group_collected_players.add(slot)
|
||||||
|
if set(group_players) == group_collected_players:
|
||||||
|
collect_player(ctx, team, group, True)
|
||||||
|
|
||||||
|
|
||||||
def get_remaining(ctx: Context, team: int, slot: int) -> typing.List[int]:
|
def get_remaining(ctx: Context, team: int, slot: int) -> typing.List[int]:
|
||||||
items = []
|
items = []
|
||||||
|
|
Loading…
Reference in New Issue