void ACharacter::PreReplication( IRepChangedPropertyTracker & ChangedPropertyTracker ) { Super::PreReplication( ChangedPropertyTracker ); const FAnimMontageInstance * RootMotionMontageInstance = GetRootMotionAnimMontageInstance(); if ( RootMotionMontageInstance && ( GetRemoteRole() == ROLE_SimulatedProxy ) ) { // Is position stored in local space? RepRootMotion.bRelativePosition = RelativeMovement.HasRelativePosition(); RepRootMotion.Location = RepRootMotion.bRelativePosition ? RelativeMovement.Location : GetActorLocation(); RepRootMotion.Rotation = RepRootMotion.bRelativePosition ? RelativeMovement.Rotation : GetActorRotation(); RepRootMotion.MovementBase = RelativeMovement.MovementBase; RepRootMotion.AnimMontage = RootMotionMontageInstance->Montage; RepRootMotion.Position = RootMotionMontageInstance->Position; DOREPLIFETIME_ACTIVE_OVERRIDE( ACharacter, RepRootMotion, true ); } else { RepRootMotion.Clear(); DOREPLIFETIME_ACTIVE_OVERRIDE( ACharacter, RepRootMotion, false ); } }
void ANimModCharacter::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) { Super::PreReplication(ChangedPropertyTracker); // Only replicate this property for a short duration after it changes so join in progress players don't get spammed with fx when joining late DOREPLIFETIME_ACTIVE_OVERRIDE(ANimModCharacter, LastTakeHitInfo, GetWorld() && GetWorld()->GetTimeSeconds() < LastTakeHitTimeTimeout); }
void ACharacter::PreReplication( IRepChangedPropertyTracker & ChangedPropertyTracker ) { Super::PreReplication( ChangedPropertyTracker ); const FAnimMontageInstance* RootMotionMontageInstance = GetRootMotionAnimMontageInstance(); if ( RootMotionMontageInstance ) { // Is position stored in local space? RepRootMotion.bRelativePosition = BasedMovement.HasRelativeLocation(); RepRootMotion.bRelativeRotation = BasedMovement.HasRelativeRotation(); RepRootMotion.Location = RepRootMotion.bRelativePosition ? BasedMovement.Location : GetActorLocation(); RepRootMotion.Rotation = RepRootMotion.bRelativeRotation ? BasedMovement.Rotation : GetActorRotation(); RepRootMotion.MovementBase = BasedMovement.MovementBase; RepRootMotion.MovementBaseBoneName = BasedMovement.BoneName; RepRootMotion.AnimMontage = RootMotionMontageInstance->Montage; RepRootMotion.Position = RootMotionMontageInstance->GetPosition(); DOREPLIFETIME_ACTIVE_OVERRIDE( ACharacter, RepRootMotion, true ); } else { RepRootMotion.Clear(); DOREPLIFETIME_ACTIVE_OVERRIDE( ACharacter, RepRootMotion, false ); } ReplicatedMovementMode = CharacterMovement->PackNetworkMovementMode(); ReplicatedBasedMovement = BasedMovement; // Optimization: only update and replicate these values if they are actually going to be used. if (BasedMovement.HasRelativeLocation()) { // When velocity becomes zero, force replication so the position is updated to match the server (it may have moved due to simulation on the client). ReplicatedBasedMovement.bServerHasVelocity = !CharacterMovement->Velocity.IsZero(); // Make sure absolute rotations are updated in case rotation occurred after the base info was saved. if (!BasedMovement.HasRelativeRotation()) { ReplicatedBasedMovement.Rotation = GetActorRotation(); } } }
void AUTBetrayalPlayerState::PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) { Super::PreReplication(ChangedPropertyTracker); // Replicate the nemesis at end of the match to everyone AUTGameMode* GM = GetWorld()->GetAuthGameMode<AUTGameMode>(); if (GM && GM->bGameEnded) { DOREPLIFETIME_ACTIVE_OVERRIDE(AUTBetrayalPlayerState, CurrentNemesis, true); } }