Fallback Support

* Added fallback support for clothing ids lacking chibi images
* Refactored various extension formats support
This commit is contained in:
LoafyLemon 2022-10-19 19:55:10 +01:00
parent c50a3cf6bd
commit 19c4d958c9
2 changed files with 19 additions and 5 deletions

BIN
game/characters/cho/chibi/stand/bottom/fallback/0.webp (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -11,6 +11,8 @@ init 5 python:
"extra": 1,
}
extensions = [ ".jpg", ".jpeg", ".png", ".webp" ]
def __init__(self, name, doll, pose="stand", layer="screens", zorder=12, zoom=0.28, *args, **properties):
super(DollChibi, self).__init__(**properties)
@ -59,7 +61,7 @@ init 5 python:
name, ext = os.path.splitext(os.path.basename(fn))
frame = name.split("_")[0]
if not ext.lower() in [ ".jpg", ".jpeg", ".png", ".webp" ]:
if not ext.lower() in self.extensions:
continue
d = renpy.displayable(fn)
@ -90,16 +92,25 @@ init 5 python:
suffix = f"_{layer}"
if name.endswith(suffix):
print(f"found {layer}")
zorder += modifier
cid = cid.removesuffix(suffix)
break
# Check if clothing type and id matches with the chibi clothing type and id
if (not equipped.type == ctype or
not equipped.id == cid):
# Check if clothing type matches
if not equipped.type == ctype:
continue
# Check if clothing id matches, if not, add fallback image instead
if not equipped.id == cid:
fpath = f"{path}/{ctype}/fallback/0"
for i in self.extensions:
f = fpath + i
if renpy.loadable(f):
d = renpy.displayable(f)
break
groups[frame].setdefault(zorder, []).append(d)
# Iterate through frame groups and nested zorder groups