From 3586bba2113c051b2848a25f6a20d753f49e18a1 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Wed, 8 Feb 2023 17:37:12 +0000 Subject: [PATCH] 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 --- game/scripts/doll/clothes.rpy | 2 +- game/scripts/doll/cum.rpy | 2 +- game/scripts/doll/face.rpy | 2 +- game/scripts/doll/main.rpy | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/game/scripts/doll/clothes.rpy b/game/scripts/doll/clothes.rpy index 73ac0f06..260d82d6 100644 --- a/game/scripts/doll/clothes.rpy +++ b/game/scripts/doll/clothes.rpy @@ -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) diff --git a/game/scripts/doll/cum.rpy b/game/scripts/doll/cum.rpy index 8abf3a94..d946bc57 100644 --- a/game/scripts/doll/cum.rpy +++ b/game/scripts/doll/cum.rpy @@ -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]) diff --git a/game/scripts/doll/face.rpy b/game/scripts/doll/face.rpy index 2603127e..0aeeccfd 100644 --- a/game/scripts/doll/face.rpy +++ b/game/scripts/doll/face.rpy @@ -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) diff --git a/game/scripts/doll/main.rpy b/game/scripts/doll/main.rpy index a998d9b0..6989ebb7 100644 --- a/game/scripts/doll/main.rpy +++ b/game/scripts/doll/main.rpy @@ -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] )