193 - Requesting a Shotgun Hit
This commit is contained in:
parent
87d05490a5
commit
8feb5dcbad
Binary file not shown.
|
@ -37,7 +37,7 @@ void ULagCompensationComponent::ServerScoreRequest_Implementation(ABlasterCharac
|
||||||
}
|
}
|
||||||
|
|
||||||
void ULagCompensationComponent::ShotgunServerScoreRequest_Implementation(const TArray<ABlasterCharacter*>& HitCharacters, const FVector_NetQuantize& TraceStart,
|
void ULagCompensationComponent::ShotgunServerScoreRequest_Implementation(const TArray<ABlasterCharacter*>& HitCharacters, const FVector_NetQuantize& TraceStart,
|
||||||
const TArray<FVector_NetQuantize>& HitLocations, float HitTime, AWeapon* DamageCauser)
|
const TArray<FVector_NetQuantize>& HitLocations, float HitTime)
|
||||||
{
|
{
|
||||||
FShotgunServerSideRewindResult Confirm = ShotgunServerSideRewind(HitCharacters, TraceStart, HitLocations, HitTime);
|
FShotgunServerSideRewindResult Confirm = ShotgunServerSideRewind(HitCharacters, TraceStart, HitLocations, HitTime);
|
||||||
|
|
||||||
|
@ -448,6 +448,8 @@ FFramePackage ULagCompensationComponent::GetFrameToCheck(ABlasterCharacter* HitC
|
||||||
FrameToCheck = InterpBetweenFrames(Older->GetValue(), Younger->GetValue(), HitTime);
|
FrameToCheck = InterpBetweenFrames(Older->GetValue(), Younger->GetValue(), HitTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FrameToCheck.Character = HitCharacter;
|
||||||
|
|
||||||
return FrameToCheck;
|
return FrameToCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,7 @@ public:
|
||||||
const TArray<ABlasterCharacter*>& HitCharacters,
|
const TArray<ABlasterCharacter*>& HitCharacters,
|
||||||
const FVector_NetQuantize& TraceStart,
|
const FVector_NetQuantize& TraceStart,
|
||||||
const TArray<FVector_NetQuantize>& HitLocations,
|
const TArray<FVector_NetQuantize>& HitLocations,
|
||||||
float HitTime,
|
float HitTime
|
||||||
AWeapon* DamageCauser
|
|
||||||
);
|
);
|
||||||
|
|
||||||
FShotgunServerSideRewindResult ShotgunServerSideRewind(
|
FShotgunServerSideRewindResult ShotgunServerSideRewind(
|
||||||
|
|
|
@ -45,7 +45,7 @@ void AHitScanWeapon::Fire(const FVector& HitTarget)
|
||||||
OwnerCharacter = OwnerCharacter == nullptr ? Cast<ABlasterCharacter>(OwnerPawn) : OwnerCharacter;
|
OwnerCharacter = OwnerCharacter == nullptr ? Cast<ABlasterCharacter>(OwnerPawn) : OwnerCharacter;
|
||||||
OwnerController = OwnerController == nullptr ? Cast<ABlasterPlayerController>(InstigatorController) : OwnerController;
|
OwnerController = OwnerController == nullptr ? Cast<ABlasterPlayerController>(InstigatorController) : OwnerController;
|
||||||
|
|
||||||
if (OwnerCharacter && OwnerController && OwnerCharacter->GetLagCompensation())
|
if (OwnerCharacter && OwnerController && OwnerCharacter->GetLagCompensation() && OwnerCharacter->IsLocallyControlled())
|
||||||
{
|
{
|
||||||
OwnerCharacter->GetLagCompensation()->ServerScoreRequest(
|
OwnerCharacter->GetLagCompensation()->ServerScoreRequest(
|
||||||
BlasterCharacter,
|
BlasterCharacter,
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "Shotgun.h"
|
#include "Shotgun.h"
|
||||||
|
|
||||||
#include "Blaster/Character/BlasterCharacter.h"
|
#include "Blaster/Character/BlasterCharacter.h"
|
||||||
|
#include "Blaster/Components/LagCompensationComponent.h"
|
||||||
|
#include "Blaster/PlayerController/BlasterPlayerController.h"
|
||||||
#include "Engine/SkeletalMeshSocket.h"
|
#include "Engine/SkeletalMeshSocket.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
#include "Kismet/KismetMathLibrary.h"
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
|
@ -11,7 +13,7 @@
|
||||||
void AShotgun::FireShotgun(const TArray<FVector_NetQuantize>& HitTargets)
|
void AShotgun::FireShotgun(const TArray<FVector_NetQuantize>& HitTargets)
|
||||||
{
|
{
|
||||||
AWeapon::Fire(FVector());
|
AWeapon::Fire(FVector());
|
||||||
const APawn* OwnerPawn = Cast<APawn>(GetOwner());
|
APawn* OwnerPawn = Cast<APawn>(GetOwner());
|
||||||
if (OwnerPawn == nullptr) return;
|
if (OwnerPawn == nullptr) return;
|
||||||
AController* InstigatorController = OwnerPawn->GetController();
|
AController* InstigatorController = OwnerPawn->GetController();
|
||||||
|
|
||||||
|
@ -61,9 +63,13 @@ void AShotgun::FireShotgun(const TArray<FVector_NetQuantize>& HitTargets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TArray<ABlasterCharacter*> HitCharacters;
|
||||||
for (auto HitPair : HitMap)
|
for (auto HitPair : HitMap)
|
||||||
{
|
{
|
||||||
if (HitPair.Key && HasAuthority() && InstigatorController)
|
if (HitPair.Key && InstigatorController)
|
||||||
|
{
|
||||||
|
if (HasAuthority() && !bUseServerSideRewind)
|
||||||
{
|
{
|
||||||
UGameplayStatics::ApplyDamage(
|
UGameplayStatics::ApplyDamage(
|
||||||
HitPair.Key, // Character that was hit
|
HitPair.Key, // Character that was hit
|
||||||
|
@ -73,6 +79,25 @@ void AShotgun::FireShotgun(const TArray<FVector_NetQuantize>& HitTargets)
|
||||||
UDamageType::StaticClass()
|
UDamageType::StaticClass()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HitCharacters.Add(HitPair.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!HasAuthority() && bUseServerSideRewind)
|
||||||
|
{
|
||||||
|
OwnerCharacter = OwnerCharacter == nullptr ? Cast<ABlasterCharacter>(OwnerPawn) : OwnerCharacter;
|
||||||
|
OwnerController = OwnerController == nullptr ? Cast<ABlasterPlayerController>(InstigatorController) : OwnerController;
|
||||||
|
|
||||||
|
if (OwnerCharacter && OwnerController && OwnerCharacter->GetLagCompensation() && OwnerCharacter->IsLocallyControlled())
|
||||||
|
{
|
||||||
|
OwnerCharacter->GetLagCompensation()->ShotgunServerScoreRequest(
|
||||||
|
HitCharacters,
|
||||||
|
Start,
|
||||||
|
HitTargets,
|
||||||
|
OwnerController->GetServerTime() - OwnerController->SingleTripTime
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue