Skip to content

Commit

Permalink
Make fomod matching logic work in more cases
Browse files Browse the repository at this point in the history
Some mods (like Water for ENB) expect to disqualify a potential plugin
from inclusion when user selections cause that flag to be absent.

This has been fixed, so Water for ENB (and any other fomods that work
like this) are functioning properly now when used with the 'configure'
command.
  • Loading branch information
cyberrumor committed Apr 5, 2024
1 parent 7301883 commit 4b96133
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ammo/fomod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ def _flags_match(self, flags: dict, operator=None) -> bool:
continue
# A single match.
match = True
elif operator == "and":
# Missing flags counts as failure for 'and'.
return False
return match

def _select(self, index: int) -> None:
Expand Down Expand Up @@ -342,11 +345,10 @@ def _get_nodes(self) -> list[ElementTree.Element]:
# can't find files for this, no point in checking whether to include.
continue

if not dependency:
if not dependency.flags:
# No requirements for these files to be used.
selected_nodes.extend(xml_files)

if self._flags_match(dependency.flags, dependency.operator):
elif self._flags_match(dependency.flags, dependency.operator):
selected_nodes.extend(xml_files)

xml_required_files = self.xml_root_node.find("requiredInstallFiles") or []
Expand Down

0 comments on commit 4b96133

Please sign in to comment.