bool AActor::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const { if (bAlwaysRelevant || IsOwnedBy(ViewTarget) || IsOwnedBy(RealViewer) || this == ViewTarget || ViewTarget == Instigator) { return true; } else if ( bNetUseOwnerRelevancy && Owner) { return Owner->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation); } else if ( bOnlyRelevantToOwner ) { return false; } else if ( RootComponent && RootComponent->AttachParent && RootComponent->AttachParent->GetOwner() && (Cast<USkeletalMeshComponent>(RootComponent->AttachParent) || (RootComponent->AttachParent->GetOwner() == Owner)) ) { return RootComponent->AttachParent->GetOwner()->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation); } else if( bHidden && (!RootComponent || !RootComponent->IsCollisionEnabled()) ) { return false; } if (!RootComponent) { UE_LOG(LogNet, Warning, TEXT("Actor %s / %s has no root component in AActor::IsNetRelevantFor. (Make bAlwaysRelevant=true?)"), *GetClass()->GetName(), *GetName() ); return false; } if (GetDefault<AGameNetworkManager>()->bUseDistanceBasedRelevancy) { return ((SrcLocation - GetActorLocation()).SizeSquared() < NetCullDistanceSquared); } return true; }
bool APawn::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const { CA_SUPPRESS(6011); if (bAlwaysRelevant || RealViewer == Controller || IsOwnedBy(ViewTarget) || IsOwnedBy(RealViewer) || this == ViewTarget || ViewTarget == Instigator || IsBasedOnActor(ViewTarget) || (ViewTarget && ViewTarget->IsBasedOnActor(this))) { return true; } else if( (bHidden || bOnlyRelevantToOwner) && (!GetRootComponent() || !GetRootComponent()->IsCollisionEnabled()) ) { return false; } else { UPrimitiveComponent* MovementBase = GetMovementBase(); AActor* BaseActor = MovementBase ? MovementBase->GetOwner() : NULL; if ( MovementBase && BaseActor && GetMovementComponent() && ((Cast<const USkeletalMeshComponent>(MovementBase)) || (BaseActor == GetOwner())) ) { return BaseActor->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation); } } return ((SrcLocation - GetActorLocation()).SizeSquared() < NetCullDistanceSquared); }
bool Hex::CanExploreFrom(const Team& team) const { // "...next to a hex where you have a Ship or an Influence Disc" // "If you Explore from a hex with only a Ship, it must not be pinned" return IsOwnedBy(team) || (HasShip(team.GetColour()) && CanMoveOut(team)); }