add 'abstract' block property

This commit is contained in:
MihailRis 2026-11-21 19:45:33 +03:00
parent f0a407c20a
commit 33180fc648
4 changed files with 6 additions and 2 deletions

View file

@ -133,7 +133,7 @@ std::unique_ptr<Content> ContentBuilder::build() {
content->items
.require(
def->pickingItem.empty()
? (def->hidden ? CORE_EMPTY
? ((def->abstract || def->hidden) ? CORE_EMPTY
: def->name + BLOCK_ITEM_SUFFIX)
: def->pickingItem
)

View file

@ -288,7 +288,7 @@ void ContentLoader::loadContent(const dv::value& root) {
ContentUnitLoader<Block>(*pack, builder.blocks, "blocks",
[this](const Block& def) {
if (!def.hidden) {
if (!def.abstract || !def.hidden) {
bool created;
auto& item = builder.items.create(
def.name + BLOCK_ITEM_SUFFIX, &created

View file

@ -260,6 +260,7 @@ template<> void ContentUnitLoader<Block>::loadUnit(
root.at("selectable").get(def.selectable);
root.at("grounded").get(def.grounded);
root.at("hidden").get(def.hidden);
root.at("abstract").get(def.abstract);
root.at("picking-item").get(def.pickingItem);
root.at("surface-replacement").get(def.surfaceReplacement);
root.at("script-name").get(def.scriptName);

View file

@ -258,6 +258,9 @@ public:
/// below
bool grounded = false;
/// @brief Makes block abstract
bool abstract = false;
/// @brief Turns off block item generation
bool hidden = false;