From 8c550dfbe9124a23d106773d276dabd2f36ed04b Mon Sep 17 00:00:00 2001 From: PHILIP WHITE Date: Fri, 22 Mar 2024 12:14:49 +0000 Subject: [PATCH] Update Dialogue for Adding Items to Inventory --- .../Dialogue/Testing/TestDialogueCube.uasset | 4 +- .../Dialogue/Testing/TestDialogueCube1.uasset | 3 + .../Content/Dialogue/UI/BP_DialogueUI.uasset | 4 +- .../Blueprints/BP_MainCharacter.uasset | 4 +- .../InvItem_ApartmentPartyInvitation.uasset | 4 +- .../D/7L/KUWJ50Q9H612B3SWHC7ZMP.uasset | 3 + .../E/3W/EFD3Z49R81R9HF96BWZZKX.uasset | 3 + .../AC_PlayerDialogueInterpreter.cpp | 85 +++++++++++++++---- .../AC_PlayerDialogueInterpreter.h | 6 ++ .../DialogueSystem/DialogueAddItemNode.cpp | 16 +++- .../DialogueSystem/DialogueAddItemNode.h | 9 +- .../DialogueSystem/DialogueChoiceNode.cpp | 26 ++++-- .../DialogueSystem/DialogueChoiceNode.h | 4 +- .../DialogueSystem/DialogueFlagEnum.h | 2 - .../DialogueSystem/DialogueTextNode.h | 7 ++ .../DialogueSystem/DialogueTree.cpp | 2 +- .../Inventory/InventoryComponent.cpp | 10 +++ .../Inventory/InventoryComponent.h | 4 + 18 files changed, 155 insertions(+), 41 deletions(-) create mode 100644 EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube1.uasset create mode 100644 EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/D/7L/KUWJ50Q9H612B3SWHC7ZMP.uasset create mode 100644 EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/E/3W/EFD3Z49R81R9HF96BWZZKX.uasset diff --git a/EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset b/EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset index c12313ff..f8d0b0f4 100644 --- a/EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset +++ b/EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e7323a610767b1f1cc758dd6fa1c9cb34407545561ad153e0ad0ac12cb78f894 -size 28384 +oid sha256:60ca28d8ea931aac38d3b1af2a9047218386627a5abebddb6f886ab4a10b2866 +size 28365 diff --git a/EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube1.uasset b/EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube1.uasset new file mode 100644 index 00000000..c773b6c7 --- /dev/null +++ b/EndlessVendetta/Content/Dialogue/Testing/TestDialogueCube1.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98f3200419788cc44da81529df16091e537e6d35c6143955a544c12ba8d74bcc +size 28241 diff --git a/EndlessVendetta/Content/Dialogue/UI/BP_DialogueUI.uasset b/EndlessVendetta/Content/Dialogue/UI/BP_DialogueUI.uasset index 103eaa24..5709b615 100644 --- a/EndlessVendetta/Content/Dialogue/UI/BP_DialogueUI.uasset +++ b/EndlessVendetta/Content/Dialogue/UI/BP_DialogueUI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:34df24376c8d24cc566d17498aa98176fb57848e40896ad997766b04ffb4f336 -size 361537 +oid sha256:ae5fce5e1c386ddff8e2014e748a1ff817e61cf61c2fae95617d66e2b6bd6bd6 +size 364953 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset index e34b93cc..9bd6f449 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_MainCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7860a1f9b3977a94571670fd0e70cb199043382e5fbe8a5cf70aab754c49b8f -size 1535946 +oid sha256:0c3767113ad9d19a41ed1caeee918b8689558d6021b0ed4fd40b158db4226a0b +size 1524220 diff --git a/EndlessVendetta/Content/Inventory/Items/Favour/InvItem_ApartmentPartyInvitation.uasset b/EndlessVendetta/Content/Inventory/Items/Favour/InvItem_ApartmentPartyInvitation.uasset index 0b1fed00..0a674fa1 100644 --- a/EndlessVendetta/Content/Inventory/Items/Favour/InvItem_ApartmentPartyInvitation.uasset +++ b/EndlessVendetta/Content/Inventory/Items/Favour/InvItem_ApartmentPartyInvitation.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3821065295931591f0503c242ca352044ee15e34b0db43c9bca0cca824b9eb19 -size 7464 +oid sha256:3933048c0cb8c3ace17b271c7c5d62505fce60a318d7361ffe8c255d308b9b2f +size 6898 diff --git a/EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/D/7L/KUWJ50Q9H612B3SWHC7ZMP.uasset b/EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/D/7L/KUWJ50Q9H612B3SWHC7ZMP.uasset new file mode 100644 index 00000000..87617c82 --- /dev/null +++ b/EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/D/7L/KUWJ50Q9H612B3SWHC7ZMP.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd6fefcce9364bd2d7ca9ded8592c80b85c72f1c339468cac25cc326bfc6fb8d +size 4815 diff --git a/EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/E/3W/EFD3Z49R81R9HF96BWZZKX.uasset b/EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/E/3W/EFD3Z49R81R9HF96BWZZKX.uasset new file mode 100644 index 00000000..18f7fd87 --- /dev/null +++ b/EndlessVendetta/Content/__ExternalActors__/Levels/MovementTest/E/3W/EFD3Z49R81R9HF96BWZZKX.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0b5189199721aba9a017706711c496ec2922a3f061466ed15ee2df5771bb3d4 +size 4803 diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp index 56c8870d..2c499c93 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.cpp @@ -3,6 +3,7 @@ #include "AC_PlayerDialogueInterpreter.h" +#include "DialogueAddItemNode.h" #include "EndlessVendetta/EndlessVendettaCharacter.h" @@ -68,25 +69,68 @@ void UAC_PlayerDialogueInterpreter::StartDialogue(UDialogueTree* DialogueTree) void UAC_PlayerDialogueInterpreter::NextDialogue() { - if (!IsValid(CurrentTextNode)) return; if (IsValid(CurrentChoiceNode)) return; - if (CurrentTextNode->ChildrenNodes.Num() == 0) + if (IsValid(CurrentTextNode)) { - EndDialogue(); - return; + if (CurrentTextNode->ChildrenNodes.Num() == 0) + { + EndDialogue(); + return; + } + if (Cast(CurrentTextNode->ChildrenNodes[0])) + { + CurrentChoiceNode = Cast(CurrentTextNode->ChildrenNodes[0]); + OnChoiceDialogue.Broadcast(CurrentChoiceNode); + CurrentTextNode = nullptr; + CurrentAddItemNode = nullptr; + } + else if (Cast(CurrentTextNode->ChildrenNodes[0])) + { + CurrentTextNode = Cast(CurrentTextNode->ChildrenNodes[0]); + CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking); + OnNextDialogue.Broadcast(CurrentTextNode); + CurrentChoiceNode = nullptr; + CurrentAddItemNode = nullptr; + } + else if (Cast(CurrentTextNode->ChildrenNodes[0])) + { + CurrentAddItemNode = Cast(CurrentTextNode->ChildrenNodes[0]); + CurrentAddItemNode->AddItemsToInventory(GetWorld()); + CurrentTextNode = nullptr; + CurrentChoiceNode = nullptr; + NextDialogue(); + } } - if (Cast(CurrentTextNode->ChildrenNodes[0])) + else if (IsValid(CurrentAddItemNode)) { - CurrentChoiceNode = Cast(CurrentTextNode->ChildrenNodes[0]); - OnChoiceDialogue.Broadcast(CurrentChoiceNode); - CurrentTextNode = nullptr; - } - else - { - CurrentTextNode = Cast(CurrentTextNode->ChildrenNodes[0]); - CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking); - OnNextDialogue.Broadcast(CurrentTextNode); - CurrentChoiceNode = nullptr; + if (CurrentAddItemNode->ChildrenNodes.Num() == 0) + { + EndDialogue(); + return; + } + if (Cast(CurrentAddItemNode->ChildrenNodes[0])) + { + CurrentChoiceNode = Cast(CurrentAddItemNode->ChildrenNodes[0]); + OnChoiceDialogue.Broadcast(CurrentChoiceNode); + CurrentTextNode = nullptr; + CurrentAddItemNode = nullptr; + } + else if (Cast(CurrentAddItemNode->ChildrenNodes[0])) + { + CurrentTextNode = Cast(CurrentAddItemNode->ChildrenNodes[0]); + CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking); + OnNextDialogue.Broadcast(CurrentTextNode); + CurrentChoiceNode = nullptr; + CurrentAddItemNode = nullptr; + } + else if (Cast(CurrentAddItemNode->ChildrenNodes[0])) + { + CurrentAddItemNode = Cast(CurrentAddItemNode->ChildrenNodes[0]); + CurrentAddItemNode->AddItemsToInventory(GetWorld()); + CurrentTextNode = nullptr; + CurrentChoiceNode = nullptr; + NextDialogue(); + } } } @@ -99,20 +143,27 @@ void UAC_PlayerDialogueInterpreter::MakeChoiceDialogue(const int Choice) OnChoiceDialogue.Broadcast(CurrentChoiceNode); CurrentTextNode = nullptr; } - else + else if (Cast(CurrentChoiceNode->ChildrenNodes[Choice])) { CurrentTextNode = Cast(CurrentChoiceNode->ChildrenNodes[Choice]); CurrentCharacterSpeaking = *GetCharacterSpeakingFromEnum(CurrentTextNode->DialogueCharacterSpeaking); OnNextDialogue.Broadcast(CurrentTextNode); CurrentChoiceNode = nullptr; } + else if (Cast(CurrentChoiceNode->ChildrenNodes[Choice])) + { + CurrentAddItemNode = Cast(CurrentChoiceNode->ChildrenNodes[Choice]); + CurrentAddItemNode->AddItemsToInventory(GetWorld()); + CurrentChoiceNode = nullptr; + } } void UAC_PlayerDialogueInterpreter::EndDialogue() { - OnEndDialogue.Broadcast(CurrentTextNode->Text); + OnEndDialogue.Broadcast(FText::FromString("Dialogue Ended")); CurrentChoiceNode = nullptr; CurrentTextNode = nullptr; + CurrentAddItemNode = nullptr; CurrentCharacterSpeaking = FDialogueCharacter(); if (APlayerController* PlayerController = GetWorld()->GetFirstPlayerController()) diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.h b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.h index 931bd049..76843f7f 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.h +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/AC_PlayerDialogueInterpreter.h @@ -3,6 +3,7 @@ #pragma once #include "CoreMinimal.h" +#include "DialogueAddItemNode.h" #include "DialogueChoiceNode.h" #include "DialogueTextNode.h" #include "Components/ActorComponent.h" @@ -49,6 +50,8 @@ private: UDialogueTextNode* CurrentTextNode; UPROPERTY() UDialogueChoiceNode* CurrentChoiceNode; + UPROPERTY() + UDialogueAddItemNode* CurrentAddItemNode; FDialogueCharacter* GetCharacterSpeakingFromEnum(ECharacterSpeaking CharacterSpeakingEnum) const; public: @@ -63,4 +66,7 @@ public: void MakeChoiceDialogue(int Choice); UFUNCTION(BlueprintCallable, Category = "Dialogue") void EndDialogue(); + + UFUNCTION(BlueprintCallable, Category = "Dialogue") + UWorld* GetWorldContext() const { return GetWorld(); } }; diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.cpp b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.cpp index 8adadbb7..e8997ad4 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.cpp @@ -1,5 +1,6 @@ #include "DialogueAddItemNode.h" #include "DialogueTree.h" +#include "EndlessVendetta/Inventory/InventoryComponent.h" #define LOCTEXT_NAMESPACE "UDialogueTextNode" @@ -12,16 +13,25 @@ UDialogueAddItemNode::UDialogueAddItemNode() #endif } +void UDialogueAddItemNode::AddItemsToInventory(UWorld* World) +{ + UInventoryComponent* InventoryComponent = Cast(World->GetFirstPlayerController()->GetPawn()->GetComponentByClass(UInventoryComponent::StaticClass())); + if (InventoryComponent == nullptr) return; + for (TSubclassOf ItemToAdd : ItemsToAdd) + { + InventoryComponent->AddItem(NewObject(World, ItemToAdd)); + } +} + #if WITH_EDITOR FText UDialogueAddItemNode::GetNodeTitle() const { - return Bruh; + return FText::FromString("Add Item Node"); } void UDialogueAddItemNode::SetNodeTitle(const FText& NewTitle) { - Bruh = NewTitle; } FLinearColor UDialogueAddItemNode::GetBackgroundColor() const @@ -31,7 +41,7 @@ FLinearColor UDialogueAddItemNode::GetBackgroundColor() const if (DialogueTree == nullptr) return Super::GetBackgroundColor(); - return FLinearColor::Black; + return FLinearColor::Transparent; } #endif diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.h b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.h index b52856e6..6bd080d5 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.h +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueAddItemNode.h @@ -2,17 +2,22 @@ #include "CoreMinimal.h" #include "GenericGraphNode.h" +#include "EndlessVendetta/Inventory/BaseItem.h" #include "DialogueAddItemNode.generated.h" UCLASS(Blueprintable) class UDialogueAddItemNode : public UGenericGraphNode { GENERATED_BODY() + public: UDialogueAddItemNode(); UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue") - FText Bruh; + TArray> ItemsToAdd; + + UFUNCTION(BlueprintCallable, Category = "Dialogue") + void AddItemsToInventory(UWorld* World); #if WITH_EDITOR virtual FText GetNodeTitle() const override; @@ -21,4 +26,4 @@ public: virtual FLinearColor GetBackgroundColor() const override; #endif -}; \ No newline at end of file +}; diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.cpp b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.cpp index 1263f463..a833f47a 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.cpp @@ -7,6 +7,7 @@ #include "EndlessVendetta/Characters/BountyHunterCharacter.h" #include "EndlessVendetta/Inventory/InventoryComponent.h" + #define LOCTEXT_NAMESPACE "UDialogueChoiceNode" UDialogueChoiceNode::UDialogueChoiceNode() @@ -18,16 +19,14 @@ UDialogueChoiceNode::UDialogueChoiceNode() #endif } -#if WITH_EDITOR - -bool UDialogueChoiceNode::ChoiceRequirementsMet(const int ChoiceID) const +bool UDialogueChoiceNode::ChoiceRequirementsMet(const int ChoiceID, UWorld* World) const { if (ChoiceID < 0 || ChoiceID >= Choices.Num()) return false; if (ChildrenNodes.Num() == 0) return false; if (!Cast(ChildrenNodes[ChoiceID])) return false; - const UEVGameInstance* GameInstance = Cast(GetWorld()->GetGameInstance()); - const UInventoryComponent* InventoryComponent = Cast(GetWorld()->GetFirstPlayerController()->GetPawn()->GetComponentByClass(UInventoryComponent::StaticClass())); - const ABountyHunterCharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn()); + const UEVGameInstance* GameInstance = Cast(World->GetGameInstance()); + const UInventoryComponent* InventoryComponent = Cast(World->GetFirstPlayerController()->GetPawn()->GetComponentByClass(UInventoryComponent::StaticClass())); + const ABountyHunterCharacter* PlayerCharacter = Cast(World->GetFirstPlayerController()->GetPawn()); UDialogueTextNode* TextNode = Cast(ChildrenNodes[ChoiceID]); for (const EDialogueFlag Flag : TextNode->RequiredFlags) { @@ -42,6 +41,18 @@ bool UDialogueChoiceNode::ChoiceRequirementsMet(const int ChoiceID) const if (!InventoryComponent->HasItemByItemID(ItemID)) return false; } if (TextNode->RequiredFavours > PlayerCharacter->Favours) return false; + for (const EDialogueFlag Flag : TextNode->LacksFlags) + { + if (GameInstance->HasDialogueFlag(Flag)) return false; + } + for (const EItem Item : TextNode->LacksItemsByEnumID) + { + if (!InventoryComponent->LacksItemByEnumID(Item)) return false; + } + for (const int ItemID : TextNode->LacksItemsByID) + { + if (!InventoryComponent->LacksItemByItemID(ItemID)) return false; + } return true; } @@ -54,6 +65,9 @@ FString UDialogueChoiceNode::GetChoicePreText(const int ChoiceID) const return TextNode->RequirementPreText.ToString(); } + +#if WITH_EDITOR + FText UDialogueChoiceNode::GetNodeTitle() const { bool bHasValidNumberOfChoices = false; diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.h b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.h index 87f2f2aa..ec6a27f4 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.h +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueChoiceNode.h @@ -15,8 +15,8 @@ public: UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Dialogue") TArray Choices; - UFUNCTION(BlueprintCallable, Category = "Dialogue") - bool ChoiceRequirementsMet(int ChoiceID) const; + UFUNCTION(BlueprintCallable, Category = "Dialogue", meta = (WorldContext="WorldContextObject")) + bool ChoiceRequirementsMet(int ChoiceID, UWorld* World) const; UFUNCTION(BlueprintCallable, Category = "Dialogue") FString GetChoicePreText(int ChoiceID) const; diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueFlagEnum.h b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueFlagEnum.h index 084e79d2..9fb97eb5 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueFlagEnum.h +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueFlagEnum.h @@ -13,6 +13,4 @@ UENUM(BlueprintType) enum class EDialogueFlag : uint8 { None UMETA(DisplayName = "None"), - TestFlag1 UMETA(DisplayName = "Test Flag DO NOT USE"), - TestFlag2 UMETA(DisplayName = "Test Flag DO NOT USE"), }; diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTextNode.h b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTextNode.h index dfd352c8..99d4bbef 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTextNode.h +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTextNode.h @@ -38,6 +38,13 @@ public: TArray RequiredItemsByID; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement") int RequiredFavours = 0; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement") + TArray LacksFlags; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement") + TArray LacksItemsByEnumID; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement") + TArray LacksItemsByID; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Choice Requirement") FText RequirementPreText = FText::FromString("None"); diff --git a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTree.cpp b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTree.cpp index a74404f2..fc669ebf 100644 --- a/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTree.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/DialogueSystem/DialogueTree.cpp @@ -9,7 +9,7 @@ UDialogueTree::UDialogueTree() NodeType = UGenericGraphNode::StaticClass(); EdgeType = UDialogueEdge::StaticClass(); - // bCanBeCyclical = true; + bCanBeCyclical = true; Character1.CharacterName = "Character 1"; Character2.CharacterName = "Character 2"; diff --git a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp index befab466..ed9746a2 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.cpp @@ -201,6 +201,16 @@ bool UInventoryComponent::HasItemByItemID(int ItemID) const return GameInstance->InventoryItems.ContainsByPredicate([ItemID](const UBaseItem* Item) { return IsValid(Item) && Item->ItemID == ItemID; }); } +bool UInventoryComponent::LacksItemByEnumID(EItem ItemEnumID) const +{ + return !HasItemByEnumID(ItemEnumID); +} + +bool UInventoryComponent::LacksItemByItemID(int ItemID) const +{ + return !HasItemByItemID(ItemID); +} + void UInventoryComponent::SetPrimaryWeapon(AActor* const _PrimaryWeapon) { PrimaryWeapon = _PrimaryWeapon; diff --git a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h index 8e4e782e..da1ec9ed 100644 --- a/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h +++ b/EndlessVendetta/Source/EndlessVendetta/Inventory/InventoryComponent.h @@ -72,6 +72,10 @@ public: bool HasItemByEnumID(EItem ItemEnumID) const; UFUNCTION(BlueprintCallable, Category = "Inventory") bool HasItemByItemID(int ItemID) const; + UFUNCTION(BlueprintCallable, Category = "Inventory") + bool LacksItemByEnumID(EItem ItemEnumID) const; + UFUNCTION(BlueprintCallable, Category = "Inventory") + bool LacksItemByItemID(int ItemID) const; void SetPrimaryWeapon(AActor* const _PrimaryWeapon); AActor* GetPrimaryWeapon() const;