add another win trigger

This commit is contained in:
Cheri Dawn 2024-08-26 17:28:02 +03:00
parent 425b266dcf
commit e89959a32a
2 changed files with 17 additions and 2 deletions

View file

@ -18,7 +18,7 @@ prompt = "> " # optional, default shown.
playtested = false # optional, default. displays a warning if this is set to false.
[scenario.endings.1] # Required.
trigger = "item" # one of "item", "room" ("interactable" in future releases).
trigger = "item" # one of "item", "room", "interactable".
target = "id of the trigger" # which item, room (or interactable) should trigger the win.
title = "title of the ending" # optional.
message = "message when this ending is triggered"

View file

@ -395,7 +395,10 @@ class SetageShell(Cmd):
if "message_failed" in inter:
print(inter["message_failed"])
else:
print("> I don't seem to be able to do anything with that...")
print(
"> I don't seem to be able to do anything with that..."
)
return self.check_win(arg)
elif arg == "":
print("> What should I interact with?")
else:
@ -538,6 +541,18 @@ class SetageShell(Cmd):
continue
if end["exit"]:
return True
if end["trigger"] == "interactable":
if arg == end["target"]:
if "message" not in end:
print(f"WARNING: no message for ending '{ending}'")
else:
print(end["message"])
if "title" in end:
print(end["title"])
if "exit" not in end:
continue
if end["exit"]:
return True
if __name__ == "__main__":