summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-12 16:26:22 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-12 16:26:22 -0800
commit4fcdab47681adf046474885058d0e3ff95995d86 (patch)
treec6661ddb62d13a57fa0176cbd24de51c4ff5c921 /crawl-ref/source
parentfcd9486498b25072cacd0ae8ef9ef0ae570b8104 (diff)
downloadcrawl-ref-4fcdab47681adf046474885058d0e3ff95995d86.tar.gz
crawl-ref-4fcdab47681adf046474885058d0e3ff95995d86.zip
New door Lua marker properties
door_description_prefix: String to prefix to door name. door_open_prompt: Prompt user if they really want to open the door.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc52
-rw-r--r--crawl-ref/source/directn.cc13
-rw-r--r--crawl-ref/source/misc.cc21
3 files changed, 70 insertions, 16 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index f2a8328931..2f38866f39 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -3281,23 +3281,53 @@ static void _open_door(coord_def move, bool check_confused)
const char *adj, *noun;
get_door_description(all_door.size(), &adj, &noun);
- int skill = you.dex
- + (you.skills[SK_TRAPS_DOORS] + you.skills[SK_STEALTH]) / 2;
-
- if (is_exclude_root(doorpos) && !(check_confused && you.confused()))
+ if (!(check_confused && you.confused()))
{
- std::string prompt =
- make_stringf("This %s%s is marked as excluded! Open it "
- "anyway?", adj, noun);
+ std::string door_open_prompt =
+ env.markers.property_at(doorpos, MAT_ANY, "door_open_prompt");
+
+ bool ignore_exclude = false;
- if (!yesno(prompt.c_str(), true, 'n', true, false))
+ if (!door_open_prompt.empty())
{
- canned_msg(MSG_OK);
- interrupt_activity(AI_FORCE_INTERRUPT);
- return;
+ door_open_prompt += " (y/N)";
+ if (!yesno(door_open_prompt.c_str(), true, 'n', true, false))
+ {
+ if (is_exclude_root(doorpos))
+ canned_msg(MSG_OK);
+ else
+ {
+ if (yesno("Put travel exclusion on door? (Y/n)",
+ true, 'y'))
+ {
+ // Zero radius exclusion right on top of door.
+ set_exclude(doorpos, 0);
+ }
+ }
+ interrupt_activity(AI_FORCE_INTERRUPT);
+ return;
+ }
+ ignore_exclude = true;
+ }
+
+ if (!ignore_exclude && is_exclude_root(doorpos))
+ {
+ std::string prompt =
+ make_stringf("This %s%s is marked as excluded! Open it "
+ "anyway?", adj, noun);
+
+ if (!yesno(prompt.c_str(), true, 'n', true, false))
+ {
+ canned_msg(MSG_OK);
+ interrupt_activity(AI_FORCE_INTERRUPT);
+ return;
+ }
}
}
+ int skill = you.dex
+ + (you.skills[SK_TRAPS_DOORS] + you.skills[SK_STEALTH]) / 2;
+
if (you.berserk())
{
// XXX: Better flavour for larger doors?
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 45437ab529..78c9f5ce24 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -2902,6 +2902,13 @@ std::string feature_description(const coord_def& where, bool bloody,
if (grid == DNGN_OPEN_DOOR || feat_is_closed_door(grid))
{
+ const std::string door_desc_prefix =
+ env.markers.property_at(where, MAT_ANY,
+ "door_description_prefix");
+ const std::string door_desc_suffix =
+ env.markers.property_at(where, MAT_ANY,
+ "door_description_suffix");
+
std::set<coord_def> all_door;
find_connected_identical(where, grd(where), all_door);
const char *adj, *noun;
@@ -2911,12 +2918,8 @@ std::string feature_description(const coord_def& where, bool bloody,
desc += (grid == DNGN_OPEN_DOOR) ? "open " : "closed ";
if (grid == DNGN_DETECTED_SECRET_DOOR)
desc += "detected secret ";
- desc += noun;
- const std::string door_desc_suffix =
- env.markers.property_at(where, MAT_ANY,
- "door_description_suffix");
- desc += door_desc_suffix;
+ desc += door_desc_prefix + noun + door_desc_suffix;
if (bloody)
desc += ", spattered with blood";
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 43d9499ed5..944cf6aa98 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -3126,6 +3126,27 @@ void reveal_secret_door(const coord_def& p)
: DNGN_OPEN_DOOR;
viewwindow(false);
learned_something_new(TUT_SEEN_SECRET_DOOR, p);
+
+ // If a transparent secret door was forced open to preserve LOS,
+ // check if it had an opening prompt.
+ if (grd(p) == DNGN_OPEN_DOOR)
+ {
+ std::string door_open_prompt =
+ env.markers.property_at(p, MAT_ANY, "door_open_prompt");
+
+ if (!door_open_prompt.empty())
+ {
+ mprf("That secret door had a prompt on it:", MSGCH_PROMPT);
+ mprf(MSGCH_PROMPT, "%s", door_open_prompt.c_str());
+
+ if (!is_exclude_root(p))
+ {
+ if (yesno("Put travel exclusion on door? (Y/n)", true, 'y'))
+ // Zero radius exclusion right on top of door.
+ set_exclude(p, 0);
+ }
+ }
+ }
}
// A feeble attempt at Nethack-like completeness for cute messages.