add explicit 'solid' block property

This commit is contained in:
MihailRis 2026-01-08 22:43:20 +03:00
parent 336ae09f66
commit e451a4f3a3
5 changed files with 12 additions and 4 deletions

View file

@ -7,7 +7,7 @@ local names = {
"hidden", "draw-group", "picking-item", "surface-replacement", "script-name",
"ui-layout", "inventory-size", "tick-interval", "overlay-texture",
"translucent", "fields", "particles", "icon-type", "icon", "placing-block",
"stack-size", "name", "script-file", "culling"
"stack-size", "name", "script-file", "culling", "solid"
}
for name, _ in pairs(user_props) do
table.insert(names, name)

View file

@ -34,11 +34,15 @@ std::unique_ptr<Content> ContentBuilder::build() {
if (def.variants) {
for (auto& variant : def.variants->variants) {
variant.rt.solid = variant.model.type == BlockModelType::BLOCK;
variant.rt.solid =
variant.model.type == BlockModelType::BLOCK ||
def.explictlySolid;
}
def.defaults = def.variants->variants.at(0);
} else {
def.defaults.rt.solid = def.defaults.model.type == BlockModelType::BLOCK;
def.defaults.rt.solid =
def.defaults.model.type == BlockModelType::BLOCK ||
def.explictlySolid;
}
const float EPSILON = 0.01f;

View file

@ -227,6 +227,7 @@ template<> void ContentUnitLoader<Block>::loadUnit(
root.at("tick-interval").get(def.tickInterval);
root.at("overlay-texture").get(def.overlayTexture);
root.at("translucent").get(def.translucent);
root.at("solid").get(def.explictlySolid);
if (root.has("fields")) {
def.dataStruct = std::make_unique<StructLayout>();

View file

@ -331,7 +331,7 @@ void BlocksRenderer::blockCustomModel(
if (!block.rt.extended
&& !isOpen(glm::floor(coord + vp + 0.5f + n * 1e-3f), block, variant)
&& is_aligned(n)) {
/*&& is_aligned(n)*/) {
continue;
}

View file

@ -230,6 +230,9 @@ public:
/// @brief Block has semi-transparent texture
bool translucent = false;
/// @brief Explicitly overriding 'solid' property if true assigned
bool explictlySolid = false;
/// @brief Set of block physical hitboxes
std::vector<AABB> hitboxes {AABB()};