Skip to content

Commit

Permalink
Auto-sort .esm and .esl files before .esp files
Browse files Browse the repository at this point in the history
Technically this is only correct for Fallout 4, Skyrim Special Edition
and Skyrim VR, but shouldn't hurt anything for other games.
  • Loading branch information
cyberrumor committed Mar 24, 2024
1 parent 1e7647f commit 4a8c08a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ammo/mod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,16 @@ def sort(self) -> None:
):
plugins.insert(0, plugin)
break
result = []
for plugin in list(plugins):
if any([plugin.name.lower().endswith(i) for i in [".esl", ".esm"]]):
result.append(plugins.pop(plugins.index(plugin)))

result.extend(plugins)

if self.changes is False:
self.changes = self.plugins != plugins
self.plugins = plugins
self.changes = self.plugins != result
self.plugins = result

def rename(self, component: RenameEnum, index: int, name: str) -> None:
"""
Expand Down

0 comments on commit 4a8c08a

Please sign in to comment.