fix generated item's script
This commit is contained in:
parent
9bd6b39952
commit
65ee464941
@ -289,6 +289,9 @@ void ContentLoader::loadContent(const dv::value& root) {
|
|||||||
item.icon = def.name;
|
item.icon = def.name;
|
||||||
item.placingBlock = def.name;
|
item.placingBlock = def.name;
|
||||||
item.tags = def.tags;
|
item.tags = def.tags;
|
||||||
|
item.scriptFile = def.name + BLOCK_ITEM_SUFFIX + ".lua";
|
||||||
|
|
||||||
|
logger.info() << "scriptFile: " << item.scriptFile;
|
||||||
|
|
||||||
for (uint j = 0; j < 4; j++) {
|
for (uint j = 0; j < 4; j++) {
|
||||||
item.emission[j] = def.emission[j];
|
item.emission[j] = def.emission[j];
|
||||||
|
|||||||
@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
#include "util/stringutil.hpp"
|
#include "util/stringutil.hpp"
|
||||||
|
|
||||||
ItemDef::ItemDef(const std::string& name) : name(name) {
|
ItemDef::ItemDef(const std::string& name)
|
||||||
caption = util::id_to_caption(name);
|
: name(name),
|
||||||
description = "";
|
caption(util::id_to_caption(name)),
|
||||||
|
scriptName(name.substr(name.find(':') + 1)) {
|
||||||
}
|
}
|
||||||
void ItemDef::cloneTo(ItemDef& dst) {
|
void ItemDef::cloneTo(ItemDef& dst) {
|
||||||
dst.caption = caption;
|
dst.caption = caption;
|
||||||
|
|||||||
@ -37,7 +37,7 @@ struct ItemDef {
|
|||||||
std::string caption;
|
std::string caption;
|
||||||
|
|
||||||
/// @brief Item description will shown in inventory
|
/// @brief Item description will shown in inventory
|
||||||
std::string description;
|
std::string description = "";
|
||||||
|
|
||||||
dv::value properties = nullptr;
|
dv::value properties = nullptr;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ struct ItemDef {
|
|||||||
std::string icon = "blocks:notfound";
|
std::string icon = "blocks:notfound";
|
||||||
|
|
||||||
std::string placingBlock = "core:air";
|
std::string placingBlock = "core:air";
|
||||||
std::string scriptName = name.substr(name.find(':') + 1);
|
std::string scriptName;
|
||||||
|
|
||||||
std::string modelName = name + ".model";
|
std::string modelName = name + ".model";
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user