mirror of
https://github.com/ArchipelagoMW/Archipelago.git
synced 2026-04-03 02:33:42 -07:00
Core: add creation reason to filler
This commit is contained in:
4
Fill.py
4
Fill.py
@@ -316,7 +316,7 @@ def remaining_fill(multiworld: MultiWorld,
|
||||
for item in unplaced_items:
|
||||
logging.debug(f"Moved {item} to start_inventory to prevent fill failure.")
|
||||
multiworld.push_precollected(item)
|
||||
last_batch.append(multiworld.worlds[item.player].create_filler())
|
||||
last_batch.append(multiworld.worlds[item.player].create_filler("panic_fill"))
|
||||
remaining_fill(multiworld, locations, unplaced_items, name + " Start Inventory Retry")
|
||||
else:
|
||||
raise FillError(f"No more spots to place {len(unplaced_items)} items. Remaining locations are invalid.\n"
|
||||
@@ -521,7 +521,7 @@ def distribute_items_restrictive(multiworld: MultiWorld,
|
||||
for item in progitempool:
|
||||
logging.debug(f"Moved {item} to start_inventory to prevent fill failure.")
|
||||
multiworld.push_precollected(item)
|
||||
filleritempool.append(multiworld.worlds[item.player].create_filler())
|
||||
filleritempool.append(multiworld.worlds[item.player].create_filler("panic_fill"))
|
||||
logging.warning(f"{len(progitempool)} items moved to start inventory,"
|
||||
f" due to failure in Progression fill step.")
|
||||
progitempool[:] = []
|
||||
|
||||
3
Main.py
3
Main.py
@@ -181,7 +181,8 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
|
||||
logger.warning(f"{player_name} tried to remove items from their pool that don't exist: {unfound_items}")
|
||||
|
||||
needed_items = target_per_player[player] - sum(unfound_items.values())
|
||||
new_itempool += [multiworld.worlds[player].create_filler() for _ in range(needed_items)]
|
||||
new_itempool += [multiworld.worlds[player].create_filler("start_inventory_from_pool")
|
||||
for _ in range(needed_items)]
|
||||
|
||||
assert len(multiworld.itempool) == len(new_itempool), "Item Pool amounts should not change."
|
||||
multiworld.itempool[:] = new_itempool
|
||||
|
||||
@@ -17,6 +17,10 @@ if TYPE_CHECKING:
|
||||
from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance
|
||||
from . import GamesPackage
|
||||
from settings import Group
|
||||
from typing import Literal
|
||||
reason_type = Optional[Literal["item_link", "panic_fill", "start_inventory_from_pool", "world"]]
|
||||
else:
|
||||
reason_type = Optional[str]
|
||||
|
||||
perf_logger = logging.getLogger("performance")
|
||||
|
||||
@@ -527,7 +531,7 @@ class World(metaclass=AutoWorldRegister):
|
||||
return False
|
||||
|
||||
# following methods should not need to be overridden.
|
||||
def create_filler(self) -> "Item":
|
||||
def create_filler(self, reason: reason_type = None) -> "Item":
|
||||
return self.create_item(self.get_filler_item_name())
|
||||
|
||||
# convenience methods
|
||||
|
||||
@@ -142,7 +142,7 @@ class SubnauticaWorld(World):
|
||||
|
||||
# resource bundle filler
|
||||
for _ in range(extras):
|
||||
item = self.create_filler()
|
||||
item = self.create_filler("world")
|
||||
item = cast(SubnauticaItem, item)
|
||||
pool.append(item)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user