Bug fixes

* Fixed mods crashing on init in user space
* Fixed revertable types inside modding init
* Fixed semantic version crashing mod loader
* Updated example mod
This commit is contained in:
LoafyLemon 2023-07-15 18:02:01 +01:00
parent ba7ee49915
commit 01be33b5ee
9 changed files with 17 additions and 9 deletions

View File

@ -1,7 +1,7 @@
{ {
"Name": "MyMod", "Name": "ExampleMod",
"Author": "LoafyLemon", "Author": "LoafyLemon",
"Version": "1.0.0", "Version": "1.0.0",
"Description": "Adds ponytail hairstyle for Hermione", "Description": "Adds ponytail hairstyle for Hermione",
"GameVer": "1.45" "GameVer": "1.45.2"
} }

View File

@ -1,7 +1,7 @@
# Add new hairstyle for character as an instance of DollCloth, # Add new hairstyle for character as an instance of DollCloth,
# make sure the variable name is unique, preferably starting with mod name. # make sure the variable name is unique, preferably starting with mod name.
default MyMod_ponytail = DollCloth( default ExampleMod_ponytail = DollCloth(
modpath="MyMod", # File path; Usually a mod folder name. (case insensitive) modpath="ExampleMod", # File path; Usually a mod folder name. (case insensitive)
name="hermione", # Character name (case sensitive) name="hermione", # Character name (case sensitive)
categories=("head","hair"), # Main category and subcategory of the item (case sensitive) categories=("head","hair"), # Main category and subcategory of the item (case sensitive)
type="hair", # Item type (case sensitive) type="hair", # Item type (case sensitive)

View File

@ -34,7 +34,7 @@ screen mods():
$ desc = mod["Description"] $ desc = mod["Description"]
$ author = mod["Author"] $ author = mod["Author"]
$ version = mod["Version"] $ version = mod["Version"]
$ compat = float(mod["GameVer"]) $ compat = version_float(mod["GameVer"])
#$ order = mod["LoadOrder"] #$ order = mod["LoadOrder"]
$ logo = mod["Logo"] $ logo = mod["Logo"]
$ enabled = bool(name in persistent.mods_enabled) $ enabled = bool(name in persistent.mods_enabled)
@ -86,7 +86,7 @@ screen mods():
$ desc = mods_list[selection]["Description"] $ desc = mods_list[selection]["Description"]
$ author = mods_list[selection]["Author"] $ author = mods_list[selection]["Author"]
$ version = mods_list[selection]["Version"] $ version = mods_list[selection]["Version"]
$ compat = float(mods_list[selection]["GameVer"]) $ compat = version_float(mods_list[selection]["GameVer"])
#$ order = mods_list[selection]["LoadOrder"] #$ order = mods_list[selection]["LoadOrder"]
$ logo = mods_list[selection]["Logo"] $ logo = mods_list[selection]["Logo"]

View File

@ -4,9 +4,9 @@ init -999:
import os import os
if not getattr(persistent, "mods_enabled"): if not getattr(persistent, "mods_enabled"):
persistent.mods_enabled = set() persistent.mods_enabled = _set()
mods_list = dict() mods_list = _dict()
def mods_import(): def mods_import():
global mods_list global mods_list
@ -52,7 +52,8 @@ init -999:
try: try:
renpy.include_module(name) renpy.include_module(name)
except Exception as e: except Exception as e:
renpy.error(e) if config.developer:
renpy.error(e)
persistent.mods_enabled.remove(i) persistent.mods_enabled.remove(i)
mods_import() mods_import()

View File

@ -140,6 +140,13 @@ init python:
getattr(store, "letter_cards_store").wait = 7 getattr(store, "letter_cards_store").wait = 7
# Fix revertable types for modding
mods_enabled = getattr(persistent, "mods_enabled", _set())
setattr(persistent, "mods_enabled", _set(mods_enabled))
mods_list = getattr(persistent, "mods_list", _dict())
setattr(persistent, "mods_list", _dict(mods_list))
if current > latest: if current > latest:
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest)) raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest))