diff options
| author | Alexander Gavrilov | 2012-09-17 21:15:51 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-09-17 21:15:51 +0400 |
| commit | 36e44c682cc2cecb552eca8dfc75ad1a436086cc (patch) | |
| tree | 60793f2c17ceeb9a2849e60e819551e21fbf8c90 /library/modules | |
| parent | 613063cef4d87b3b4307144b85da60dc40daceb3 (diff) | |
| download | dfhack-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.cpp | 13 |
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()) |
