Modify current weapon checking in ThrowWeaponCallback

This commit is contained in:
baz 2023-10-05 22:04:28 +01:00
parent da1fcc15bd
commit dc0ed36573
1 changed files with 13 additions and 11 deletions

View File

@ -601,6 +601,8 @@ float APlayerCharacter::GetWeaponSpread()
}
void APlayerCharacter::ThrowWeaponCallback()
{
if (CurrentWeapon)
{
FVector Location;
FVector BoxExtent;
@ -610,16 +612,16 @@ void APlayerCharacter::ThrowWeaponCallback()
SpawnLocation += Location;
SpawnLocation.Z += BoxExtent.Z;
if (TSubclassOf<AWeaponThrowable> WeaponThrowableTemplate = GetCurrentWeapon()->GetWeaponThrowableTemplate())
{
TSubclassOf<AWeaponThrowable> WeaponThrowableTemplate = CurrentWeapon->GetWeaponThrowableTemplate();
AWeaponThrowable* Throwable = GetWorld()->SpawnActor<AWeaponThrowable>(
WeaponThrowableTemplate, SpawnLocation, FRotator::ZeroRotator);
Throwable->SetWeaponSkeletalMesh(GetCurrentWeapon()->GetSkeletalMesh());
}
RemoveCurrentWeaponFromInventory();
}
}
void APlayerCharacter::ThrowExplosiveCallback()
{