ItemDef/EntityDef/Block: Add method cloneTo to definition to other definition

ContentBuilder: Add method `get` to get definition or nullptr
ContentLoader: Add functionality to clone from definition specified in `parent` field in json
This commit is contained in:
REDxEYE
2024-08-20 21:58:01 +03:00
parent 8ef288c189
commit 5f6ae5daba
9 changed files with 123 additions and 13 deletions
+10
View File
@@ -5,3 +5,13 @@
ItemDef::ItemDef(const std::string& name) : name(name) {
caption = util::id_to_caption(name);
}
void ItemDef::cloneTo(ItemDef& dst) {
dst.caption = caption;
dst.stackSize = stackSize;
dst.generated = generated;
std::copy(&emission[0], &emission[3], dst.emission);
dst.iconType = iconType;
dst.icon = icon;
dst.placingBlock = placingBlock;
dst.scriptName = scriptName;
}
+1
View File
@@ -44,4 +44,5 @@ struct ItemDef {
ItemDef(const std::string& name);
ItemDef(const ItemDef&) = delete;
void cloneTo(ItemDef& dst);
};