| 35 | #endif |
| 36 | |
| 37 | void AProjectileBullet::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) |
| 38 | { |
| 39 | ABlasterCharacter* OwnerCharacter = Cast<ABlasterCharacter>(GetOwner()); |
| 40 | if (OwnerCharacter) |
| 41 | { |
| 42 | ABlasterPlayerController* OwnerController = Cast<ABlasterPlayerController>(OwnerCharacter->Controller); |
| 43 | if (OwnerController) |
| 44 | { |
| 45 | if (OwnerCharacter->HasAuthority() && !bUseServerSideRewind) |
| 46 | { |
| 47 | |
| 48 | const float DamageToCause = Hit.BoneName.ToString() == FString("head") ? HeadShotDamage : Damage; |
| 49 | |
| 50 | UGameplayStatics::ApplyDamage(OtherActor, DamageToCause, OwnerController, this, UDamageType::StaticClass()); |
| 51 | Super::OnHit(HitComp, OtherActor, OtherComp, NormalImpulse, Hit); |
| 52 | return; |
| 53 | } |
| 54 | ABlasterCharacter* HitCharacter = Cast<ABlasterCharacter>(OtherActor); |
| 55 | if (bUseServerSideRewind && OwnerCharacter->GetLagCompensation() && OwnerCharacter->IsLocallyControlled() && HitCharacter) |
| 56 | { |
| 57 | OwnerCharacter->GetLagCompensation()->ProjectileServerScoreRequest( |
| 58 | HitCharacter, |
| 59 | TraceStart, |
| 60 | InitialVelocity, |
| 61 | OwnerController->GetServerTime() - OwnerController->SingleTripTime |
| 62 | ); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | Super::OnHit(HitComp, OtherActor, OtherComp, NormalImpulse, Hit); |
| 68 | } |
| 69 | |
| 70 | void AProjectileBullet::BeginPlay() |
| 71 | { |
nothing calls this directly
no test coverage detected