Fixed weapon not being able to be re-equipped & created new bool
we love dirty flags!
This commit is contained in:
parent
8236ce7bcc
commit
089b680fe4
@ -9,6 +9,8 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="dfa3053d-1d51-4dad-9270-4c17e086f627" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/EndlessVendettaCharacter.h" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -51,7 +51,7 @@ void AEndlessVendettaCharacter::BeginPlay()
|
||||
{
|
||||
// Call the base class
|
||||
Super::BeginPlay();
|
||||
|
||||
bIsCurrentlyHoldingWeapon = false;
|
||||
UEVGameInstance* GI = Cast<UEVGameInstance>(GetWorld()->GetGameInstance());
|
||||
if (IsValid(GI->MainSaveGameInstanceRef))
|
||||
{
|
||||
@ -369,6 +369,8 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
PrimaryWeapon = nullptr;
|
||||
bHasRifle = false;
|
||||
GLog->Log("Primary Weapon Put Away");
|
||||
bIsCurrentlyHoldingWeapon = false;
|
||||
//this is for philips stat viewer thingy
|
||||
Cast<AEndlessVendettaGameMode>(GetWorld()->GetAuthGameMode())->SendEvent("DeEquip", "Pri");
|
||||
return;
|
||||
}
|
||||
@ -378,6 +380,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
if (GadgetManager->IsValidReconGadget() && GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;
|
||||
if (GadgetManager->IsValidCombatGadget() && GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;
|
||||
|
||||
//this code handles when you FIRST dont have any primary weapon
|
||||
if (!IsValid(PrimaryWeapon))
|
||||
{
|
||||
bHasRifle = true;
|
||||
@ -387,6 +390,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
bIsPrimaryWeaponCreated = true;
|
||||
}
|
||||
}
|
||||
@ -394,6 +398,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
}
|
||||
|
||||
void AEndlessVendettaCharacter::EquipSecondary()
|
||||
@ -413,7 +418,9 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
||||
SecondaryWeapon->SetActorEnableCollision(false);
|
||||
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
||||
UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
|
||||
//the nullptr makes it so we can unequip and requip the same weapon
|
||||
SecondaryWeapon = nullptr;
|
||||
bIsCurrentlyHoldingWeapon = false;
|
||||
bHasRifle = false;
|
||||
GLog->Log("Secondary Weapon Put Away");
|
||||
return;
|
||||
@ -433,14 +440,15 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
||||
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
bIsSecondaryWeaponCreated = true;
|
||||
}
|
||||
//UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
|
||||
GLog->Log("Secondary Weapon Equipped");
|
||||
}
|
||||
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("PistolGripPoint"));
|
||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||
bIsCurrentlyHoldingWeapon = true;
|
||||
GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);
|
||||
}
|
||||
|
||||
@ -465,6 +473,10 @@ void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
||||
|
||||
Outhit->Destroy();
|
||||
EquipPrimary();
|
||||
if (bIsCurrentlyHoldingWeapon)
|
||||
{
|
||||
//do stuff here
|
||||
}
|
||||
}
|
||||
if (Outhit->ActorHasTag("SecondaryWeapon"))
|
||||
{
|
||||
|
@ -268,6 +268,8 @@ public:
|
||||
UFUNCTION(Exec)
|
||||
void UpdateInventorySize(int Cols, int Rows);
|
||||
|
||||
bool bIsCurrentlyHoldingWeapon;
|
||||
|
||||
// Space Ship
|
||||
private:
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Space Ship")
|
||||
|
Loading…
Reference in New Issue
Block a user