Compare commits
28 Commits
main
...
gouv-chibi
Author | SHA1 | Date | |
---|---|---|---|
4de4788b16 | |||
96767c63ae | |||
1a70aff3bc | |||
5f742d4525 | |||
e88fda5a2c | |||
6b6ad56af4 | |||
0f80487dfc | |||
42d2a17a6a | |||
0d8e91b5a5 | |||
314f971609 | |||
ec27f91904 | |||
e129921bc0 | |||
94b5ea15a5 | |||
923384eb37 | |||
c2d8c394a1 | |||
9befd927a8 | |||
e9ec437d1c | |||
dfd7972752 | |||
1e8f1ebfb8 | |||
878cec8c76 | |||
b49129ad1f | |||
34547cb0ad | |||
caa4cd0b2c | |||
cd63abd27b | |||
c0bc1cd69f | |||
00eda2aae5 | |||
ae5ff121d9 | |||
2525bea67d |
@ -73,30 +73,42 @@ python early hide:
|
||||
class chibi:
|
||||
@staticmethod
|
||||
def parse(l):
|
||||
who = l.simple_expression()
|
||||
action = l.simple_expression()
|
||||
who = l.require(l.name)
|
||||
action = l.require(l.name)
|
||||
arguments = l.arguments() # may be None
|
||||
l.expect_eol()
|
||||
|
||||
return (who, action)
|
||||
return (who, action, arguments)
|
||||
|
||||
def execute(self):
|
||||
print(f"{self}")
|
||||
who, action = self
|
||||
func = eval(f"{who}_chibi.{action}")
|
||||
print(self)
|
||||
who, action, arguments = self
|
||||
chibi = DollChibi.instances[who]
|
||||
method = getattr(chibi, action)
|
||||
if arguments is None:
|
||||
args, kwargs = (), {}
|
||||
else:
|
||||
args, kwargs = arguments.evaluate()
|
||||
method(*args, **kwargs)
|
||||
|
||||
# print(f"Execution: {who} {action}")
|
||||
|
||||
def lint(self):
|
||||
who, action = self
|
||||
try:
|
||||
chibi = eval(f"{who}_chibi")
|
||||
except Exception:
|
||||
who, action, arguments = self
|
||||
|
||||
if who not in DollChibi.instances:
|
||||
renpy.error(f"Character chibi not defined: {who}")
|
||||
|
||||
def predict(self):
|
||||
who, action = self
|
||||
chibi = DollChibi.instances[who]
|
||||
|
||||
chibi = eval(f"{who}_chibi")
|
||||
doll = eval(f"{who}")
|
||||
if not hasattr(chibi, action):
|
||||
renpy.error(f"Chibi action not defined: {who} {action}")
|
||||
|
||||
def predict(self):
|
||||
who, action, arguments = self
|
||||
|
||||
chibi = DollChibi.instances[who]
|
||||
doll = states.dolls[who]
|
||||
|
||||
layers = (
|
||||
l[0] for pose in chibi.poses.keys()
|
||||
@ -142,6 +154,23 @@ python early hide:
|
||||
|
||||
return {"blocks": blocks}
|
||||
|
||||
def lint(self):
|
||||
any_true = False
|
||||
for block, weight, condition in self["blocks"]:
|
||||
if not isinstance(weight, (int, float)):
|
||||
renpy.error(f"Weight must be a number, not {weight!r}")
|
||||
|
||||
if condition == "True":
|
||||
any_true = True
|
||||
else:
|
||||
try:
|
||||
eval(condition)
|
||||
except Exception:
|
||||
renpy.error(f"Condition could not be evaluated: {condition!r}")
|
||||
|
||||
if not any_true:
|
||||
renpy.error("All blocks have a condition, which will raise an exception if all conditions are False at the same time at runtime")
|
||||
|
||||
def next(self):
|
||||
blocks = [(block, weight) for block, weight, condition in self["blocks"] if eval(condition)]
|
||||
total_weight = sum(weight for _, weight in blocks)
|
@ -2115,7 +2115,7 @@ label gryffindor_match_return:
|
||||
hoo "Oh, look at the time. I think I better get going--" ("open", "shocked", "shocked", "R")
|
||||
|
||||
#hooch sprints out the office sound
|
||||
$ hooch_chibi.hide()
|
||||
chibi hooch hide
|
||||
play sound "sounds/run_03.ogg"
|
||||
pause 1.0
|
||||
play sound "sounds/door.ogg"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -16,9 +16,4 @@ init python:
|
||||
|
||||
char.set_face(mouth="base", eyes="base", eyebrows="base", pupils="mid", cheeks="none", tears="none")
|
||||
|
||||
def chibi_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])
|
||||
config.start_callbacks.append(wardrobe_init)
|
||||
|
@ -1,3 +1,5 @@
|
||||
define states.dolls = {}
|
||||
|
||||
init python:
|
||||
class Doll(DollMethods):
|
||||
# 0 - 50 = Skin/Body Layers
|
||||
@ -77,11 +79,7 @@ init python:
|
||||
|
||||
self.build_image()
|
||||
|
||||
# Add doll name to global doll states store
|
||||
try:
|
||||
renpy.store.states.dolls.add(name)
|
||||
except AttributeError:
|
||||
renpy.store.states.dolls = {name}
|
||||
states.dolls[name] = self
|
||||
|
||||
def generate_hash(self):
|
||||
clothes_hash = str([x[0]._hash for x in self.states.values() if istype(x[0], (DollCloth, DollClothDynamic, DollMakeup)) and x[2]])
|
||||
|
@ -23,7 +23,7 @@ init -1 python:
|
||||
|
||||
def get_character_object(key):
|
||||
__check_exists(key)
|
||||
return getattr(store, key)
|
||||
return states.dolls[key]
|
||||
|
||||
def get_character_outfit(key, typ="default"):
|
||||
__check_exists(key)
|
||||
|
Loading…
Reference in New Issue
Block a user