Modding support

* Added the ability to add fan-made characters, and to modify the existing ones through modpath overrides
* Changed modpath initialisation to automatically add 'mods/' directory
This commit is contained in:
LoafyLemon 2023-02-08 17:37:12 +00:00
parent 4061dcceeb
commit 3586bba211
4 changed files with 6 additions and 4 deletions

View File

@ -24,7 +24,7 @@ init python:
self.unlocked = unlocked
self.level = level
self.blacklist = blacklist
self.modpath = posixpath.normpath(modpath) if modpath else ""
self.modpath = "mods/" + posixpath.normpath(modpath) if modpath else ""
self.parent = parent
self.char = eval(name)

View File

@ -53,7 +53,7 @@ init python:
if part in face_layers:
zorder = face_layers.get(part)
identifier = active_faces.get(part, "default")
path = os.path.join("characters", self.char.name, self.char.pose, "cum", part, name, identifier)
path = os.path.join(self.char.modpath, "characters", self.char.name, self.char.pose, "cum", part, name, identifier)
else:
cloth, zorder, is_worn = active_clothes.get(part, [None, None, None])

View File

@ -41,7 +41,7 @@ init python:
if name is None:
continue
path = os.path.join("characters", self.char.name, self.char.pose, "face", part, name)
path = os.path.join(self.char.modpath, "characters", self.char.name, self.char.pose, "face", part, name)
for f in renpy.list_files():
fp, fn = os.path.split(f)

View File

@ -46,7 +46,7 @@ init python:
"headgear": 281
}
def __init__(self, name):
def __init__(self, name, modpath=None):
self.wardrobe = {}
self.wardrobe_list = []
self.blacklist = []
@ -72,6 +72,8 @@ init python:
self.xzoom = 1
self.align = (0.5, 1.0)
self.modpath = "mods/" + posixpath.normpath(modpath) if modpath else ""
def generate_hash(self):
clothes_hash = str([x[0]._hash for x in self.states.values() if istype(x[0], (DollCloth, DollClothDynamic, DollMakeup)) and x[2]])
salt = str( [self.name, self.pose, str(self.body._hash), str(self.face._hash), str(self.cum._hash), clothes_hash] )