From 7505a705758f578c2b5f92197a0868d7033f51e6 Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Tue, 3 Oct 2023 01:47:24 -0400 Subject: [PATCH] Added the ability to disable combo action nodes. Enabling them will come later. --- .../Components/ComboManagerComponent.cpp | 8 +++++-- .../Private/Nodes/ComboActionGraphNode.cpp | 1 + .../Public/Nodes/ComboActionGraphNode.h | 22 +++++++++++++------ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Source/ComboInput/Private/Components/ComboManagerComponent.cpp b/Source/ComboInput/Private/Components/ComboManagerComponent.cpp index 6dcd2b6..f588f10 100644 --- a/Source/ComboInput/Private/Components/ComboManagerComponent.cpp +++ b/Source/ComboInput/Private/Components/ComboManagerComponent.cpp @@ -150,8 +150,12 @@ const UComboActionGraphNode *UComboManagerComponent::FindActiveNodeData(const UC { if (ActionNode->GetComboInput() == Input && ActionNode->GetTriggerEvent() == EComboActionTriggerEvent::Activated) { - ComboAction = ActionNode->GetComboAction(); - NextNode = ActionNode; + // If we found the right node, only acknowledge it if it's enabled. Otherwise just skip it. + if (ActionNode->bEnabled) + { + ComboAction = ActionNode->GetComboAction(); + NextNode = ActionNode; + } break; } } diff --git a/Source/ComboInput/Private/Nodes/ComboActionGraphNode.cpp b/Source/ComboInput/Private/Nodes/ComboActionGraphNode.cpp index fe051c3..0557b8f 100644 --- a/Source/ComboInput/Private/Nodes/ComboActionGraphNode.cpp +++ b/Source/ComboInput/Private/Nodes/ComboActionGraphNode.cpp @@ -19,6 +19,7 @@ UComboActionGraphNode::UComboActionGraphNode() this->CompatibleGraphType = UComboActionGraph::StaticClass(); this->BackgroundColor = FLinearColor::Black; + this->bEnabled = true; this->bAllowInputNodes = true; this->bAllowOutputNodes = true; diff --git a/Source/ComboInput/Public/Nodes/ComboActionGraphNode.h b/Source/ComboInput/Public/Nodes/ComboActionGraphNode.h index 9475862..d61b238 100644 --- a/Source/ComboInput/Public/Nodes/ComboActionGraphNode.h +++ b/Source/ComboInput/Public/Nodes/ComboActionGraphNode.h @@ -81,21 +81,29 @@ protected: #pragma region Editable public: /** - * The array of allowed input classes for this Dialogue Node. - *❗ Only nodes with classes from this array can be connected as inputs to this node. - *❔ Can be used to restrict the types of inputs this node can accept. + * Whether the node is enabled by default. Disabled nodes will be ignored by the + * combo manager until they are enabled again programmatically. This allows actions + * to be unlockable during gameplay. */ - UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category="Combo Input|Action") - TArray> AllowedInputClasses; + UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category="Combo Input|Action") + uint8 bEnabled : 1; /** * The maximum number of children nodes that this node can have. - *❗ If this value is -1, then there is no limit on the number of children nodes. - *❔ Can be used to enforce a maximum number of connections for certain types of nodes. + * If this value is -1, then there is no limit on the number of children nodes. + * Can be used to enforce a maximum number of connections for certain types of nodes. */ UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category="Combo Input|Action") int32 MaxChildrenNodes = -1; + /** + * The array of allowed input classes for this Dialogue Node. + * Only nodes with classes from this array can be connected as inputs to this node. + * Can be used to restrict the types of inputs this node can accept. + */ + UPROPERTY(BlueprintReadOnly, Category="Combo Input|Action") + TArray> AllowedInputClasses; + #pragma endregion #pragma endregion