Removed Unmatching code in PrimaryWeapon switcher

This commit is contained in:
MH261677 2024-02-06 11:40:01 +00:00
parent e44395a58f
commit f8aee1c58a

View File

@ -382,7 +382,6 @@ void AEndlessVendettaCharacter::EquipPrimary()
if (GadgetManager->IsValidReconGadget() && GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return; if (GadgetManager->IsValidReconGadget() && GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;
if (GadgetManager->IsValidCombatGadget() && GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return; if (GadgetManager->IsValidCombatGadget() && GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;
if (!IsValid(PrimaryWeapon)) if (!IsValid(PrimaryWeapon))
{ {
bHasRifle = true; bHasRifle = true;
@ -394,30 +393,13 @@ void AEndlessVendettaCharacter::EquipPrimary()
PrimaryWeapon->SetActorHiddenInGame(false); PrimaryWeapon->SetActorHiddenInGame(false);
bIsPrimaryWeaponCreated = true; bIsPrimaryWeaponCreated = true;
} }
//UE_LOG(LogTemp, Warning, TEXT("Primary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden()); //UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
GLog->Log("Primary Weapon Equipped"); GLog->Log("Secondary Weapon Equipped");
} }
if (!IsValid(PrimaryWeaponActor)) return;
Cast<AEndlessVendettaGameMode>(GetWorld()->GetAuthGameMode())->SendEvent("Equip", "Pri");
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor); PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
PrimaryWeapon->SetActorHiddenInGame(false); PrimaryWeapon->SetActorHiddenInGame(false);
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle); GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
// bHasRifle = true;
// // if(!bIsPrimaryWeaponCreated)
// // {
// // //Creating a new actor object called PrimaryWeapon that is based off primaryweaponClass
// // //Changing PrimaryWeaponActor to ABaseWeaponClass type instead of actor and storing it into PrimaryWeapon which is a ABaseClass Object
// // //We do this because we need to check if PrimaryWeapon is equipped and we want primaryweapon to be ABaseWeapon type and not a generic AActor
// // PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
// // PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
// // PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
// // PrimaryWeapon->SetActorHiddenInGame(false);
// // bIsPrimaryWeaponCreated = true;
// // }
} }
void AEndlessVendettaCharacter::EquipSecondary() void AEndlessVendettaCharacter::EquipSecondary()