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

Add ability to delete MapBlocks from map

Also add a Lua API and chatcommand for this
This commit is contained in:
kwolekr 2015-01-15 16:20:05 -05:00
parent 0330cec7ec
commit 9736548720
15 changed files with 187 additions and 19 deletions

View file

@ -3588,6 +3588,23 @@ MapBlock* ServerMap::loadBlock(v3s16 blockpos)
return getBlockNoCreateNoEx(blockpos);
}
bool ServerMap::deleteBlock(v3s16 blockpos)
{
if (!dbase->deleteBlock(blockpos))
return false;
MapBlock *block = getBlockNoCreateNoEx(blockpos);
if (block) {
v2s16 p2d(blockpos.X, blockpos.Z);
MapSector *sector = getSectorNoGenerateNoEx(p2d);
if (!sector)
return false;
sector->deleteBlock(block);
}
return true;
}
void ServerMap::PrintInfo(std::ostream &out)
{
out<<"ServerMap: ";