From ab386a0ed23e2a1921b6341ad4e116986e1c246b Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 7 Oct 2023 22:50:31 -0700 Subject: [PATCH] add docs for creatures search overlay --- docs/plugins/sort.rst | 8 ++++++++ plugins/lua/sort/creatures.lua | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/plugins/sort.rst b/docs/plugins/sort.rst index 31ab2d3fc..8ea9e114c 100644 --- a/docs/plugins/sort.rst +++ b/docs/plugins/sort.rst @@ -91,3 +91,11 @@ and "ranged combat potential" are explained in detail here: https://www.reddit.com/r/dwarffortress/comments/163kczo/enhancing_military_candidate_selection_part_3/ "Mental stability" is explained here: https://www.reddit.com/r/dwarffortress/comments/1617s11/enhancing_military_candidate_selection_part_2/ + +Creatures overlay +----------------- + +The search widget that appears on the "Creatures" info panel sub-tabs (e.g. +"Citizens", "Pets", etc.) can search the lists by name and other shown +attibutes. For example, searching for ``caged`` will show all caged prisoners +on the "Other" tab. diff --git a/plugins/lua/sort/creatures.lua b/plugins/lua/sort/creatures.lua index eeab12087..692855679 100644 --- a/plugins/lua/sort/creatures.lua +++ b/plugins/lua/sort/creatures.lua @@ -145,14 +145,14 @@ end local function overall_training_search(data, filter, incremental) general_search(creatures.atk_index, function(elem) local raw = df.creature_raw.find(elem) - if not raw then return '' end + if not raw then return end return raw.name[1] end, nil, data, filter, incremental) end local function assign_trainer_search(data, filter, incremental) general_search(creatures.trainer, function(elem) - if not elem then return nil end + if not elem then return end return ('%s %s'):format(dfhack.TranslateName(elem.name), dfhack.units.getProfessionName(elem)) end, nil, data, filter, incremental) end