feat: passing args to component in entity definition

This commit is contained in:
MihailRis
2025-08-06 23:34:00 +03:00
parent f2aa77db8b
commit f6be6689aa
5 changed files with 33 additions and 7 deletions
+12 -1
View File
@@ -30,7 +30,18 @@ template<> void ContentUnitLoader<EntityDef>::loadUnit(
if (auto found = root.at("components")) {
for (const auto& elem : *found) {
def.components.emplace_back(elem.asString());
std::string name;
dv::value params;
if (elem.isObject()) {
name = elem["name"].asString();
if (elem.has("args")) {
params = elem["args"];
}
} else {
name = elem.asString();
}
def.components.push_back(ComponentInstance {
std::move(name), std::move(params)});
}
}
if (auto found = root.at("hitbox")) {