diff --git a/EndlessVendetta/EndlessVendetta.sln.DotSettings.user b/EndlessVendetta/EndlessVendetta.sln.DotSettings.user
deleted file mode 100644
index 2b08f3a1..00000000
--- a/EndlessVendetta/EndlessVendetta.sln.DotSettings.user
+++ /dev/null
@@ -1,2 +0,0 @@
-
- C:\Users\Rafal\AppData\Local\JetBrains\Rider2023.3\resharper-host\temp\Rider\vAny\CoverageData\_EndlessVendetta.-1253833435\Snapshot\snapshot.utdcvr
\ No newline at end of file
diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp
index 509df1eb..53ef1ced 100644
--- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp
+++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp
@@ -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(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(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(SecondaryWeaponActor);
- SecondaryWeapon->SetActorHiddenInGame(false);
- bIsCurrentlyHoldingWeapon = true;
- GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);
+ if (SecondaryWeaponClass != nullptr)
+ {
+ SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("PistolGripPoint"));
+ SecondaryWeapon = Cast(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(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(PrimaryWeaponClass, spawnParams);
+ GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("non ifstatement code running"));
+ PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
+ PrimaryWeapon = Cast(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(SecondaryWeaponClass, spawnParams);
+ }
+ GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Orange, TEXT("EquipSecondarycalled skipped bIsCurrentlyHoldingWeapon check"));
EquipSecondary();
}
bIsWeaponPickedUp = true;