WTS/game/scripts/cds.rpy

45 lines
1.2 KiB
Plaintext
Raw Normal View History

python early:
def parse_chibi(lexer):
who = lexer.simple_expression()
action = lexer.simple_expression()
return (who, action)
def execute_chibi(parsed_object):
print(f"{parsed_object}")
who, action = parsed_object
func = eval(f"{who[:3]}_chibi_new.{action}")
print(f"Execution: {who} {action}")
def lint_chibi(parsed_object):
who, action = parsed_object
try:
chibi = eval(f"{who[:3]}_chibi_new") # TODO: Update naming once testing is done
except Exception:
renpy.error(f"Character chibi not defined: {who}")
def predict_chibi(parsed_object):
who, action = parsed_object
chibi = eval(f"{who[:3]}_chibi_new")
doll = eval(f"{who}")
layers = (
l[0] for pose in chibi.poses.keys()
for k in doll.states.values() if k[0] and k[2]
for l in k[0].get_layers(k[0]._hash, subpath=posixpath.join("chibi", pose)).values()
)
return layers
renpy.register_statement(
name="chibi",
parse=parse_chibi,
execute=execute_chibi,
lint=lint_chibi,
predict=predict_chibi,
)
define config.debug_prediction = True