diff --git a/res/textures/blocks/struct_air.png b/res/textures/blocks/struct_air.png new file mode 100644 index 00000000..d5a7de09 Binary files /dev/null and b/res/textures/blocks/struct_air.png differ diff --git a/src/constants.hpp b/src/constants.hpp index 9766bcc8..e99c1c7f 100644 --- a/src/constants.hpp +++ b/src/constants.hpp @@ -24,6 +24,7 @@ inline constexpr uint MAX_OPEN_REGION_FILES = 32; inline constexpr blockid_t BLOCK_AIR = 0; inline constexpr blockid_t BLOCK_OBSTACLE = 1; +inline constexpr blockid_t BLOCK_STRUCT_AIR = 2; inline constexpr itemid_t ITEM_EMPTY = 0; inline constexpr entityid_t ENTITY_NONE = 0; diff --git a/src/core_defs.cpp b/src/core_defs.cpp index 5fe46341..7d19acd1 100644 --- a/src/core_defs.cpp +++ b/src/core_defs.cpp @@ -23,9 +23,10 @@ void corecontent::setup(EnginePaths* paths, ContentBuilder* builder) { block.model = BlockModel::none; block.pickingItem = CORE_EMPTY; } - - ItemDef& item = builder->items.create(CORE_EMPTY); - item.iconType = item_icon_type::none; + { + ItemDef& item = builder->items.create(CORE_EMPTY); + item.iconType = item_icon_type::none; + } auto bindsFile = paths->getResourcesFolder()/fs::path("bindings.toml"); if (fs::is_regular_file(bindsFile)) { @@ -47,4 +48,20 @@ void corecontent::setup(EnginePaths* paths, ContentBuilder* builder) { item.placingBlock = CORE_OBSTACLE; item.caption = block.caption; } + { + Block& block = builder->blocks.create(CORE_STRUCT_AIR); + for (uint i = 0; i < 6; i++) { + block.textureFaces[i] = "struct_air"; + } + block.drawGroup = -1; + block.skyLightPassing = true; + block.lightPassing = true; + block.hitboxes = {AABB()}; + block.obstacle = false; + ItemDef& item = builder->items.create(CORE_STRUCT_AIR+".item"); + item.iconType = item_icon_type::block; + item.icon = CORE_STRUCT_AIR; + item.placingBlock = CORE_STRUCT_AIR; + item.caption = block.caption; + } } diff --git a/src/core_defs.hpp b/src/core_defs.hpp index ccfa2e69..0f25de3a 100644 --- a/src/core_defs.hpp +++ b/src/core_defs.hpp @@ -3,8 +3,9 @@ #include inline const std::string CORE_EMPTY = "core:empty"; -inline const std::string CORE_OBSTACLE = "core:obstacle"; inline const std::string CORE_AIR = "core:air"; +inline const std::string CORE_OBSTACLE = "core:obstacle"; +inline const std::string CORE_STRUCT_AIR = "core:struct_air"; inline const std::string TEXTURE_NOTFOUND = "notfound"; diff --git a/src/world/generator/WorldGenerator.cpp b/src/world/generator/WorldGenerator.cpp index 365a63fc..e31f3cb0 100644 --- a/src/world/generator/WorldGenerator.cpp +++ b/src/world/generator/WorldGenerator.cpp @@ -348,7 +348,11 @@ void WorldGenerator::generate(voxel* voxels, int chunkX, int chunkZ) { const auto& structVoxel = structVoxels[vox_index(x, y, z, size.x, size.z)]; if (structVoxel.id) { - voxels[vox_index(sx, sy, sz)] = structVoxel; + if (structVoxel.id == BLOCK_STRUCT_AIR) { + voxels[vox_index(sx, sy, sz)] = {0, {}}; + } else { + voxels[vox_index(sx, sy, sz)] = structVoxel; + } } } }