From babbc11cf06478be8a1cf1b4a1f8c0914ffce35d Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Sun, 14 May 2023 17:31:31 +0100 Subject: [PATCH] Bug fixes and improvements * Implemented sort method for DollCloth types * Fixed opacity matrix multiplications * Fixed wardrobe outfit hash mismatch due to inserted body layers in compare objects --- game/scripts/doll/clothes.rpy | 9 +++++++-- game/scripts/doll/main.rpy | 4 ++-- game/scripts/doll/outfits.rpy | 3 ++- game/scripts/events/ending.rpy | 2 +- game/scripts/events/quests.rpy | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/game/scripts/doll/clothes.rpy b/game/scripts/doll/clothes.rpy index bf25a849..8faba64e 100644 --- a/game/scripts/doll/clothes.rpy +++ b/game/scripts/doll/clothes.rpy @@ -54,6 +54,11 @@ init python: return NotImplemented return self._hash == obj._hash + def __lt__(self, obj): + if not isinstance(obj, DollCloth): + return NotImplemented + return self._hash < obj._hash + def generate_hash(self): salt = str( [self.name, self.char.pose, self.type, self.id, str(self.color), str(self.char.body._hash)] ) return hash(salt) @@ -200,8 +205,8 @@ init python: def apply_color(self, img, n): """Takes image and int layer number. Used internally.""" try: - c = TintMatrix(self.color[n]) - return Transform(img, matrixcolor=c) + c = self.color[n] + return Transform(img, matrixcolor=TintMatrix(c)*OpacityMatrix(c.alpha)) except TypeError: print(f"Item doesn't support colors but was supplied with a list; Try removing numbered files in its directory:\n{self.__repr__()}") d = At(Frame(Text("TypeErr", color="#ffff00"), tile=True), blink_repeat) diff --git a/game/scripts/doll/main.rpy b/game/scripts/doll/main.rpy index 72ce386f..3abc7a0a 100644 --- a/game/scripts/doll/main.rpy +++ b/game/scripts/doll/main.rpy @@ -501,8 +501,8 @@ init python: return [x[0] for x in self.states.values() if istype(x[0], DollClothDynamic) and type == x[0].tracking] def create_outfit(self, temp=False): - """Creates a copy of the current character clothes and stores it.""" - return DollOutfit([x[0] for x in self.states.values() if x[0]], True, temp=temp) + """Creates a copy of the current character clothes and stores it. Used only for comparing instances inside the wardrobe.""" + return DollOutfit([x[0] for x in self.states.values() if x[0] and x[0].type not in self.body_layers], True, temp=temp) def import_outfit(self, path, fromfile=True): """Imports outfit from .png file or clipboard text.""" diff --git a/game/scripts/doll/outfits.rpy b/game/scripts/doll/outfits.rpy index 28f6d8ba..0c679b71 100644 --- a/game/scripts/doll/outfits.rpy +++ b/game/scripts/doll/outfits.rpy @@ -6,6 +6,7 @@ init python: def __init__(self, group, unlocked=False, name="", desc="", price=0, temp=False, schedule={}, hidden=False, addons=[]): self.group = [x.clone() if not x.parent else x for x in group] + self.group.sort() self.name = name self.desc = desc self.price = price @@ -34,7 +35,7 @@ init python: return self._hash == obj._hash def generate_hash(self): - salt = str( [self.name, str([x._hash for x in self.group]) ] ) + salt = str( [x._hash for x in self.group] ) return hash(salt) def delete(self): diff --git a/game/scripts/events/ending.rpy b/game/scripts/events/ending.rpy index 7742b344..2d3aa17c 100644 --- a/game/scripts/events/ending.rpy +++ b/game/scripts/events/ending.rpy @@ -2872,7 +2872,7 @@ Farewell, my little [word_03].{/size} pause 2 - $ states.her.ev.yule_ball.completed = True + $ states.her.ev.yule_ball.complete = True $ persistent.game_complete = True $ persistent.gold = game.gold diff --git a/game/scripts/events/quests.rpy b/game/scripts/events/quests.rpy index 20542535..261afa44 100644 --- a/game/scripts/events/quests.rpy +++ b/game/scripts/events/quests.rpy @@ -255,7 +255,7 @@ label quests: else: # Ending events - if states.her.ev.yule_ball.started and not states.her.ev.yule_ball.completed: + if states.her.ev.yule_ball.started and not states.her.ev.yule_ball.complete: jump ball_ending_E1 #