From 8e569a1d1f5bd8e2b1694681bbcef70a6a1d605b Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Thu, 23 Sep 2021 03:48:37 +0200 Subject: [PATCH] AutoWorld: split remote_start_inventory out from remote_items --- Main.py | 2 ++ MultiServer.py | 4 +++- worlds/AutoWorld.py | 4 ++++ worlds/alttp/__init__.py | 1 + worlds/oot/__init__.py | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Main.py b/Main.py index a93eea15..339af646 100644 --- a/Main.py +++ b/Main.py @@ -302,6 +302,8 @@ def main(args, seed=None): "connect_names": {name: (0, player) for player, name in world.player_name.items()}, "remote_items": {player for player in world.player_ids if world.worlds[player].remote_items}, + "remote_start_inventory": {player for player in world.player_ids if + world.worlds[player].remote_start_inventory}, "locations": locations_data, "checks_in_area": checks_in_area, "server_options": get_options()["server_options"], diff --git a/MultiServer.py b/MultiServer.py index e7e382fe..ddf98100 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -84,6 +84,7 @@ class Context: self.connect_names = {} # names of slots clients can connect to self.allow_forfeits = {} self.remote_items = set() + self.remote_start_inventory = set() self.locations: typing.Dict[int, typing.Dict[int, typing.Tuple[int, int]]] = {} self.host = host self.port = port @@ -245,6 +246,7 @@ class Context: self.random.seed(self.seed_name) self.connect_names = decoded_obj['connect_names'] self.remote_items = decoded_obj['remote_items'] + self.remote_start_inventory = decoded_obj.get('remote_start_inventory', decoded_obj['remote_items']) self.locations = decoded_obj['locations'] self.slot_data = decoded_obj['slot_data'] self.er_hint_data = {int(player): {int(address): name for address, name in loc_data.items()} @@ -253,7 +255,7 @@ class Context: # award remote-items start inventory: for team in range(len(decoded_obj['names'])): for slot, item_codes in decoded_obj["precollected_items"].items(): - if slot in self.remote_items: + if slot in self.remote_start_inventory: 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(): self.hints[team, slot].update(hints) diff --git a/worlds/AutoWorld.py b/worlds/AutoWorld.py index ed965b17..1af2aa0e 100644 --- a/worlds/AutoWorld.py +++ b/worlds/AutoWorld.py @@ -91,6 +91,10 @@ class World(metaclass=AutoWorldRegister): # the client finds its own items in its own world. remote_items: bool = True + # If remote_start_inventory is true, the start_inventory/world.precollected_items is sent on connection, + # otherwise the world implementation is in charge of writing the items to their output data. + remote_start_inventory: bool = True + # For games where after a victory it is impossible to go back in and get additional/remaining Locations checked. # this forces forfeit: auto for those games. forced_auto_forfeit: bool = False diff --git a/worlds/alttp/__init__.py b/worlds/alttp/__init__.py index 07e44aa0..2011e177 100644 --- a/worlds/alttp/__init__.py +++ b/worlds/alttp/__init__.py @@ -42,6 +42,7 @@ class ALTTPWorld(World): data_version = 8 remote_items: bool = False + remote_start_inventory: bool = False set_rules = set_rules diff --git a/worlds/oot/__init__.py b/worlds/oot/__init__.py index 4d0bd005..903dd1ef 100644 --- a/worlds/oot/__init__.py +++ b/worlds/oot/__init__.py @@ -47,6 +47,7 @@ class OOTWorld(World): data[2] is not None} location_name_to_id = location_name_to_id remote_items: bool = False + remote_start_inventory: bool = False data_version = 1