From 5bba7e89fd395a2cde9cbf596208785508e22331 Mon Sep 17 00:00:00 2001 From: Jude Brown Date: Sun, 15 Nov 2009 16:00:24 +1000 Subject: Allow MonPropsMarker to set monster descriptions and quotes. --- crawl-ref/docs/develop/levels/advanced.txt | 14 ++++++++++++++ crawl-ref/source/describe.cc | 14 ++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/crawl-ref/docs/develop/levels/advanced.txt b/crawl-ref/docs/develop/levels/advanced.txt index a9d986daf6..816497e4b9 100644 --- a/crawl-ref/docs/develop/levels/advanced.txt +++ b/crawl-ref/docs/develop/levels/advanced.txt @@ -742,6 +742,20 @@ dungeon cell which they are on: * veto_shatter: If this property is set to "veto" then the cell will be unaffected by the Shatter spell. +Special monster-related Lua marker properties +--------------------------------------------- + +Using the MonPropsMarker allows you to permanantly alter or mark a monster that +the marker is placed upon. The options currently available are: + +* description: If this property is set, the monster's full description (accessed + via the 'xv' command) will be set to whatever string you pass it. + +* quote: Setting this property to a string will set the monster's quote. + +* monster_dies_lua_key: If this property is set to a function, that function + will be executed upon the monster's death. + Lua API reference ----------------- a. The Map. diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index b7855e66aa..2dfb3218d3 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2766,10 +2766,20 @@ void get_monster_db_desc(const monsters& mons, describe_info &inf, inf.title = "A mimic"; } + // This is somewhat hackish, but it's a good way of over-riding monsters' + // descriptions in Lua vaults by using MonPropsMarker. This is also the + // method used by set_feature_desc_long, etc. {due} + if (mons.props.exists("description")) + inf.body << std::string(mons.props["description"]); // Don't get description for player ghosts. - if (mons.type != MONS_PLAYER_GHOST) + else if (mons.type != MONS_PLAYER_GHOST) inf.body << getLongDescription(db_name); - inf.quote = getQuoteString(db_name); + + // And quotes {due} + if (mons.props.exists("quote")) + inf.body << std::string(mons.props["quote"]); + else + inf.quote = getQuoteString(db_name); std::string symbol; symbol += get_monster_data(mons.type)->showchar; -- cgit v1.2.3-54-g00ecf