mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add BodyType, fix crouching
This commit is contained in:
parent
7e80642ec3
commit
0a14d6220a
13 changed files with 131 additions and 34 deletions
|
|
@ -138,22 +138,19 @@ void ContentLoader::loadBlock(Block& def, const std::string& name, const fs::pat
|
|||
}
|
||||
|
||||
// block model
|
||||
std::string model = "block";
|
||||
root->str("model", model);
|
||||
if (model == "block") def.model = BlockModel::block;
|
||||
else if (model == "aabb") def.model = BlockModel::aabb;
|
||||
else if (model == "custom") {
|
||||
def.model = BlockModel::custom;
|
||||
if (root->has("model-primitives")) {
|
||||
loadCustomBlockModel(def, root->map("model-primitives").get());
|
||||
} else {
|
||||
logger.error() << name << ": no 'model-primitives' found";
|
||||
std::string modelName;
|
||||
root->str("model", modelName);
|
||||
if (auto model = BlockModel_from(modelName)) {
|
||||
if (*model == BlockModel::custom) {
|
||||
if (root->has("model-primitives")) {
|
||||
loadCustomBlockModel(def, root->map("model-primitives").get());
|
||||
} else {
|
||||
logger.error() << name << ": no 'model-primitives' found";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (model == "X") def.model = BlockModel::xsprite;
|
||||
else if (model == "none") def.model = BlockModel::none;
|
||||
else {
|
||||
logger.error() << "unknown model " << model;
|
||||
def.model = *model;
|
||||
} else if (!modelName.empty()) {
|
||||
logger.error() << "unknown model " << modelName;
|
||||
def.model = BlockModel::none;
|
||||
}
|
||||
|
||||
|
|
@ -341,6 +338,12 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs
|
|||
root->flag("save", def.save.enabled);
|
||||
root->flag("save-rig-pose", def.save.rig.pose);
|
||||
root->flag("save-rig-textures", def.save.rig.textures);
|
||||
|
||||
std::string bodyTypeName;
|
||||
root->str("body-type", bodyTypeName);
|
||||
if (auto bodyType = BodyType_from(bodyTypeName)) {
|
||||
def.bodyType = *bodyType;
|
||||
}
|
||||
}
|
||||
|
||||
void ContentLoader::loadEntity(EntityDef& def, const std::string& full, const std::string& name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue