From 968b8aab0196f0e8b7454c7188d0c5f9c216e9a4 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Mon, 13 Feb 2023 22:59:46 +0000 Subject: [PATCH] Bug fix + Sanity check * Fixed Cho's Sweater 2 * Added sanity check for mismatched number of textures and colours for clothing items, with a user-friendly warning rather than a hard crash --- game/characters/cho/clothes/top/top_sweater_2/1.webp | 3 --- game/scripts/characters/tonks/events/intro.rpy | 2 ++ game/scripts/doll/clothes.rpy | 12 +++++++++--- 3 files changed, 11 insertions(+), 6 deletions(-) delete mode 100644 game/characters/cho/clothes/top/top_sweater_2/1.webp diff --git a/game/characters/cho/clothes/top/top_sweater_2/1.webp b/game/characters/cho/clothes/top/top_sweater_2/1.webp deleted file mode 100644 index b6b1d3ab..00000000 --- a/game/characters/cho/clothes/top/top_sweater_2/1.webp +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cb7d166b27b8355520d9632775867676c0107eaa3007a07a78f596a1f725bda5 -size 4906 diff --git a/game/scripts/characters/tonks/events/intro.rpy b/game/scripts/characters/tonks/events/intro.rpy index d1360fbc..4cc1490d 100644 --- a/game/scripts/characters/tonks/events/intro.rpy +++ b/game/scripts/characters/tonks/events/intro.rpy @@ -714,6 +714,8 @@ label tonks_intro_E3: $ achievements.unlock("unlockton", True) call popup("{size=-4}You can now summon Tonks into your office.{/size}", "Character unlocked!", "interface/icons/head/tonks.webp") + gen "(Now that the matter is resolved, I guess I can get back to teaching Hermione...)" + $ tonks_busy = True $ tonks_intro.E3_complete = True diff --git a/game/scripts/doll/clothes.rpy b/game/scripts/doll/clothes.rpy index 661ca4a3..b4e2f5e4 100644 --- a/game/scripts/doll/clothes.rpy +++ b/game/scripts/doll/clothes.rpy @@ -166,7 +166,8 @@ init python: try: bounds = self.get_layers(hash).get("outline", [sprites[0][1]])[0] except IndexError: - return Text(f"Error\n{{color=#00ffff}}{{size=-6}}ID:{self.id}{{/size}}{{/color}}", color="#ff0000") + print(f"Missing textures:\n{self.__repr__()}") + return Text(f"TexErr\n{{color=#00ffff}}{{size=-6}}ID:{self.id}{{/size}}{{/color}}", color="#ff0000") sprites.extend(self.char.body.build_image(self.char.body._hash, matrix=matrix)) sprites.sort(key=itemgetter(2)) @@ -197,8 +198,13 @@ init python: def apply_color(self, img, n): """Takes image and int layer number. Used internally.""" - c = TintMatrix(self.color[n]) - return Transform(img, matrixcolor=c) + try: + c = TintMatrix(self.color[n]) + return Transform(img, matrixcolor=c) + except IndexError: + print(f"Mismatched number of textures and colors:\n{self.__repr__()}") + d = At(Frame(Text("IndxErr", color="#ff0000"), tile=True), blink_repeat) + return Transform(AlphaMask(d, img)) def set_color(self, n): """Takes int layer number for manual color picking or a list to replace the cloth color in its entirety."""