diff options
-rw-r--r-- | crawl-ref/docs/options_guide.txt | 8 | ||||
-rw-r--r-- | crawl-ref/settings/init.txt | 1 | ||||
-rw-r--r-- | crawl-ref/source/clua.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/dat/lua/stash.lua | 12 |
4 files changed, 31 insertions, 2 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt index 2a9a42c53a..feae2518ec 100644 --- a/crawl-ref/docs/options_guide.txt +++ b/crawl-ref/docs/options_guide.txt @@ -50,7 +50,8 @@ The contents of this text are: runrest_ignore_monster, trapwalk_safe_hp, trap_prompt, rest_wait_both 4-h Stashes. - stash_tracking, stash_filter, annotate_item_class + stash_tracking, stash_filter, annotate_item_class, + annoate_item_dropped 4-i Command Enhancements. auto_list, easy_open, easy_unequip, easy_confirm, easy_butcher, always_confirm_butcher, chunks_autopickup, @@ -876,6 +877,11 @@ annotate_item_class = false init.txt. Automatically annotates items with their object class, e.g. weapon or wand, for stash searching. +annotate_item_dropped = false + This only works if stash.lua has already been sourced in + init.txt. Annotates dropped items with {dropped} for stash + searching. + 4-i Command Enhancements. ----------------------------- diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt index e38503d658..af9b1a424a 100644 --- a/crawl-ref/settings/init.txt +++ b/crawl-ref/settings/init.txt @@ -196,6 +196,7 @@ include = travel_stoppers.txt # stash_tracking = (all | explicit | dropped) # stash_filter = 14, 4:21 # annotate_item_class = true +# annotate_item_dropped = true ##### 4-i Command Enhancements ################## # diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index e9c63be678..237fe16601 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -1438,6 +1438,17 @@ static int l_item_weap_skill(lua_State *ls) return (2); } +static int l_item_dropped(lua_State *ls) +{ + LUA_ITEM(item, 1); + if (!item || !is_valid_item(*item)) + return (0); + + lua_pushboolean(ls, item->flags & ISFLAG_DROPPED); + + return (1); +} + static int l_item_artefact(lua_State *ls) { LUA_ITEM(item, 1); @@ -1501,6 +1512,7 @@ static const struct luaL_reg item_lib[] = { "equipped_at", l_item_equipped }, { "equip_type", l_item_equip_type }, { "weap_skill", l_item_weap_skill }, + { "dropped", l_item_dropped }, { NULL, NULL }, }; diff --git a/crawl-ref/source/dat/lua/stash.lua b/crawl-ref/source/dat/lua/stash.lua index 3274b41c5b..736b5cbcbc 100644 --- a/crawl-ref/source/dat/lua/stash.lua +++ b/crawl-ref/source/dat/lua/stash.lua @@ -22,10 +22,20 @@ -- {artefact} the Staff of Wucad Mu --------------------------------------------------------------------------- -local ch_annotate_item_class = nil +local ch_annotate_item_class = nil +local ch_annotate_item_dropped = nil + -- Annotate items for searches function ch_stash_search_annotate_item(it) local annot = "" + + if ch_annotate_item_dropped == nil then + ch_annotate_item_dropped = opt_boolean("annotate_item_dropped", false) + end + + if ch_annotate_item_dropped and item.dropped(it) then + annot = annot .. "{dropped} " + end if item.artefact(it) then annot = annot .. "{artefact} " |