Archipelago
Archipelago copied to clipboard
Core: Actually take item from pool when plandoing from_pool
When plandoing from_pool, currently it creates a new copy of the desired item using the worlds create_item.
This means that in later stages, any reference the world kept to the item is lost. The only way to consistently find your items is by using... well, find_items, which is slow.
Two specific use cases I can think of:
- Hints. Witness has recently switched over to keeping references to its items instead of using find_item_locations for generating in-game hints. But, because of this, it lost the ability to hint plandoed items, even if plandoed from_pool.
- Knowing that an item was plandoed or otherwise removed from the itempool. With this PR, there is now a 1:1 relationship between "has been taken out of the itempool" and
item.location is not None
This PR makes it so the item is actually taken from the itempool and then that copy of it is used.´
Tested: All four combinations of "from_pool: true/false" and "force: true/false" on a Witness world, also making sure that if the same item is plandoed multiple times, it doesn't try to plando the same copy twice. Did not test it on any other worlds. I'm not sure
Sort of meh thing: Each item now uses a "next" operation and then a "pop" operation on the multiworld.itempool, for the same item. I couldn't work out a way to only perform one O(n) operation the itempool. It doesn't seem like there is a version of "list.pop" with a condition - If someone knows something like that, I would instead pop the item from the list, and then put it back if placing it wasn't successful.
My first venture into Core. Let's see how horribly I did