add 'model-name' item property
This commit is contained in:
parent
d3def8e741
commit
0618028df1
@ -16,6 +16,7 @@
|
||||
#include "objects/rigging.hpp"
|
||||
#include "util/ThreadPool.hpp"
|
||||
#include "voxels/Block.hpp"
|
||||
#include "items/ItemDef.hpp"
|
||||
#include "Assets.hpp"
|
||||
#include "assetload_funcs.hpp"
|
||||
|
||||
@ -240,6 +241,15 @@ void AssetsLoader::addDefaults(AssetsLoader& loader, const Content* content) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto& [_, def] : content->items.getDefs()) {
|
||||
if (def->modelName.find(':') == std::string::npos) {
|
||||
loader.add(
|
||||
AssetType::MODEL,
|
||||
MODELS_FOLDER + "/" + def->modelName,
|
||||
def->modelName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -429,6 +429,7 @@ void ContentLoader::loadItem(
|
||||
root.at("icon").get(def.icon);
|
||||
root.at("placing-block").get(def.placingBlock);
|
||||
root.at("script-name").get(def.scriptName);
|
||||
root.at("model-name").get(def.modelName);
|
||||
root.at("stack-size").get(def.stackSize);
|
||||
|
||||
// item light emission [r, g, b] where r,g,b in range [0..15]
|
||||
|
||||
@ -14,4 +14,5 @@ void ItemDef::cloneTo(ItemDef& dst) {
|
||||
dst.icon = icon;
|
||||
dst.placingBlock = placingBlock;
|
||||
dst.scriptName = scriptName;
|
||||
dst.modelName = modelName;
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@ struct ItemDef {
|
||||
std::string placingBlock = "core:air";
|
||||
std::string scriptName = name.substr(name.find(':') + 1);
|
||||
|
||||
std::string modelName = name + ".model";
|
||||
|
||||
struct {
|
||||
itemid_t id;
|
||||
blockid_t placingBlock;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user