add drop.json

This commit is contained in:
MihailRis
2024-06-27 03:09:16 +03:00
parent 8d41f6af11
commit 20ab48ecab
8 changed files with 28 additions and 13 deletions
+6 -3
View File
@@ -301,8 +301,7 @@ void ContentLoader::loadItem(ItemDef& def, const std::string& name, const fs::pa
root->num("stack-size", def.stackSize);
// item light emission [r, g, b] where r,g,b in range [0..15]
auto emissionarr = root->list("emission");
if (emissionarr) {
if (auto emissionarr = root->list("emission")) {
def.emission[0] = emissionarr->num(0);
def.emission[1] = emissionarr->num(1);
def.emission[2] = emissionarr->num(2);
@@ -311,7 +310,11 @@ void ContentLoader::loadItem(ItemDef& def, const std::string& name, const fs::pa
void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs::path& file) {
auto root = files::read_json(file);
root->str("script-name", def.scriptName);
if (auto boxarr = root->list("hitbox")) {
def.hitbox = glm::vec3(boxarr->num(0), boxarr->num(1), boxarr->num(2));
}
std::cout << "loading entity " << name << " from " << file.u8string() << std::endl;
}
void ContentLoader::loadEntity(EntityDef& def, const std::string& full, const std::string& name) {