core: Option to skip "unused" item links (#4608)

* core:  Option to skip "unused" item links

* Update worlds/generic/docs/advanced_settings_en.md

Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>

* Update BaseClasses.py

Co-authored-by: Scipio Wright <scipiowright@gmail.com>

---------

Co-authored-by: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com>
Co-authored-by: Scipio Wright <scipiowright@gmail.com>
This commit is contained in:
Katelyn Gigante
2025-10-01 02:39:04 +10:00
committed by GitHub
parent 49f2d30587
commit 448f214cdb
3 changed files with 7 additions and 2 deletions

View File

@@ -261,6 +261,7 @@ class MultiWorld():
"local_items": set(item_link.get("local_items", [])),
"non_local_items": set(item_link.get("non_local_items", [])),
"link_replacement": replacement_prio.index(item_link["link_replacement"]),
"skip_if_solo": item_link.get("skip_if_solo", False),
}
for _name, item_link in item_links.items():
@@ -284,6 +285,8 @@ class MultiWorld():
for group_name, item_link in item_links.items():
game = item_link["game"]
if item_link["skip_if_solo"] and len(item_link["players"]) == 1:
continue
group_id, group = self.add_group(group_name, game, set(item_link["players"]))
group["item_pool"] = item_link["item_pool"]

View File

@@ -1446,6 +1446,7 @@ class ItemLinks(OptionList):
Optional("local_items"): [And(str, len)],
Optional("non_local_items"): [And(str, len)],
Optional("link_replacement"): Or(None, bool),
Optional("skip_if_solo"): Or(None, bool),
}
])

View File

@@ -220,6 +220,7 @@ Timespinner:
- Twin Pyramid Key
- Timespinner Wheel
replacement_item: null
skip_if_solo: true
```
#### This is a fully functional yaml file that will do all the following things:
@@ -262,7 +263,7 @@ Timespinner:
* For `Timespinner` all players in the `TSAll` item link group will share their entire item pool and the `Twin Pyramid
Key` and `Timespinner Wheel` will be forced among the worlds of those in the group. The `null` replacement item
will, instead of forcing a specific chosen item, allow the generator to randomly pick a filler item to replace the
player items.
player items. This item link will only be created if there are at least two players in the group.
* `triggers` allows us to define a trigger such that if our `smallkey_shuffle` option happens to roll the `any_world`
result it will also ensure that `bigkey_shuffle`, `map_shuffle`, and `compass_shuffle` are also forced to the
`any_world` result. More information on triggers can be found in the