Skip to content

Commit

Permalink
Activate all mods ignores unconfigured fomods
Browse files Browse the repository at this point in the history
Historically, 'activate mod all' would activate all mods up until it
encountered a warning, at which point it would stop trying to activate
further mods. This was causing self._stage() to not get run, which was
causing issues with the conflict detection system.

Instead of ensuring self._stage() runs even if there's a warning, just
keep attempting to activate the rest of the mods and store warnings.
After this, run self._stage() then display all warnings encountered.

This means all mods will have activation attempted, even if they were
sorted after an unconfigured fomod.

This also fixes the problem of the collision detection system not
working when a warning was raised from this.
  • Loading branch information
cyberrumor committed Mar 31, 2024
1 parent 5a34168 commit 09ce66f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ammo/mod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,17 +564,25 @@ def activate(self, component: ComponentEnum, index: Union[int, str]) -> None:
if index != "all":
raise Warning(f"Expected int, got '{index}'")

warnings = []

if index == "all":
for i in range(len(self.__dict__[f"{component.value}s"])):
if self.__dict__[f"{component.value}s"][i].visible:
self._set_component_state(component, i, True)
try:
self._set_component_state(component, i, True)
except Warning as e:
warnings.append(e)
else:
try:
self._set_component_state(component, index, True)
except IndexError as e:
# Demote IndexErrors
raise Warning(e)

self._stage()
if warnings:
raise Warning("\n".join(set([i.args[0] for i in warnings])))

def deactivate(self, component: ComponentEnum, index: Union[int, str]) -> None:
"""
Expand Down

0 comments on commit 09ce66f

Please sign in to comment.