add core:struct_air

This commit is contained in:
MihailRis 2024-10-04 01:53:17 +03:00
parent 0cbc048523
commit a47b650591
5 changed files with 28 additions and 5 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -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;

View File

@ -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;
}
}

View File

@ -3,8 +3,9 @@
#include <string>
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";

View File

@ -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;
}
}
}
}