mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-30 04:35:20 +01:00
Add ability to delete MapBlocks from map
Also add a Lua API and chatcommand for this
This commit is contained in:
17
src/map.cpp
17
src/map.cpp
@@ -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: ";
|
||||
|
||||
Reference in New Issue
Block a user