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",
"Version": "1.0.0",
"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,
# make sure the variable name is unique, preferably starting with mod name.
default MyMod_ponytail = DollCloth(
modpath="MyMod", # File path; Usually a mod folder name. (case insensitive)
default ExampleMod_ponytail = DollCloth(
modpath="ExampleMod", # File path; Usually a mod folder name. (case insensitive)
name="hermione", # Character name (case sensitive)
categories=("head","hair"), # Main category and subcategory of the item (case sensitive)
type="hair", # Item type (case sensitive)

View File

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

View File

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

View File

@ -140,6 +140,13 @@ init python:
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:
raise Exception("Loaded save file is incompatible. (Save Version: {}, Game Version: {})".format(current, latest))