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:
parent
0330cec7ec
commit
9736548720
15 changed files with 187 additions and 19 deletions
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: ";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue