make BlockMaterial serializable

This commit is contained in:
MihailRis
2025-04-13 20:52:03 +03:00
parent 862ac496a8
commit 9e28b783fd
4 changed files with 26 additions and 9 deletions
+19 -1
View File
@@ -8,7 +8,7 @@
#include "presets/ParticlesPreset.hpp"
#include "util/stringutil.hpp"
dv::value BlockMaterial::serialize() const {
dv::value BlockMaterial::toTable() const {
return dv::object({
{"name", name},
{"stepsSound", stepsSound},
@@ -18,6 +18,24 @@ dv::value BlockMaterial::serialize() const {
});
}
dv::value BlockMaterial::serialize() const {
return dv::object({
{"name", name},
{"steps-sound", stepsSound},
{"place-sound", placeSound},
{"break-sound", breakSound},
{"hit-sound", hitSound}
});
}
void BlockMaterial::deserialize(const dv::value& src) {
src.at("name").get(name);
src.at("steps-sound").get(stepsSound);
src.at("place-sound").get(placeSound);
src.at("break-sound").get(breakSound);
src.at("hit-sound").get(hitSound);
}
CoordSystem::CoordSystem(glm::ivec3 axisX, glm::ivec3 axisY, glm::ivec3 axisZ)
: axes({axisX, axisY, axisZ}) {
fix = glm::ivec3(0);