diff --git a/game/mods/README.md b/game/mods/README.md index 834dc44..79b5248 100644 --- a/game/mods/README.md +++ b/game/mods/README.md @@ -1,12 +1,12 @@ --- MOD LOADER USAGE --- -If there's problems with installed mods - like if an enabled mod makes the game crash on startup - there's 3 file flags you can apply to work around it, checked only in the root of the mods folder: -- Any file starting with "DISABLEALLMODS". This will force disable all currently installed mods, but will still load all their metadata. Removing this flag will return the mod states to how it was previously. -- Any file starting with "NOLOADORDER". This will erase the load order/states and always load mods in folder alphabetical order, with mod states depending on the "Enable New Mods" option in the preferences menu. -- Any file starting with "NOMODS". This turns off mod loading entirely by making the game not find any metadata files to load. +If there's problems with installed mods - like if an enabled mod makes the game crash on startup - there's 3 file flags you can apply to work around it, checked only in the root of the mods folder. They will be any file starting with: +- "DISABLEALLMODS". This will force disable all currently installed mods, but will still load all their metadata. This doesn't change the saved states of your mods, so you can still enable/disable them while this flag is active. +- "NOLOADORDER". This will erase the load order/states and always load mods in folder alphabetical order, with mod states depending on the "Enable New Mods" option in the preferences menu. +- "NOMODS". This turns off mod loading entirely by making the game not find any metadata files to load. These file flags already exist in the mods folder, but renamed to not trigger in-game. Enable them by renaming the file to take off the first hyphen. -When ordering the mods in the mod menu, know that not all mod code will be loaded according to the order. Ren'Py has a feature called 'init' that will run code at certain mod-defined stages (priorities) of the engine starting up, so if one mod's init block is set to run at an earlier priority than another mod's, it doesn't what order it is in the mod loader, it will always load that init first. The only time when the order comes into effect is if 2 mod's init blocks run at the same priority, or aren't running in an init block. +When ordering the mods in the mod menu, know that not all mod code will be loaded according to the order. Ren'Py has a feature called 'init' that will run code at certain mod-defined stages (priorities) of the engine starting up, so if one mod's init block is set to run at an earlier priority than another mod's, it doesn't matter what order it is in the mod loader, it will always load that init first. The only time when the order comes into effect is if two mod's init blocks run at the same priority, or aren't running in an init block. --- MOD CREATION PRE-REQUSITES --- @@ -57,11 +57,11 @@ Below is all the possible entries you can put in, and explanations for what they "Display" : How your mod button appears if there's an icon image detected. This can be set to "name" - which only displays the mod name - "icon" - which only displays the icon, taking up the entire button - or "both" - which displays the name and icon together, with the icon miniaturized and to the side of the name. This defaults to "both" if it doesn't exist, and if an icon image is not present, it will fall back to "name" mode. - "Thumbnail Displayable" : What displayable to use for the thumbnail when the mod has loaded scripts. If this doesn't exist, the game will use the thumbnail image found alongside your metadata file + "Thumbnail Displayable" : What displayable to use for the thumbnail when the mod is enabled. If this doesn't exist, the game will use the thumbnail image found alongside your metadata file - "Icon Displayable" : What displayable to use for the icon when the mod has loaded scripts. If this doesn't exist, the game will use the icon image found alongside your metadata file + "Icon Displayable" : What displayable to use for the icon when the mod is enabled. If this doesn't exist, the game will use the icon image found alongside your metadata file - "Screenshot Displayables" : What displayables to use for screenshots when the mod has loaded scripts. This should be a list of strings. The game will choose each displayable in the list over images found alongside the metadata file sequentially, so if there's 5 screenshot images and 3 screenshot displayables, the last 2 will still display the screenshot images, and the first 3 will display the screenshot displayables. If there's more displayables than images, then the mod will appear to gain screenshots in the mod details pane when the mod is enabled. If you enter empty strings in the list ( "" ), the game will interpret that as a deliberate skipping over to load screenshot images instead of displayables, so if your list consists of '[ "", "my_displayable" ]' and there's any number of screenshot images found, the first screenshot will still show a screenshot image, and only the next one will show a displayable. If this entry doesn't exist, it will just use the screenshot images found alongside your metadata file. + "Screenshot Displayables" : What displayables to use for screenshots when the mod is enabled. This should be a list of strings. The game will choose each displayable in the list over images found alongside the metadata file sequentially, so if there's 5 screenshot images and 3 screenshot displayables, the last 2 will still display the screenshot images, and the first 3 will display the screenshot displayables. If there's more displayables than images, then the mod will appear to gain screenshots in the mod details pane when the mod is enabled. If you enter empty strings in the list ( "" ), the game will interpret that as a deliberate skipping over to load screenshot images instead of displayables, so if your list consists of '[ "", "my_displayable" ]' and there's any number of screenshot images found, the first screenshot will still show a screenshot image, and only the next one will show a displayable. If this entry doesn't exist, it will just use the screenshot images found alongside your metadata file. In the same directory as your metadata file, there's image files you can put in the to make your mod more appealing. These can be any of Ren'Py's supported image file types, so the file extension here is just for demonstration: diff --git a/game/options.rpy b/game/options.rpy index fb5c803..8d9c697 100644 --- a/game/options.rpy +++ b/game/options.rpy @@ -161,7 +161,7 @@ default persistent.show_mod_screenshots = True default persistent.gallery_edgescroll = True default persistent.scroll = False -init -999 python: +init -1000 python: if persistent.newmods_default_state == None: persistent.newmods_default_state = False diff --git a/game/src/mod_menu.rpy b/game/src/mod_menu.rpy index 308fb6f..115848d 100644 --- a/game/src/mod_menu.rpy +++ b/game/src/mod_menu.rpy @@ -538,7 +538,11 @@ init -999 python: for saved_mod_id, saved_mod_state in persistent.enabled_mods: for mod in mod_menu_metadata: if mod["ID"] == saved_mod_id: - mod["Enabled"] = saved_mod_state + # If this mod doesn't have any loadable scripts, treat it as on (Say, if a mod changed something in the base game and the label points there) + if not mod["Scripts"]: + mod["Enabled"] = True + else: + mod["Enabled"] = saved_mod_state temp_list.append(mod) break @@ -549,7 +553,7 @@ init -999 python: if mod["ID"] == saved_mod_id[0]: mod_not_found = False if mod_not_found: - # If this mod doesn't have any loadable scripts, treat it as on (Say, if a mod changed something in the base game and the label points there) + # Treat the mod as on if there's no scripts here too if not mod["Scripts"]: mod["Enabled"] = True # Otherwise set mods to the default state @@ -559,17 +563,17 @@ init -999 python: mod_menu_metadata = temp_list - # Rewrite enabled_mods to reflect the new mod order, and load all the mods + # Rewrite enabled_mods to reflect the new mod order, and load all the mod scripts persistent.enabled_mods.clear() for mod in mod_menu_metadata: persistent.enabled_mods.append( [ mod["ID"], mod["Enabled"] ] ) - # Making the load_mods check here makes it so the NOLOAD flag doesn't overwrite the previously saved load order + # Making the load_mods check here makes it so the DISABLEALLMODS flag doesn't overwrite the previously saved load order if load_mods and mod["Enabled"]: for script in mod["Scripts"]: renpy.include_module(script) - else: + elif mod["Scripts"]: mod["Enabled"] = False # Now convert our errorcodes to errorstrings