Merge branch 'main' into update-base-pack

This commit is contained in:
MihailRis 2026-11-21 20:24:37 +03:00
commit a6bffd9339
6 changed files with 18 additions and 3 deletions

View file

@ -372,11 +372,17 @@ To generate loot, the function `block_loot(block_id: int)` in the `base:util` mo
## Other properties
### *abstract*
An abstract block is used as a basis for defining blocks of the same type through inheritance (the `parent` property) (example: stairs).
As in the case of `hidden=true`, the item for the block is not generated.
Unlike `hidden`, the property is not inherited.
### *script-name*
Used to specify block script name (to reuse one script to multiple blocks). Name must not contain `packid:scripts/` and extension. Just name.
### Tick Interval - *tick-interval*
### *tick-interval*
The interval in ticks (1/20th of a second). A value of 20 results in an on_block_tick call interval of one second.

View file

@ -372,6 +372,11 @@
## Другое
### Абстрактный блок - *abstract*
Абстрактный блок используется исключительно как основа для определений однотипных блоков через наследование (свойство `parent`) (пример: ступеньки). Как в случае `hidden=true` предмет для блока не генерируется.
В отличие от `hidden` свойство не наследуется.
### Имя скрипта - *script-name*
Позволяет указать название скрипта блока. Свойство обеспечивает возможность использования одного скрипта для нескольких блоков.

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;