IFilterEntityManager work
Signed-off-by: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com>
This commit is contained in:
+18
-24
@@ -63,13 +63,6 @@ namespace Multiplayer
|
||||
m_controlledEntityTransform = entity ? entity->GetTransform() : nullptr;
|
||||
AZ_Assert(m_controlledEntityTransform, "Controlled player entity must have a transform");
|
||||
|
||||
//// this one is optional
|
||||
//mp_ControlledFilteredEntityComponent = m_controlledEntity->FindController<FilteredEntityComponent::Authority>();
|
||||
//if (mp_ControlledFilteredEntityComponent)
|
||||
//{
|
||||
// mp_ControlledFilteredEntityComponent->AddFilteredEntityEventHandle(m_FilteredEntityAddedEventHandle);
|
||||
//}
|
||||
|
||||
m_updateWindowEvent.Enqueue(sv_ClientReplicationWindowUpdateMs, true);
|
||||
|
||||
AZ::Interface<AZ::ComponentApplicationRequests>::Get()->RegisterEntityActivatedEventHandler(m_entityActivatedEventHandler);
|
||||
@@ -145,21 +138,23 @@ namespace Multiplayer
|
||||
}
|
||||
);
|
||||
|
||||
NetworkEntityTracker* networkEntityTracker = GetNetworkEntityTracker();
|
||||
NetworkEntityTracker* networkEntityTracker = GetNetworkEntityTracker();
|
||||
IFilterEntityManager* filterEntityManager = GetMultiplayer()->GetFilterEntityManager();
|
||||
|
||||
// Add all the neighbors
|
||||
for (AzFramework::VisibilityEntry* visEntry : gatheredEntries)
|
||||
{
|
||||
//if (mp_ControlledFilteredEntityComponent && mp_ControlledFilteredEntityComponent->IsEntityFiltered(iterator.Get()))
|
||||
//{
|
||||
// continue;
|
||||
//}
|
||||
|
||||
// We want to find the closest extent to the player and prioritize using that distance
|
||||
AZ::Entity* entity = static_cast<AZ::Entity*>(visEntry->m_userData);
|
||||
|
||||
if (filterEntityManager && filterEntityManager->IsEntityFiltered(entity, m_controlledEntity, m_connection->GetConnectionId()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NetBindComponent* entryNetBindComponent = entity->template FindComponent<NetBindComponent>();
|
||||
if (entryNetBindComponent != nullptr)
|
||||
{
|
||||
// We want to find the closest extent to the player and prioritize using that distance
|
||||
const AZ::Vector3 supportNormal = controlledEntityPosition - visEntry->m_boundingVolume.GetCenter();
|
||||
const AZ::Vector3 closestPosition = visEntry->m_boundingVolume.GetSupport(supportNormal);
|
||||
const float gatherDistanceSquared = controlledEntityPosition.GetDistanceSq(closestPosition);
|
||||
@@ -212,10 +207,13 @@ namespace Multiplayer
|
||||
{
|
||||
if (netBindComponent->HasController())
|
||||
{
|
||||
//if (mp_ControlledFilteredEntityComponent && mp_ControlledFilteredEntityComponent->IsEntityFiltered(newEntity))
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if (IFilterEntityManager* filter = GetMultiplayer()->GetFilterEntityManager())
|
||||
{
|
||||
if (filter->IsEntityFiltered(entity, m_controlledEntity, m_connection->GetConnectionId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AZ::TransformInterface* transformInterface = entity->GetTransform();
|
||||
if (transformInterface != nullptr)
|
||||
@@ -274,6 +272,8 @@ namespace Multiplayer
|
||||
|
||||
void ServerToClientReplicationWindow::AddEntityToReplicationSet(ConstNetworkEntityHandle& entityHandle, float priority, [[maybe_unused]] float distanceSquared)
|
||||
{
|
||||
// Assumption: the entity has been checked for filtering prior to this call.
|
||||
|
||||
if (!sv_ReplicateServerProxies)
|
||||
{
|
||||
NetBindComponent* netBindComponent = entityHandle.GetNetBindComponent();
|
||||
@@ -314,10 +314,4 @@ namespace Multiplayer
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//void ServerToClientReplicationWindow::OnAddFilteredEntity(NetEntityId filteredEntityId)
|
||||
//{
|
||||
// ConstEntityPtr filteredEntity = gNovaGame->GetEntityManager().GetEntity(filteredEntityId);
|
||||
// m_replicationSet.erase(filteredEntityId);
|
||||
//}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user