1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

LuaVoxelManip: Add option to allocate blank data

This commit is contained in:
kwolekr 2014-12-27 23:09:36 -05:00
parent ae2721f2c8
commit 8334100fe1
6 changed files with 60 additions and 4 deletions

View file

@ -3597,8 +3597,31 @@ ManualMapVoxelManipulator::~ManualMapVoxelManipulator()
{
}
void ManualMapVoxelManipulator::initializeBlank(v3s16 blockpos_min,
v3s16 blockpos_max)
{
// Units of these are MapBlocks
v3s16 pmin = blockpos_min;
v3s16 pmax = blockpos_max;
VoxelArea block_area_nodes(pmin * MAP_BLOCKSIZE,
(pmax + 1) * MAP_BLOCKSIZE - v3s16(1,1,1));
addArea(block_area_nodes);
u32 extent = m_area.getVolume();
for (u32 i = 0; i != extent; i++)
m_data[i] = MapNode(CONTENT_IGNORE);
for (s32 z = pmin.Z; z <= pmax.Z; z++)
for (s32 y = pmin.Y; y <= pmax.Y; y++)
for (s32 x = pmin.X; x <= pmax.X; x++)
m_loaded_blocks[v3s16(x, y, z)] = 0;
m_is_dirty = false;
}
void ManualMapVoxelManipulator::initialEmerge(v3s16 blockpos_min,
v3s16 blockpos_max, bool load_if_inexistent)
v3s16 blockpos_max, bool load_if_inexistent)
{
TimeTaker timer1("initialEmerge", &emerge_time);