Compare commits

...

3 Commits

Author SHA1 Message Date
6b6ad56af4 Update existing code 2024-04-05 23:29:37 +02:00
0f80487dfc Remove the register function 2024-04-05 23:28:11 +02:00
42d2a17a6a Move the static values to a defined constant
That way it's not saved and it can be upgraded from version to version
2024-04-05 23:26:55 +02:00
2 changed files with 16 additions and 13 deletions

View File

@ -1,3 +1,6 @@
# will be populated by the chibi inits
define __poses = {}
init 5 python: init 5 python:
class DollChibi(renpy.Displayable): class DollChibi(renpy.Displayable):
@ -21,7 +24,10 @@ init 5 python:
if doll is None: if doll is None:
doll = states.dolls[name] doll = states.dolls[name]
self.char = doll self.char = doll
self.poses = poses or {}
__poses[name] = {}
if poses is not None:
self.poses.update(poses)
# Animation # Animation
self.anim_frames = None self.anim_frames = None
@ -42,11 +48,10 @@ init 5 python:
self.instances[name] = self self.instances[name] = self
def register(self, pose, frames, size): # no setter, on purpose
self.poses[pose] = (frames, size) @property
def poses(self):
if config.developer: return __poses[self.name]
print(f"Registered \"{pose}\" pose for {self.name}")
@functools.cache @functools.cache
def build_image(self, hash, pose): def build_image(self, hash, pose):
@ -366,7 +371,10 @@ init 5 python:
init offset = 5 init offset = 5
default hooch_chibi = DollChibi(name="hooch", doll=hooch) default hooch_chibi = DollChibi(name="hooch", doll=hooch, poses=dict(
stand=(1, (600, 800)),
walk=(8, (600, 800)),
))
# default cho_chibi_new = DollChibi(name="cho", doll=cho) # default cho_chibi_new = DollChibi(name="cho", doll=cho)
# default tonks_chibi_new = DollChibi(name="tonks", doll=tonks, poses=dict( # default tonks_chibi_new = DollChibi(name="tonks", doll=tonks, poses=dict(
# stand=(1, (600, 800)), # stand=(1, (600, 800)),

View File

@ -16,9 +16,4 @@ init python:
char.set_face(mouth="base", eyes="base", eyebrows="base", pupils="mid", cheeks="none", tears="none") char.set_face(mouth="base", eyes="base", eyebrows="base", pupils="mid", cheeks="none", tears="none")
def chibi_init(): config.start_callbacks.append(wardrobe_init)
# TODO: Perhaps it could be automated?
hooch_chibi.register("stand", 1, (600, 800))
hooch_chibi.register("walk", 8, (600, 800))
config.start_callbacks.extend([wardrobe_init, chibi_init])