From 760cd0cbcb02d7b7b3cd2a0b894219ac66ac95b0 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 28 May 2023 05:37:29 -0700 Subject: [PATCH] implement tameable property filtering --- data/stockpiles/all.dfstock | Bin 0 -> 73 bytes docs/plugins/stockpiles.rst | 29 ++++++++++++++++----- plugins/stockpiles/StockpileSerializer.cpp | 11 ++++++-- 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 data/stockpiles/all.dfstock diff --git a/data/stockpiles/all.dfstock b/data/stockpiles/all.dfstock new file mode 100644 index 0000000000000000000000000000000000000000..eace9c53dd7de0601ca25e16759cb90993b5f4bd GIT binary patch literal 73 zcmd;LQeYHfUctyH#bm)~#3aDz#ALwe1*C(RG#I0RI0?wl0`iNPJQ%BhbQ2?x(Z$G= U!8n1DaRwvf4n~Gcj7%Ji07w%GJ^%m! literal 0 HcmV?d00001 diff --git a/docs/plugins/stockpiles.rst b/docs/plugins/stockpiles.rst index 685bdcac3..ae77e5cf2 100644 --- a/docs/plugins/stockpiles.rst +++ b/docs/plugins/stockpiles.rst @@ -134,12 +134,14 @@ entire category, or with a filter, any matchable subset thereof:: cat_weapons cat_wood -There is also an ``everything`` file that includes all the above categories, -including refuse and corpses. +In addition, there are files for ``all``, which includes all categories except +refuse and corpses (mirroring the "all" configuration in-game), and +``everything``, which really includes all categories. -For many of the categories, there are also flags and subcategory prefixes that -you can match with filters and convenient pre-made settings files that -manipulate interesting category subsets. +For many of the categories, there are also flags, subcategory prefixes, and +item properties that you can match with filters. In addition, there are +normally at least a few convenient pre-made settings files that manipulate +interesting category subsets. Ammo stockpile adjustments ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -172,6 +174,10 @@ Flags:: cages traps +Properties:: + + tameable + Settings files:: cages @@ -274,6 +280,13 @@ Notes: * ``thread`` and ``cloth`` settings files set all materials that are not adamantine. +Corpse stockpile adjustments +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Properties:: + + tameable + Finished goods stockpile adjustments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -295,7 +308,7 @@ Settings files:: Example commands for a toy stockpile:: - stockpiles import cat_furniture -f mats/,other/,core/,total/ + stockpiles import cat_finished_goods -f mats/,other/,core/,total/ stockpiles import -m enable toys Food stockpile adjustments @@ -404,6 +417,10 @@ Flags and subcategory prefixes:: teeth/ horns/ +Properties:: + + tameable + Settings files:: rawhides diff --git a/plugins/stockpiles/StockpileSerializer.cpp b/plugins/stockpiles/StockpileSerializer.cpp index fcb0cee3e..b650ec618 100644 --- a/plugins/stockpiles/StockpileSerializer.cpp +++ b/plugins/stockpiles/StockpileSerializer.cpp @@ -11,6 +11,7 @@ // df #include "df/building_stockpilest.h" #include "df/creature_raw.h" +#include "df/caste_raw.h" #include "df/inorganic_raw.h" #include "df/item_quality.h" #include @@ -611,6 +612,12 @@ static bool serialize_list_creature(FuncWriteExport add_value, const vectorcaste.size() || !r->caste[0]->flags.is_set(df::enums::caste_raw_flags::PET)) + return r->name[0]; + return r->name[0] + "/tameable"; +} + static void unserialize_list_creature(const char* subcat, bool all, char val, const vector& filters, FuncReadImport read_value, int32_t list_size, vector& pile_list) { size_t num_elems = world->raws.creatures.all.size(); @@ -618,7 +625,7 @@ static void unserialize_list_creature(const char* subcat, bool all, char val, co if (all) { for (size_t idx = 0; idx < num_elems; ++idx) { auto r = find_creature(idx); - set_filter_elem(subcat, filters, val, r->name[0], r->creature_id, pile_list.at(idx)); + set_filter_elem(subcat, filters, val, get_filter_string(r), r->creature_id, pile_list.at(idx)); } return; } @@ -631,7 +638,7 @@ static void unserialize_list_creature(const char* subcat, bool all, char val, co continue; } auto r = find_creature(idx); - set_filter_elem(subcat, filters, val, r->name[0], r->creature_id, pile_list.at(idx)); + set_filter_elem(subcat, filters, val, get_filter_string(r), r->creature_id, pile_list.at(idx)); } }