LoafyLemon
2d7a84bf00
* Fixed Genie flashing his goods in stats menu * Fixed lipstick causing a crash in saved outfits due to missing zlayers * Fixed debug print spam * Version bump
69 lines
2.7 KiB
Plaintext
69 lines
2.7 KiB
Plaintext
init python:
|
|
class DollLipstick(DollCloth):
|
|
|
|
def set_imagepath(self):
|
|
self.imagepath = "{}/characters/{}/clothes/makeup/lipstick/".format(self.modpath, self.name)
|
|
|
|
def set_layers(self):
|
|
for x in self.layers_special:
|
|
if x == "zorder":
|
|
self.__dict__["zlayers"] = [f for f in renpy.list_files() if f.startswith(self.imagepath.lstrip("/")) and "zorder" in f]
|
|
else:
|
|
self.__dict__[x] = None
|
|
|
|
for x in self.layers_additional:
|
|
self.__dict__[x] = []
|
|
for i in xrange(self.layers):
|
|
path = "{}{}_{}.webp".format(self.imagepath, i, x)
|
|
if renpy.loadable(path):
|
|
self.__dict__[x].append(path)
|
|
self.__dict__[x+"_outline"] = None
|
|
|
|
return
|
|
|
|
def build_image(self):
|
|
mouth = self.char.face.face["mouth"][0]
|
|
sprites = ((self.apply_color("{}{}.webp".format(self.imagepath, mouth), 0)), )
|
|
return sprites
|
|
|
|
def build_icon(self):
|
|
mouth = "base" #HARDCODED
|
|
sprites = (self.char.body.get_mannequin([self]), self.apply_color("{}{}.webp".format(self.imagepath, mouth), 0), )
|
|
bounds = "{}{}.webp".format(self.imagepath, mouth)
|
|
|
|
wmax, hmax = self.sizes
|
|
wmin = hmin = 96
|
|
|
|
x, y, w, h = crop_whitespace(bounds)
|
|
xoffset, yoffset = w/2, h/2
|
|
|
|
w = h = max(w, h, wmin, hmin)
|
|
|
|
w = max(wmin, w + w/2)
|
|
h = max(hmin, h + h/2)
|
|
|
|
x = clamp( (x - w/2) + xoffset, 0, wmax)
|
|
y = clamp( (y - h/2) + yoffset, 0, hmax)
|
|
|
|
# Forbid exceeding the image height.
|
|
if y+h > hmax:
|
|
y = hmax-h
|
|
|
|
return Transform(Fixed(*sprites, fit_first=True), crop=(x, y, w, h))
|
|
|
|
def set_pose(self, pose):
|
|
if pose is None:
|
|
path = "{}/characters/{}/clothes/makeup/lipstick/".format(self.modpath, self.name)
|
|
self.imagepath = path
|
|
else:
|
|
path = "{}/characters/{}/poses/{}/clothes/makeup/lipstick/".format(self.modpath, self.name, pose)
|
|
if renpy.loadable(path + "base.webp"):
|
|
self.imagepath = path
|
|
|
|
self.rebuild_image()
|
|
return
|
|
|
|
def clone(self):
|
|
"""Creates a clone of this lipstick object. Since it requires a parent object it should be used internally only to avoid object depth issue."""
|
|
return DollLipstick(self.name, self.categories, self.type, self.id, [x[:] for x in self.color], self.zorder, self.unlocked, self.level, self.blacklist, self, self.armfix, self.modpath)
|