add 'tags.toml' file

This commit is contained in:
MihailRis
2025-09-19 22:16:28 +03:00
parent b85e357ab2
commit 43a7331f62
4 changed files with 76 additions and 29 deletions
+19
View File
@@ -413,6 +413,25 @@ void ContentLoader::load() {
if (io::exists(contentFile)) {
loadContent(io::read_json(contentFile));
}
// Load attached tags
io::path tagsFile = folder / "tags.toml";
if (io::exists(tagsFile)) {
auto tagsMap = io::read_object(tagsFile);
for (const auto& [key, list] : tagsMap.asObject()) {
for (const auto& id : list) {
const auto& stringId = id.asString();
if (auto block = builder.blocks.get(stringId)) {
block->tags.push_back(key);
if (auto item = builder.items.get(stringId + BLOCK_ITEM_SUFFIX)) {
item->tags.push_back(key);
}
} else if (auto item = builder.items.get(stringId)) {
item->tags.push_back(key);
}
}
}
}
}
template <class T>