add EnumMetadata

This commit is contained in:
MihailRis
2025-04-13 13:53:59 +03:00
parent d888ddec4c
commit 7749675a61
20 changed files with 156 additions and 206 deletions
+3 -4
View File
@@ -1,3 +1,4 @@
#define VC_ENABLE_REFLECTION
#include "Entities.hpp"
#include <glm/ext/matrix_transform.hpp>
@@ -216,9 +217,7 @@ void Entities::loadEntity(const dv::value& map, Entity entity) {
dv::get_vec(bodymap, "vel", body.hitbox.velocity);
std::string bodyTypeName;
map.at("type").get(bodyTypeName);
if (auto bodyType = BodyType_from(bodyTypeName)) {
body.hitbox.type = *bodyType;
}
BodyTypeMeta.getItem(bodyTypeName, body.hitbox.type);
bodymap["crouch"].asBoolean(body.hitbox.crouching);
bodymap["damping"].asNumber(body.hitbox.linearDamping);
}
@@ -329,7 +328,7 @@ dv::value Entities::serialize(const Entity& entity) {
if (def.save.body.settings) {
bodymap["damping"] = rigidbody.hitbox.linearDamping;
if (hitbox.type != def.bodyType) {
bodymap["type"] = to_string(hitbox.type);
bodymap["type"] = BodyTypeMeta.getNameString(hitbox.type);
}
if (hitbox.crouching) {
bodymap["crouch"] = hitbox.crouching;
-1
View File
@@ -2,7 +2,6 @@
#include <glm/glm.hpp>
#include <memory>
#include <optional>
#include "interfaces/Serializable.hpp"
#include "settings.hpp"