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

@@ -4,6 +4,61 @@ from agame.room import Room
from agame.trigger import *
from . import database
################################################################################
# Game intro
################################################################################
database.add_room(
Room(
id="prelude",
name="Prelude",
desc="",
items={},
teleport_actions=[
PrintAction(
"." * 70,
"Many stories have been told about this place. Some are tall "
"tales and mostly contradictory. Some others, however, are true.",
#
"This is one of those stories.",
"." * 70,
),
PlayerInputAction(),
PrintAction(
"." * 70,
#
"There used to be trees here. Fifteen years ago, we were sitting "
"in the shade, telling stories about last summer and what we hope "
"would happen next, our laughter unable to break past the leaves "
"and branches around us.",
#
"It is now desolate. Only the wind shakes the dry branches of the "
"remaining trees. They chitter and clack; any other noise is a "
"long echo. Nothing else stands tall enough to block the sound.",
#
"No animals patrol the sky nor ground. Life has left this place.",
"." * 70,
),
PlayerInputAction(),
PrintAction(
"." * 70,
"It is because of the ((machine)).",
"." * 70,
),
PlayerInputAction(),
SleepAction(1),
PrintAction("."),
SleepAction(1),
PrintAction(".."),
SleepAction(1),
PrintAction("..."),
SleepAction(1),
PrintAction("You awaken from a fitful sleep. Where are you again?"),
PlayerInputAction(),
TeleportAction("cabin_inside"),
],
)
)
################################################################################
# Inside the cabin
################################################################################
@@ -200,6 +255,7 @@ database.add_items(
id="cabin_outside_west_path",
name="Western path",
synonyms=(
"path",
"path to west",
"path to the west",
"path leading west",