Mods loader

* Simplified and improved mods loading process by utilising the newly added include_module method
* Added sanity checks for mods toggles
* Added scripts list to mods list dict
* Added ToggleMod action
* Require restart to load mods
* Fixed mods not loading at certain times
This commit is contained in:
LoafyLemon 2023-03-07 19:29:29 +00:00
parent c03a75eb4b
commit 7819207253
2 changed files with 66 additions and 153 deletions

View File

@ -9,12 +9,15 @@ screen mods():
default selection = next(iter(mods_list.keys()))
default checkbox_enabled = gui.theme("check_true")
default checkbox_disabled = gui.theme("check_false")
default mods_enabled_now = set(persistent.mods_enabled)
$ awaits_restart = bool(mods_enabled_now != persistent.mods_enabled)
fixed:
## The grid of file slots.
hbox:
spacing 5
vpgrid:
cols 1
scrollbars "vertical"
@ -37,8 +40,9 @@ screen mods():
$ enabled = bool(name in persistent.mods_enabled)
$ selected = (name == selection)
if selected:
$ action = Function(toggle_mod, name)
$ action = ToggleMod(name)
else:
$ action = SetScreenVariable("selection", name)
@ -70,6 +74,8 @@ screen mods():
else:
add checkbox_disabled align (0.95, 0.5)
if awaits_restart:
text "Awaiting game restart to apply changes..."
frame:
style gui.theme("frame")

File diff suppressed because it is too large Load Diff