Skip to content

Core: remove start_inventory_from_pool from early_items #2579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
for item_name, count in world.start_inventory_from_pool.setdefault(player, StartInventoryPool({})).value.items():
for _ in range(count):
world.push_precollected(world.create_item(item_name, player))
# remove from_pool items also from early items handling, as starting is plenty early.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this snippet would be way easier to read and understand with slightly improved variable names. For example, "early" is used twice, in mutually exclusive usages (assign, then read, then assign again, then read again), so if it was two variables, making the difference between both usages more clear, it would be a good improvement

early = world.early_items[player].get(item_name, 0)
if early:
world.early_items[player][item_name] = max(0, early-count)
remaining_count = count-early
if remaining_count > 0:
early = world.early_local_items[player].get(item_name, 0)
if early:
world.early_items[player][item_name] = max(0, early - remaining_count)

logger.info('Creating World.')
AutoWorld.call_all(world, "create_regions")
Expand Down