fix generated item's script

This commit is contained in:
MihailRis 2025-12-02 18:21:52 +03:00
parent 3202a11590
commit 4df4209bc5
3 changed files with 9 additions and 5 deletions

View file

@ -2,9 +2,10 @@
#include "util/stringutil.hpp"
ItemDef::ItemDef(const std::string& name) : name(name) {
caption = util::id_to_caption(name);
description = "";
ItemDef::ItemDef(const std::string& name)
: name(name),
caption(util::id_to_caption(name)),
scriptName(name.substr(name.find(':') + 1)) {
}
void ItemDef::cloneTo(ItemDef& dst) {
dst.caption = caption;

View file

@ -37,7 +37,7 @@ struct ItemDef {
std::string caption;
/// @brief Item description will shown in inventory
std::string description;
std::string description = "";
dv::value properties = nullptr;
@ -60,7 +60,7 @@ struct ItemDef {
std::string icon = "blocks:notfound";
std::string placingBlock = "core:air";
std::string scriptName = name.substr(name.find(':') + 1);
std::string scriptName;
std::string modelName = name + ".model";