add block/item tags
This commit is contained in:
@@ -89,6 +89,7 @@ template<> void ContentUnitLoader<Block>::loadUnit(
|
||||
) {
|
||||
auto root = io::read_json(file);
|
||||
process_properties(def, name, root);
|
||||
process_tags(def, root);
|
||||
|
||||
if (root.has("parent")) {
|
||||
const auto& parentName = root["parent"].asString();
|
||||
|
||||
@@ -21,3 +21,17 @@ inline void process_properties(T& def, const std::string& name, const dv::value&
|
||||
process_method(def.properties, suffix, field, value);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void process_tags(T& def, const dv::value& root) {
|
||||
if (!root.has("tags")) {
|
||||
return;
|
||||
}
|
||||
const auto& tags = root["tags"];
|
||||
for (const auto& tagValue : tags) {
|
||||
if (!tagValue.isString()) {
|
||||
continue;
|
||||
}
|
||||
def.tags.push_back(tagValue.asString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ template<> void ContentUnitLoader<ItemDef>::loadUnit(
|
||||
) {
|
||||
auto root = io::read_json(file);
|
||||
process_properties(def, name, root);
|
||||
process_tags(def, root);
|
||||
|
||||
if (root.has("parent")) {
|
||||
const auto& parentName = root["parent"].asString();
|
||||
|
||||
Reference in New Issue
Block a user