forked from SilverStudioGames/WTS
46 lines
1.3 KiB
Plaintext
46 lines
1.3 KiB
Plaintext
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, i in chibi.poses.items()
|
|
for j in range(i)
|
|
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, str(j))).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
|