summaryrefslogtreecommitdiff
path: root/library/modules
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-09-17 21:15:51 +0400
committerAlexander Gavrilov2012-09-17 21:15:51 +0400
commit36e44c682cc2cecb552eca8dfc75ad1a436086cc (patch)
tree60793f2c17ceeb9a2849e60e819551e21fbf8c90 /library/modules
parent613063cef4d87b3b4307144b85da60dc40daceb3 (diff)
downloaddfhack-36e44c682cc2cecb552eca8dfc75ad1a436086cc.tar.gz
dfhack-36e44c682cc2cecb552eca8dfc75ad1a436086cc.tar.bz2
dfhack-36e44c682cc2cecb552eca8dfc75ad1a436086cc.tar.xz
Add a plugin implementing 'add spatter to item' reactions.
Diffstat (limited to 'library/modules')
-rw-r--r--library/modules/Materials.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp
index 50cf21a9..db9c9c7d 100644
--- a/library/modules/Materials.cpp
+++ b/library/modules/Materials.cpp
@@ -283,6 +283,19 @@ bool MaterialInfo::findCreature(const std::string &token, const std::string &sub
return decode(-1);
}
+bool MaterialInfo::findProduct(df::material *material, const std::string &name)
+{
+ if (!material || name.empty())
+ return decode(-1);
+
+ auto &pids = material->reaction_product.id;
+ for (size_t i = 0; i < pids.size(); i++)
+ if ((*pids[i]) == name)
+ return decode(material->reaction_product.material, i);
+
+ return decode(-1);
+}
+
std::string MaterialInfo::getToken()
{
if (isNone())