From 4fcdab47681adf046474885058d0e3ff95995d86 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Thu, 12 Nov 2009 16:26:22 -0800 Subject: 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. --- crawl-ref/docs/develop/levels/advanced.txt | 10 ++++++ crawl-ref/source/acr.cc | 52 +++++++++++++++++++++++------- crawl-ref/source/directn.cc | 13 +++++--- crawl-ref/source/misc.cc | 21 ++++++++++++ 4 files changed, 80 insertions(+), 16 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/docs/develop/levels/advanced.txt b/crawl-ref/docs/develop/levels/advanced.txt index 9bb20f71ab..617868a159 100644 --- a/crawl-ref/docs/develop/levels/advanced.txt +++ b/crawl-ref/docs/develop/levels/advanced.txt @@ -703,12 +703,22 @@ dungeon cell which they are on: forcing them to open and close as separate doors. See the Evil Zoo (minivault_9) in dat/mini.des for an example. +* door_description_prefix: A string to prepend to the description of + any door the marker is on. This should be used for doors + rather than the feature_description property since it elemintates + the need to track if the door is opened or closed, plus it will + have no effect on secret doors which have yet to be detected. + * door_description_suffix: A string to append to the description of any door the marker is on. This should be used for doors rather than the feature_description property since it elemintates the need to track if the door is opened or closed, plus it will have no effect on secret doors which have yet to be detected. +* door_open_prompt: If placed on top of a door, the use will be prompted + before opening the door, with the value of the property used as + the prompt string. + * feature_description: What to use as the short description of the cell's feature. 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 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. -- cgit v1.2.3-54-g00ecf