
Co-authored-by: tupoy_ya <nikitachuvilov2@gmail.com> Co-authored-by: Evangelos Paterakis <evan@geopjr.dev> Co-authored-by: navmodder <30207948+navmodder@users.noreply.github.com>
36 lines
1.3 KiB
C++
36 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "natives.hpp"
|
|
|
|
namespace big
|
|
{
|
|
struct model_attachment
|
|
{
|
|
Hash model_hash;
|
|
Vector3 position;
|
|
Vector3 rotation;
|
|
bool has_collision;
|
|
bool is_visible;
|
|
bool is_invincible;
|
|
|
|
};
|
|
static void to_json(nlohmann::json& j, const model_attachment& attachment) {
|
|
|
|
j = nlohmann::json{ {"model_hash", attachment.model_hash},
|
|
{"position_x", attachment.position.x}, {"position_y", attachment.position.y}, {"position_z", attachment.position.z},
|
|
{"rotation_x", attachment.rotation.x}, {"rotation_y", attachment.rotation.y}, {"rotation_z", attachment.rotation.z},
|
|
{"has_collision", attachment.has_collision},
|
|
{"is_visible", attachment.is_visible},
|
|
{"is_invincible", attachment.is_invincible}
|
|
|
|
};
|
|
};
|
|
static void from_json(const nlohmann::json& j, model_attachment& attachment) {
|
|
j.at("model_hash").get_to(attachment.model_hash);
|
|
j.at("position_x").get_to(attachment.position.x); j.at("position_y").get_to(attachment.position.y); j.at("position_z").get_to(attachment.position.z);
|
|
j.at("rotation_x").get_to(attachment.rotation.x); j.at("rotation_y").get_to(attachment.rotation.y); j.at("rotation_z").get_to(attachment.rotation.z);
|
|
j.at("has_collision").get_to(attachment.has_collision);
|
|
j.at("is_visible").get_to(attachment.is_visible);
|
|
j.at("is_invincible").get_to(attachment.is_invincible);
|
|
}
|
|
}; |