diff --git a/docs.toml b/docs.toml index 88c7f07..a892605 100644 --- a/docs.toml +++ b/docs.toml @@ -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" diff --git a/setage.py b/setage.py index 9a2cd8b..618b990 100755 --- a/setage.py +++ b/setage.py @@ -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__":