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">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="dfa3053d-1d51-4dad-9270-4c17e086f627" name="Changes" comment="">
|
<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$/.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>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -51,7 +51,7 @@ void AEndlessVendettaCharacter::BeginPlay()
|
|||||||
{
|
{
|
||||||
// Call the base class
|
// Call the base class
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
bIsCurrentlyHoldingWeapon = false;
|
||||||
UEVGameInstance* GI = Cast<UEVGameInstance>(GetWorld()->GetGameInstance());
|
UEVGameInstance* GI = Cast<UEVGameInstance>(GetWorld()->GetGameInstance());
|
||||||
if (IsValid(GI->MainSaveGameInstanceRef))
|
if (IsValid(GI->MainSaveGameInstanceRef))
|
||||||
{
|
{
|
||||||
@ -369,6 +369,8 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
PrimaryWeapon = nullptr;
|
PrimaryWeapon = nullptr;
|
||||||
bHasRifle = false;
|
bHasRifle = false;
|
||||||
GLog->Log("Primary Weapon Put Away");
|
GLog->Log("Primary Weapon Put Away");
|
||||||
|
bIsCurrentlyHoldingWeapon = false;
|
||||||
|
//this is for philips stat viewer thingy
|
||||||
Cast<AEndlessVendettaGameMode>(GetWorld()->GetAuthGameMode())->SendEvent("DeEquip", "Pri");
|
Cast<AEndlessVendettaGameMode>(GetWorld()->GetAuthGameMode())->SendEvent("DeEquip", "Pri");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -378,6 +380,7 @@ 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;
|
||||||
|
|
||||||
|
//this code handles when you FIRST dont have any primary weapon
|
||||||
if (!IsValid(PrimaryWeapon))
|
if (!IsValid(PrimaryWeapon))
|
||||||
{
|
{
|
||||||
bHasRifle = true;
|
bHasRifle = true;
|
||||||
@ -387,6 +390,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
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);
|
||||||
|
bIsCurrentlyHoldingWeapon = true;
|
||||||
bIsPrimaryWeaponCreated = true;
|
bIsPrimaryWeaponCreated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,6 +398,7 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||||
PrimaryWeapon->SetActorHiddenInGame(false);
|
PrimaryWeapon->SetActorHiddenInGame(false);
|
||||||
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
|
GetWorldTimerManager().ClearTimer(PrimaryWeapon->reloadTimerHandle);
|
||||||
|
bIsCurrentlyHoldingWeapon = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEndlessVendettaCharacter::EquipSecondary()
|
void AEndlessVendettaCharacter::EquipSecondary()
|
||||||
@ -413,7 +418,9 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
SecondaryWeapon->SetActorEnableCollision(false);
|
SecondaryWeapon->SetActorEnableCollision(false);
|
||||||
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
this->GetFirstPersonCameraComponent()->SetFieldOfView(90);
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
|
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;
|
SecondaryWeapon = nullptr;
|
||||||
|
bIsCurrentlyHoldingWeapon = false;
|
||||||
bHasRifle = false;
|
bHasRifle = false;
|
||||||
GLog->Log("Secondary Weapon Put Away");
|
GLog->Log("Secondary Weapon Put Away");
|
||||||
return;
|
return;
|
||||||
@ -433,14 +440,15 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||||
|
bIsCurrentlyHoldingWeapon = true;
|
||||||
bIsSecondaryWeaponCreated = true;
|
bIsSecondaryWeaponCreated = true;
|
||||||
}
|
}
|
||||||
//UE_LOG(LogTemp, Warning, TEXT("Secondary Weapon Is Hidden: %hhd"), SecondaryWeapon->IsHidden());
|
|
||||||
GLog->Log("Secondary Weapon Equipped");
|
GLog->Log("Secondary Weapon Equipped");
|
||||||
}
|
}
|
||||||
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("PistolGripPoint"));
|
SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("PistolGripPoint"));
|
||||||
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||||
SecondaryWeapon->SetActorHiddenInGame(false);
|
SecondaryWeapon->SetActorHiddenInGame(false);
|
||||||
|
bIsCurrentlyHoldingWeapon = true;
|
||||||
GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);
|
GetWorldTimerManager().ClearTimer(SecondaryWeapon->reloadTimerHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,6 +473,10 @@ void AEndlessVendettaCharacter::WeaponSwitcher(AActor* Outhit)
|
|||||||
|
|
||||||
Outhit->Destroy();
|
Outhit->Destroy();
|
||||||
EquipPrimary();
|
EquipPrimary();
|
||||||
|
if (bIsCurrentlyHoldingWeapon)
|
||||||
|
{
|
||||||
|
//do stuff here
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (Outhit->ActorHasTag("SecondaryWeapon"))
|
if (Outhit->ActorHasTag("SecondaryWeapon"))
|
||||||
{
|
{
|
||||||
|
@ -268,6 +268,8 @@ public:
|
|||||||
UFUNCTION(Exec)
|
UFUNCTION(Exec)
|
||||||
void UpdateInventorySize(int Cols, int Rows);
|
void UpdateInventorySize(int Cols, int Rows);
|
||||||
|
|
||||||
|
bool bIsCurrentlyHoldingWeapon;
|
||||||
|
|
||||||
// Space Ship
|
// Space Ship
|
||||||
private:
|
private:
|
||||||
UPROPERTY(EditDefaultsOnly, Category = "Space Ship")
|
UPROPERTY(EditDefaultsOnly, Category = "Space Ship")
|
||||||
|
Loading…
Reference in New Issue
Block a user