More updates to the example game. Won't be specific here - too much changing, sorry.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2021-11-18 17:24:46 -08:00
parent d3bf9e68dd
commit 0f6433eabd
2 changed files with 78 additions and 16 deletions

View File

@@ -15,11 +15,14 @@ database.add_items(
room_desc="A door rests upon the south wall.",
synonyms=("door",),
triggers={
LOOK: [PrintAction("A strong, sturdy door.")],
LOOK: [PrintAction("A strong, sturdy door leading outside.")],
GET: [PrintAction("The door is firmly attached to the wall.")],
# Don't actually worry about the door being open here. It's just a
# nice flavoring.
GO: [PrintAction("You exit the cabin."), TeleportAction("outside_cabin")],
GO: [
PrintAction("You step outside."),
TeleportAction("cabin_outside"),
],
OPEN: [
CheckVarAction(
"cabin_door_open",
@@ -68,7 +71,10 @@ database.add_items(
room_desc=None,
triggers={
LOOK: [PrintAction("It's brown and gray.")],
GO: [PrintAction("You exit the cabin."), TeleportAction("outside_cabin")],
GO: [
PrintAction("You step outside."),
TeleportAction("cabin_outside"),
],
},
),
Item(
@@ -80,12 +86,12 @@ database.add_items(
LOOK: [PrintAction("It's brown and gray.")],
OPEN: [
PrintAction(
"This window is simply a pane of glass in a fixed frame, it be neither opened nor closed."
"This window is simply a pane of glass in a fixed frame, it can be neither opened nor closed."
)
],
CLOSE: [
PrintAction(
"This window is simply a pane of glass in a fixed frame, it be neither opened nor closed."
"This window is simply a pane of glass in a fixed frame, it can be neither opened nor closed."
)
],
GO: [PrintAction("Try using the door instead.")],
@@ -95,7 +101,7 @@ database.add_items(
database.add_room(
Room(
id="inside_cabin",
id="cabin_inside",
name="Inside the cabin",
desc="",
items=[
@@ -113,11 +119,11 @@ database.add_room(
ANJAS_LETTER = [
"Dear Juni!",
"If you are reading this message you have finally arrived in the West, near where "
"the horrible machine resides. Turn it off, and its life-sapping force in the "
"world will cease.",
"If you are reading this message you have finally arrived at my cabin in the "
"West. Continue your journey further into the west - that is where the machine "
"resides. Turn it off, and this land will begin healing anew.",
"You are our only hope - we are counting on you!",
"Anja",
"- Anja",
]
database.add_items(
Item(
@@ -131,7 +137,7 @@ database.add_items(
},
),
Item(
id="mailbox",
id="cabin_outside_mailbox",
name="Mailbox",
synonyms=("mailbox", "postbox", "rusty mailbox", "rusty postbox"),
room_desc="A rusty mailbox sits by the door to the cabin.",
@@ -191,7 +197,7 @@ database.add_items(
},
),
Item(
id="west_path",
id="cabin_outside_west_path",
name="Western path",
synonyms=(
"path to west",
@@ -221,17 +227,73 @@ database.add_items(
USE: [PrintAction("You head west."), TeleportAction("western_fork")],
},
),
Item(
id="cabin_outside_door",
name="Cabin door",
room_desc=None,
synonyms=("door",),
triggers={
LOOK: [
PrintAction("A strong, sturdy door leading to the inside of the cabin.")
],
OPEN: [
CheckVarAction(
var_id="cabin_door_open",
yes=PrintAction("The cabin door is already open."),
no=[
PrintAction("You push the cabin door open."),
SetVarAction("cabin_door_open", True),
],
)
],
CLOSE: [
CheckVarAction(
var_id="cabin_door_open",
yes=[
PrintAction("You shut the cabin door tight."),
SetVarAction("cabin_door_open", False),
],
no=PrintAction("The cabin door is already shut."),
)
],
GO: [
PrintAction("You step inside the cabin."),
TeleportAction("cabin_inside"),
],
USE: [
PrintAction("You step inside the cabin."),
TeleportAction("cabin_inside"),
],
},
),
Item(
id="cabin_outside_inside",
name="Cabin",
room_desc=None,
synonyms=("inside", "inside cabin"),
triggers={
LOOK: [PrintAction("The cabin is small, but sturdy. A door leads inside.")],
GO: [
PrintAction("You step inside the cabin."),
TeleportAction("cabin_inside"),
],
},
),
)
database.add_rooms(
Room(
id="outside_cabin",
id="cabin_outside",
name="Outside the cabin",
desc=[],
items=[
database.items["mailbox"].create_inst(),
# Fixtures
database.items["cabin_outside_mailbox"].create_inst(),
database.items["cabin_outside_west_path"].create_inst(),
database.items["cabin_outside_door"].create_inst(),
database.items["cabin_outside_inside"].create_inst(),
# Items
database.items["anjas_letter"].create_inst(revealed=False),
database.items["west_path"].create_inst(),
],
),
)