feat: Add Enhanced Input Manager for context management and key rebinding

- Implemented USS_EnhancedInputManager to manage input contexts with priority.
- Added methods for pushing, popping, and querying input contexts.
- Integrated input mode switching and key rebinding functionality.

feat: Introduce Inventory System Component for item management

- Created UBPC_InventorySystem to handle inventory operations such as adding, removing, and sorting items.
- Implemented weight management and slot organization features.
- Added event dispatchers for inventory changes.

feat: Develop Item Data Asset for item definitions

- Established UDA_ItemData as a base class for all items, encapsulating properties like type, weight, and stack limits.
- Included conditional sub-data structures for equipment, consumables, and inspect data.

feat: Create State Manager Component for player state management

- Developed UBPC_StateManager to manage player action states and overlays.
- Implemented gating logic for action requests and vital sign tracking.

feat: Implement Save Manager for game state persistence

- Introduced USS_SaveManager for handling save/load operations and slot management.
- Utilized FArchive for efficient binary serialization.

feat: Implement Damage Reception System for combat mechanics

- Created UBPC_DamageReceptionSystem to process incoming damage and apply resistance calculations.
- Added event dispatchers for damage reception and hit reactions.
This commit is contained in:
Lefteris Notas
2026-05-20 15:04:17 +03:00
parent fee12b115f
commit f6c4f44827
24 changed files with 5160 additions and 0 deletions

View File

@@ -0,0 +1,121 @@
// Copyright Epic Games, Inc. All Rights Reserved.
// UE5 Modular Game Framework — DA_ItemData Implementation
#include "Inventory/DA_ItemData.h"
#include "GameplayTagsManager.h"
DEFINE_LOG_CATEGORY_STATIC(LogItemData, Log, All);
UDA_ItemData::UDA_ItemData()
{
ItemType = EItemType::Misc;
StackLimit = 1;
Weight = 0.0f;
bCanBeDropped = true;
bIsKeyItem = false;
bHasInspectMode = false;
}
// ============================================================================
// Overrides
// ============================================================================
void UDA_ItemData::PostLoad()
{
Super::PostLoad();
// Key items cannot be dropped — enforce.
if (bIsKeyItem && bCanBeDropped)
{
UE_LOG(LogItemData, Warning, TEXT("DA_ItemData::PostLoad — '%s': bIsKeyItem && bCanBeDropped — forcing bCanBeDropped = false"),
*ItemTag.GetTagName().ToString());
bCanBeDropped = false;
}
// Validate tag registration.
if (ItemTag.IsValid())
{
UGameplayTagsManager& TagManager = UGameplayTagsManager::Get();
FGameplayTag CheckTag;
if (!TagManager.RequestGameplayTag(ItemTag.GetTagName(), CheckTag))
{
UE_LOG(LogItemData, Warning, TEXT("DA_ItemData::PostLoad — '%s': ItemTag '%s' is not registered in the tag table!"),
*GetName(), *ItemTag.GetTagName().ToString());
}
}
}
#if WITH_EDITOR
void UDA_ItemData::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
Super::PostEditChangeProperty(PropertyChangedEvent);
FName PropertyName = PropertyChangedEvent.GetPropertyName();
// Auto-enforce key item rule.
if (PropertyName == GET_MEMBER_NAME_CHECKED(UDA_ItemData, bIsKeyItem) && bIsKeyItem)
{
bCanBeDropped = false;
}
}
bool UDA_ItemData::ValidateItemData(FString& OutErrors) const
{
TArray<FString> Errors;
// Check required fields.
if (!ItemTag.IsValid())
{
Errors.Add(TEXT("ItemTag is invalid/empty."));
}
if (DisplayName.IsEmpty())
{
Errors.Add(TEXT("DisplayName is empty."));
}
if (Description.IsEmpty())
{
Errors.Add(TEXT("Description is empty."));
}
// Check key item cannot be dropped.
if (bIsKeyItem && bCanBeDropped)
{
Errors.Add(TEXT("bIsKeyItem is true but bCanBeDropped is also true. Key items cannot be dropped."));
}
// Check consumable has valid data.
if (ItemType == EItemType::Consumable &&
ConsumableData.HealthRestore <= 0.0f && ConsumableData.StressReduce <= 0.0f)
{
Errors.Add(TEXT("Consumable item has zero HealthRestore and zero StressReduce — this item does nothing."));
}
// Check weapon has damage.
if (ItemType == EItemType::Weapon && EquipmentData.Damage <= 0.0f)
{
Errors.Add(TEXT("Weapon item has zero Damage."));
}
// Check stack limits.
if (StackLimit < 1)
{
Errors.Add(TEXT("StackLimit must be >= 1."));
}
// Build output string.
for (const FString& Err : Errors)
{
OutErrors += TEXT("- ") + Err + TEXT("\n");
}
if (Errors.Num() > 0)
{
UE_LOG(LogItemData, Warning, TEXT("DA_ItemData::ValidateItemData — '%s' has %d errors:\n%s"),
*ItemTag.GetTagName().ToString(), Errors.Num(), *OutErrors);
}
return Errors.Num() == 0;
}
#endif