Fixed not being able to pickup primary while holding secondary
This commit is contained in:
parent
6fc0a508cf
commit
27756691ba
@ -1,2 +0,0 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Rafal\AppData\Local\JetBrains\Rider2023.3\resharper-host\temp\Rider\vAny\CoverageData\_EndlessVendetta.-1253833435\Snapshot\snapshot.utdcvr</s:String></wpf:ResourceDictionary>
|
@ -360,11 +360,11 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
if (bIsReloading) return;
|
||||
if (IsValid(PrimaryWeapon))
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("IsPrimaryWeapon valid check running"));
|
||||
PrimaryWeapon->DetachFromActor(DetatchRules);
|
||||
PrimaryWeapon->AttachToComponent(Mesh1P, AttachmentRules, FName("UnEquipGunSocket"));
|
||||
PrimaryWeapon->SetActorHiddenInGame(true);
|
||||
PrimaryWeapon->SetActorEnableCollision(false);
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("Weapon Removing because validated"));
|
||||
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
||||
UE_LOG(LogTemp, Warning, TEXT("Primary Weapon Is Hidden: %hhd"), PrimaryWeapon->IsHidden());
|
||||
PrimaryWeapon = nullptr;
|
||||
@ -397,13 +397,16 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
}
|
||||
}
|
||||
//For when you already have all your weapons and ur switching with 1 and 2 or when your picking up a weapon with a weapon in hand
|
||||
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
bHasRifle = true;
|
||||
if (PrimaryWeaponClass != nullptr)
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
|
||||
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
bHasRifle = true;
|
||||
}
|
||||
}
|
||||
|
||||
void AEndlessVendettaCharacter::EquipSecondary()
|
||||
@ -450,11 +453,14 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
||||
}
|
||||
GLog->Log("Secondary Weapon Equipped");
|
||||
}
|
||||
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("PistolGripPoint"));
|
||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);
|
||||
if (SecondaryWeaponClass != nullptr)
|
||||
{
|
||||
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("PistolGripPoint"));
|
||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);
|
||||
}
|
||||
}
|
||||
|
||||
void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
||||
@ -470,8 +476,8 @@ void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
||||
{
|
||||
if(bIsCurrentlyHoldingWeapon)
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Blue, TEXT("Player is currently holding weapon"));
|
||||
PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
||||
UE_LOG(LogTemp, Warning, TEXT("PRIMARY WEAPON SPAWNING IN"));
|
||||
}
|
||||
EquipPrimary();
|
||||
}
|
||||
@ -483,7 +489,22 @@ void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
||||
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
|
||||
}
|
||||
|
||||
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Yellow, TEXT("Destroy just gets called and equip primary"));
|
||||
if (IsValid(SecondaryWeapon))
|
||||
{
|
||||
if (bIsCurrentlyHoldingWeapon)
|
||||
{
|
||||
PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
|
||||
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
bHasRifle = true;
|
||||
}
|
||||
EquipPrimary();
|
||||
}
|
||||
Outhit->Destroy();
|
||||
EquipPrimary();
|
||||
}
|
||||
@ -491,6 +512,12 @@ void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
||||
{
|
||||
if (IsValid(SecondaryWeapon))
|
||||
{
|
||||
if(bIsCurrentlyHoldingWeapon)
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Blue, TEXT("bIsCurrentlyHoldingSecondaryCalled, trying to spawn secondary weapon actor"));
|
||||
SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams);
|
||||
}
|
||||
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Orange, TEXT("EquipSecondarycalled skipped bIsCurrentlyHoldingWeapon check"));
|
||||
EquipSecondary();
|
||||
}
|
||||
bIsWeaponPickedUp = true;
|
||||
|
Loading…
Reference in New Issue
Block a user