void ACharacter::PossessedBy(AController* NewController) { Super::PossessedBy(NewController); // If we are controlled remotely, set animation timing to be driven by client's network updates. So timing and events remain in sync. if (Mesh && (GetRemoteRole() == ROLE_AutonomousProxy && GetNetConnection() != nullptr)) { Mesh->bAutonomousTickPose = true; } }
void AEmitter::PostInitializeComponents() { Super::PostInitializeComponents(); // Let them die quickly on a dedicated server if (IsNetMode(NM_DedicatedServer) && (GetRemoteRole() == ROLE_None || bNetTemporary)) { SetLifeSpan(0.2f); } // Set Notification Delegate if (ParticleSystemComponent) { ParticleSystemComponent->OnSystemFinished.AddUniqueDynamic(this, &AEmitter::OnParticleSystemFinished); bCurrentlyActive = ParticleSystemComponent->bAutoActivate; } if (ParticleSystemComponent && bPostUpdateTickGroup) { ParticleSystemComponent->SetTickGroup(TG_PostUpdateWork); } }
bool AController::IsLocalController() const { const ENetMode NetMode = GetNetMode(); if (NetMode == NM_Standalone) { // Not networked. return true; } if (NetMode == NM_Client && Role == ROLE_AutonomousProxy) { // Networked client in control. return true; } if (GetRemoteRole() != ROLE_AutonomousProxy && Role == ROLE_Authority) { // Local authority in control. return true; } return false; }