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
This commit is contained in:
LoafyLemon 2023-05-14 17:31:31 +01:00
parent b610494c5f
commit babbc11cf0
5 changed files with 13 additions and 7 deletions

View File

@ -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)

View File

@ -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."""

View File

@ -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):

View File

@ -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

View File

@ -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
#