Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-save active entities more often if they move a certain distance #15605

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/serverenvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2161,11 +2161,14 @@ void ServerEnvironment::deactivateFarObjects(const bool _force_delete)
v3s16 blockpos_o = getNodeBlockPos(floatToInt(objectpos, BS));

// If object's static data is stored in a deactivated block and object
// is actually located in an active block, re-save to the block in
// which the object is actually located in.
// is actually located in an active block, or if the object is actually located
// in an active block which is not neighboring to the block in which
// the object's static data is stored (there is at least one block between
// them), re-save to the block in which the object is actually located in.
Zughy marked this conversation as resolved.
Show resolved Hide resolved
if (!force_delete && obj->isStaticAllowed() && obj->m_static_exists &&
!m_active_blocks.contains(obj->m_static_block) &&
m_active_blocks.contains(blockpos_o)) {
m_active_blocks.contains(blockpos_o) &&
(!m_active_blocks.contains(obj->m_static_block) ||
blockpos_o.getDistanceFromSQ(obj->m_static_block) >= 2 * 2)) {
Zughy marked this conversation as resolved.
Show resolved Hide resolved

// Delete from block where object was located
deleteStaticFromBlock(obj, id, MOD_REASON_STATIC_DATA_REMOVED, false);
Expand Down
Loading