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

Implement unloading of static_save=false objects according to existing docs (#10485)

This commit is contained in:
sfan5 2020-10-19 20:38:33 +02:00 committed by GitHub
parent 660115c1ab
commit 4f2303849e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View file

@ -1972,8 +1972,8 @@ void ServerEnvironment::deactivateFarObjects(bool _force_delete)
// force_delete might be overriden per object
bool force_delete = _force_delete;
// Do not deactivate if static data creation not allowed
if (!force_delete && !obj->isStaticAllowed())
// Do not deactivate if disallowed
if (!force_delete && !obj->shouldUnload())
return false;
// removeRemovedObjects() is responsible for these
@ -2002,7 +2002,10 @@ void ServerEnvironment::deactivateFarObjects(bool _force_delete)
}
// If block is still active, don't remove
if (!force_delete && m_active_blocks.contains(blockpos_o))
bool still_active = obj->isStaticAllowed() ?
m_active_blocks.contains(blockpos_o) :
getMap().getBlockNoCreateNoEx(blockpos_o) != nullptr;
if (!force_delete && still_active)
return false;
verbosestream << "ServerEnvironment::deactivateFarObjects(): "