refactor: Simplify tag display name retrieval and enhance null checks in utility functions

This commit is contained in:
Lefteris Notas
2026-05-21 13:36:53 +03:00
parent d100a097f5
commit 108173b87b
4 changed files with 21 additions and 4 deletions

View File

@@ -40,15 +40,14 @@ FText UDA_GameTagRegistry::GetTagDisplayName(const FGameplayTag& Tag) const
}
UGameplayTagsManager& TagManager = UGameplayTagsManager::Get();
FString DevComment;
FString DisplayName = TagManager.GetTagDevCommentAndDisplayName(Tag, DevComment);
FText DisplayName = TagManager.GetTagDisplayNameText(Tag);
if (DisplayName.IsEmpty())
{
return FText::FromName(Tag.GetTagName());
}
return FText::FromString(DisplayName);
return DisplayName;
}
bool UDA_GameTagRegistry::ValidateTag(const FGameplayTag& Tag) const

View File

@@ -16,7 +16,18 @@
UGI_GameFramework* UFL_GameUtilities::GetGameFramework(const UObject* WorldContextObject)
{
return GetSubsystemSafe<UGI_GameFramework>(WorldContextObject);
if (!WorldContextObject)
{
return nullptr;
}
UWorld* World = WorldContextObject->GetWorld();
if (!World)
{
return nullptr;
}
return Cast<UGI_GameFramework>(World->GetGameInstance());
}
UGameInstanceSubsystem* UFL_GameUtilities::GetSubsystemByClass(const UObject* WorldContextObject,

View File

@@ -2,6 +2,10 @@
// UE5 Modular Game Framework — BPC_StateManager Implementation
#include "Player/BPC_StateManager.h"
#include "Player/BPC_HealthSystem.h"
#include "Player/BPC_StressSystem.h"
#include "Player/BPC_StaminaSystem.h"
#include "Player/BPC_MovementStateSystem.h"
#include "GameplayTagsManager.h"
DEFINE_LOG_CATEGORY_STATIC(LogStateManager, Log, All);

View File

@@ -2,6 +2,9 @@
// UE5 Modular Game Framework — BPC_DamageReceptionSystem Implementation
#include "Weapons/BPC_DamageReceptionSystem.h"
#include "Player/BPC_HealthSystem.h"
#include "Weapons/BPC_ShieldDefenseSystem.h"
#include "Weapons/BPC_HitReactionSystem.h"
DEFINE_LOG_CATEGORY_STATIC(LogFrameworkDamage, Log, All);