Core: remove sending_visible (#339)

* Core: remove sending_visible
Only used by Factorio and that use predates start_location_hints, which works perfectly fine for this purpose.

* Factorio: minor cleanup
This commit is contained in:
Fabian Dill 2022-03-24 17:15:52 +01:00 committed by GitHub
parent c12d8e2f46
commit 75de616465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 11 deletions

View File

@ -342,12 +342,9 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
for player, world_precollected in world.precollected_items.items()}
precollected_hints = {player: set() for player in range(1, world.players + 1 + len(world.groups))}
sending_visible_players = set()
for slot in world.player_ids:
slot_data[slot] = world.worlds[slot].fill_slot_data()
if world.worlds[slot].sending_visible:
sending_visible_players.add(slot)
def precollect_hint(location):
entrance = er_hint_data.get(location.player, {}).get(location.address, "")
@ -367,9 +364,7 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
assert location.item.code is not None
locations_data[location.player][location.address] = \
location.item.code, location.item.player, location.item.flags
if location.player in sending_visible_players:
precollect_hint(location)
elif location.name in world.start_location_hints[location.player]:
if location.name in world.start_location_hints[location.player]:
precollect_hint(location)
elif location.item.name in world.start_hints[location.item.player]:
precollect_hint(location)

View File

@ -132,10 +132,6 @@ class World(metaclass=AutoWorldRegister):
item_names: Set[str] # set of all potential item names
location_names: Set[str] # set of all potential location names
# If the game displays all contained items to the user, this flag pre-fills the hint system with this information
# For example the "full" tech tree information option in Factorio
sending_visible: bool = False
web: WebWorld = WebWorld()
def __init__(self, world: MultiWorld, player: int):

View File

@ -57,6 +57,7 @@ class Factorio(World):
attack_traps_wanted = self.world.attack_traps[player].value
traps_wanted = ["Evolution Trap"] * evolution_traps_wanted + ["Attack Trap"] * attack_traps_wanted
self.world.random.shuffle(traps_wanted)
for tech_name in base_tech_table:
if traps_wanted and tech_name in useless_technologies:
self.world.itempool.append(self.create_item(traps_wanted.pop()))
@ -71,11 +72,15 @@ class Factorio(World):
self.world.get_location(tech_name, player).place_locked_item(tech_item)
else:
self.world.itempool.append(tech_item)
map_basic_settings = self.world.world_gen[player].value["basic"]
if map_basic_settings.get("seed", None) is None: # allow seed 0
map_basic_settings["seed"] = self.world.slot_seeds[player].randint(0, 2 ** 32 - 1) # 32 bit uint
self.sending_visible = self.world.tech_tree_information[player] == TechTreeInformation.option_full
# used to be called "sending_visible"
if self.world.tech_tree_information[player] == TechTreeInformation.option_full:
# mark all locations as pre-hinted
self.world.start_location_hints[self.player].value.update(base_tech_table)
generate_output = generate_mod