Skip to content

Commit 5b20ac4

Browse files
committed
fix(citizen-server-impl): validate onesync range when reassigning entity ownership
1 parent aa01d2b commit 5b20ac4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

code/components/citizen-server-impl/src/state/ServerGameState.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,6 +2818,12 @@ bool ServerGameState::MoveEntityToCandidate(const fx::sync::SyncEntityPtr& entit
28182818
float distance = std::numeric_limits<float>::max();
28192819

28202820
auto data = GetClientDataUnlocked(this, tgtClient);
2821+
2822+
if (data->routingBucket != entity->routingBucket)
2823+
{
2824+
continue;
2825+
}
2826+
28212827
sync::SyncEntityPtr playerEntity;
28222828
{
28232829
std::shared_lock _lock(data->playerEntityMutex);
@@ -2831,6 +2837,12 @@ bool ServerGameState::MoveEntityToCandidate(const fx::sync::SyncEntityPtr& entit
28312837
if (pos.x != 0.0f && !tgts.empty())
28322838
{
28332839
distance = glm::distance2(tgts[0], pos);
2840+
2841+
auto cullingRadius = data->GetPlayerCullingRadius();
2842+
if (distance > (cullingRadius * cullingRadius))
2843+
{
2844+
continue;
2845+
}
28342846
}
28352847
}
28362848

0 commit comments

Comments
 (0)