add entity.properties

This commit is contained in:
MihailRis 2026-10-19 21:46:30 +03:00
parent 3edb96e291
commit 283e3c041e
5 changed files with 84 additions and 11 deletions

View file

@ -123,6 +123,13 @@ std::unique_ptr<Content> ContentBuilder::build() {
def->properties["script-file"] = def->scriptFile;
}
for (EntityDef* def : entityDefsIndices) {
if (def->properties == nullptr) {
def->properties = dv::object();
}
def->properties["name"] = def->name;
}
for (auto& [name, def] : content->generators.getDefs()) {
def->prepare(content.get());
}

View file

@ -1,5 +1,6 @@
#define VC_ENABLE_REFLECTION
#include "ContentUnitLoader.hpp"
#include "ContentLoadingCommons.hpp"
#include "../ContentBuilder.hpp"
#include "coders/json.hpp"
@ -16,6 +17,7 @@ template<> void ContentUnitLoader<EntityDef>::loadUnit(
EntityDef& def, const std::string& name, const io::path& file
) {
auto root = io::read_json(file);
process_properties(def, name, root);
if (root.has("parent")) {
const auto& parentName = root["parent"].asString();