Add room entry auto-triggers, player input, and more

* When you teleport to a room, the teleport auto-triggers fire.
* Rooms have auto-triggers. None by default. They are run every time you
  teleport to a room, and when the game starts. Gate behavior behind a
  variable.
* PlayerInputAction waits for player input (and potentially write it
  into a variable)

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2021-11-18 20:32:02 -08:00
parent b67034d2fa
commit 2f86df2930
7 changed files with 119 additions and 16 deletions

View File

@@ -2,6 +2,7 @@ import argparse
import importlib.util
from pathlib import Path
import sys
from agame.color import colorize
# Parse args
@@ -21,11 +22,18 @@ game_module = importlib.import_module(package)
game = game_module.game # type: ignore
# Run
game.print_room()
game.say("=" * 70)
game.say("Type ((help)) for help, or ((quit)) to exit.")
game.say("=" * 70)
game.say()
game.do_teleport_actions()
while True:
try:
game.say()
line = input("> ")
line = input(colorize("{{>}} "))
if line.lower() == "quit":
break
game.say()
game.run_command(line)
except (KeyboardInterrupt, EOFError):