Cleared all TODOs related to custom logs

This commit is contained in:
LongLy 2025-01-16 14:24:05 -07:00
parent 6c053954c8
commit e0545d6323
18 changed files with 113 additions and 58 deletions

View File

@ -3,6 +3,7 @@
#include "Components/OLSHealthComponent.h"
#include "OLSLog.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "AbilitySystem/Attributes/OLSHealthAttributeSet.h"
#include "DataAssets/OLSGameDataAsset.h"
@ -13,6 +14,8 @@
#include "Net/UnrealNetwork.h"
#include "Systems/OLSAssetManager.h"
DEFINE_LOG_CATEGORY(LogOLSHealthComponent);
UOLSHealthComponent::UOLSHealthComponent(const FObjectInitializer& objectInitializer)
: Super(objectInitializer)
{
@ -46,24 +49,29 @@ void UOLSHealthComponent::InitializeWithAbilitySystem(UOLSAbilitySystemComponent
if (AbilitySystemComponent)
{
// @TODO replace this by our custom log.
// UE_LOG(LogLyra, Error, TEXT("LyraHealthComponent: Health component for owner [%s] has already been initialized with an ability system."), *GetNameSafe(Owner));
OLS_LOG(LogOLSHealthComponent, Error,
TEXT(
"LyraHealthComponent: Health component for owner [%s] has already been initialized with an ability system."
), GET_UOBJECT_NAME(owner));
return;
}
AbilitySystemComponent = asc;
if (!AbilitySystemComponent)
{
// @TODO replace this by our custom log.
// UE_LOG(LogLyra, Error, TEXT("LyraHealthComponent: Cannot initialize health component for owner [%s] with NULL ability system."), *GetNameSafe(Owner));
OLS_LOG(LogOLSHealthComponent, Error,
TEXT("Cannot initialize health component for owner [%s] with NULL ability system."),
GET_UOBJECT_NAME(owner));
return;
}
HealthSet = AbilitySystemComponent->GetSet<UOLSHealthAttributeSet>();
if (!HealthSet)
{
// @TODO replace this by our custom log.
// UE_LOG(LogLyra, Error, TEXT("LyraHealthComponent: Cannot initialize health component for owner [%s] with NULL health set on the ability system."), *GetNameSafe(Owner));
OLS_LOG(LogOLSHealthComponent, Error,
TEXT(
"LyraHealthComponent: Cannot initialize health component for owner [%s] with NULL health set on the ability system."
), GET_UOBJECT_NAME(owner));
return;
}
@ -72,7 +80,7 @@ void UOLSHealthComponent::InitializeWithAbilitySystem(UOLSAbilitySystemComponent
HealthSet->OnMaxHealthChanged.AddUObject(this, &ThisClass::HandleMaxHealthChanged);
HealthSet->OnOutOfHealth.AddUObject(this, &ThisClass::HandleOutOfHealth);
// TEMP: Reset attributes to default values. Eventually this will be driven by a spread sheet.
// TEMP: Reset attributes to default values. Eventually this will be driven by a spreadsheet.
AbilitySystemComponent->SetNumericAttributeBase(UOLSHealthAttributeSet::GetHealthAttribute(), HealthSet->GetMaxHealth());
ClearGameplayTags();
@ -182,8 +190,10 @@ void UOLSHealthComponent::DamageSelfDestruct(bool isFellOutOfWorld)
const TSubclassOf<UGameplayEffect> damageGE = UOLSAssetManager::GetSubclass(UOLSGameDataAsset::Get().DamageGameplayEffect_SetByCaller);
if (!damageGE)
{
// @TODO: replace this with our custom log.
// UE_LOG(LogLyra, Error, TEXT("LyraHealthComponent: DamageSelfDestruct failed for owner [%s]. Unable to find gameplay effect [%s]."), *GetNameSafe(GetOwner()), *ULyraGameData::Get().DamageGameplayEffect_SetByCaller.GetAssetName());
OLS_LOG(LogOLSHealthComponent, Error,
TEXT("DamageSelfDestruct failed for owner [%s]. Unable to find gameplay effect [%s]."),
GET_UOBJECT_NAME(GetOwner()),
*UOLSGameDataAsset::Get().DamageGameplayEffect_SetByCaller.GetAssetName());
return;
}
@ -192,8 +202,9 @@ void UOLSHealthComponent::DamageSelfDestruct(bool isFellOutOfWorld)
if (!spec)
{
// @TODO: replace this with our custom log.
// UE_LOG(LogLyra, Error, TEXT("LyraHealthComponent: DamageSelfDestruct failed for owner [%s]. Unable to make outgoing spec for [%s]."), *GetNameSafe(GetOwner()), *GetNameSafe(DamageGE));
OLS_LOG(LogOLSHealthComponent, Error,
TEXT("DamageSelfDestruct failed for owner [%s]. Unable to make outgoing spec for [%s]."),
GET_UOBJECT_NAME(GetOwner()), GET_UOBJECT_NAME(damageGE));
return;
}
@ -356,11 +367,10 @@ void UOLSHealthComponent::OnRep_DeathState(EOLSDeathState oldDeathState)
if (oldDeathState > newDeathState)
{
// The server is trying to set us back but we've already predicted past the server state.
// @TODO replace this with our custom log.
// UE_LOG(LogLyra, Warning,
// TEXT("LyraHealthComponent: Predicted past server death state [%d] -> [%d] for owner [%s]."),
// (uint8)OldDeathState, (uint8)newDeathStateameSafe(GetOwner()));
OLS_LOG(LogOLSHealthComponent, Warning,
TEXT("Predicted past server death state [%d] -> [%d] for owner [%s]."),
(uint8)oldDeathState, (uint8)newDeathState, GET_UOBJECT_NAME(GetOwner()));
return;
}
@ -377,9 +387,8 @@ void UOLSHealthComponent::OnRep_DeathState(EOLSDeathState oldDeathState)
}
else
{
// @TODO replace this with our custom log.
// UE_LOG(LogLyra, Error, TEXT("LyraHealthComponent: Invalid death transition [%d] -> [%d] for owner [%s]."),
// (uint8)OldDeathState, (uint8)newDeathStateameSafe(GetOwner()));
OLS_LOG(LogOLSHealthComponent, Error, TEXT("Invalid death transition [%d] -> [%d] for owner [%s]."),
(uint8)oldDeathState, (uint8)newDeathState, GET_UOBJECT_NAME(GetOwner()));
}
}
else if (oldDeathState == EOLSDeathState::DeathStarted)
@ -390,9 +399,8 @@ void UOLSHealthComponent::OnRep_DeathState(EOLSDeathState oldDeathState)
}
else
{
// @TODO replace this with our custom log.
// UE_LOG(LogLyra, Error, TEXT("LyraHealthComponent: Invalid death transition [%d] -> [%d] for owner [%s]."),
// (uint8)OldDeathState, (uint8)newDeathStateameSafe(GetOwner()));
OLS_LOG(LogOLSHealthComponent, Error, TEXT("Invalid death transition [%d] -> [%d] for owner [%s]."),
(uint8)oldDeathState, (uint8)newDeathState, GET_UOBJECT_NAME(GetOwner()));
}
}

View File

@ -3,6 +3,10 @@
#include "DataAssets/OLSInputConfigDataAsset.h"
#include "OLSLog.h"
DEFINE_LOG_CATEGORY(LogOLSInputConfigDataAsset);
UOLSInputConfigDataAsset::UOLSInputConfigDataAsset(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
{
}
@ -21,8 +25,9 @@ const UInputAction* UOLSInputConfigDataAsset::FindNativeInputActionForTag(
if (shouldLogNotFound)
{
//Todo: replace this with our custom log.
//UE_LOG(LogLyra, Error, TEXT("Can't find NativeInputAction for InputTag [%s] on InputConfig [%s]."), *InputTag.ToString(), *GetNameSafe(this));
OLS_LOG(LogOLSInputConfigDataAsset, Error,
TEXT("Can't find NativeInputAction for InputTag [%s] on InputConfig [%s]."), GET_TAG_NAME(inputTag),
GET_UOBJECT_NAME(this));
}
return nullptr;
@ -42,8 +47,9 @@ const UInputAction* UOLSInputConfigDataAsset::FindAbilityInputActionForTag(
if (shouldLogNotFound)
{
//Todo: replace this with our custom log.
//UE_LOG(LogLyra, Error, TEXT("Can't find AbilityInputAction for InputTag [%s] on InputConfig [%s]."), *InputTag.ToString(), *GetNameSafe(this));
OLS_LOG(LogOLSInputConfigDataAsset, Error,
TEXT("Can't find AbilityInputAction for InputTag [%s] on InputConfig [%s]."), GET_TAG_NAME(inputTag),
GET_UOBJECT_NAME(this));
}
return nullptr;

View File

@ -3,9 +3,12 @@
#include "ModularGameplayActors/OLSModularActor.h"
#include "OLSLog.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "Components/GameFrameworkComponentManager.h"
DEFINE_LOG_CATEGORY(LogOLSModularActor);
AOLSModularActor::AOLSModularActor(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
@ -48,8 +51,8 @@ void AOLSModularActor::PostInitProperties()
if (AbilitySystemComponent)
{
//@Todo replace this log by our custom log.
UE_LOG(LogTemp, Verbose, TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), *GetName(), ReplicationMode);
OLS_LOG(LogOLSModularActor, Verbose, TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"),
GET_UOBJECT_NAME(this), ReplicationMode);
AbilitySystemComponent->SetReplicationMode(ReplicationMode);
}
}

View File

@ -3,10 +3,13 @@
#include "ModularGameplayActors/OLSModularCharacter.h"
#include "OLSLog.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "Components/GameFrameworkComponentManager.h"
AOLSModularCharacter::AOLSModularCharacter(const FObjectInitializer& objectInitializer)
DEFINE_LOG_CATEGORY(LogOLSModularCharacter);
AOLSModularCharacter::AOLSModularCharacter(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
@ -46,8 +49,9 @@ void AOLSModularCharacter::PostInitProperties()
if (AbilitySystemComponent)
{
//@Todo replace this log by our custom log.
UE_LOG(LogTemp, Verbose, TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), *GetName(), ReplicationMode);
OLS_LOG(LogOLSModularCharacter, Verbose,
TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), GET_UOBJECT_NAME(this),
ReplicationMode);
AbilitySystemComponent->SetReplicationMode(ReplicationMode);
}
}

View File

@ -3,9 +3,11 @@
#include "ModularGameplayActors/OLSModularDefaultPawn.h"
#include "OLSLog.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "Components/GameFrameworkComponentManager.h"
DEFINE_LOG_CATEGORY(LogOLSModularDefaultPawn);
// Sets default values
AOLSModularDefaultPawn::AOLSModularDefaultPawn(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
@ -47,8 +49,8 @@ void AOLSModularDefaultPawn::PostInitProperties()
Super::PostInitProperties();
if (AbilitySystemComponent)
{
//@Todo replace this log by our custom log.
UE_LOG(LogTemp, Verbose, TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), *GetName(),
OLS_LOG(LogOLSModularDefaultPawn, Verbose,
TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), GET_UOBJECT_NAME(this),
ReplicationMode);
AbilitySystemComponent->SetReplicationMode(ReplicationMode);
}

View File

@ -3,9 +3,12 @@
#include "ModularGameplayActors/OLSModularPawn.h"
#include "OLSLog.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "Components/GameFrameworkComponentManager.h"
DEFINE_LOG_CATEGORY(LogOLSModularPawn);
AOLSModularPawn::AOLSModularPawn(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
{
AbilitySystemComponent = CreateDefaultSubobject<UOLSAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
@ -38,8 +41,9 @@ void AOLSModularPawn::PostInitProperties()
if (AbilitySystemComponent)
{
//@Todo replace this log by our custom log.
UE_LOG(LogTemp, Verbose, TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), *GetName(), ReplicationMode);
OLS_LOG(LogOLSModularPawn, Verbose,
TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), GET_UOBJECT_NAME(this),
ReplicationMode);
AbilitySystemComponent->SetReplicationMode(ReplicationMode);
}
}

View File

@ -3,10 +3,13 @@
#include "ModularGameplayActors/OLSModularPlayerState.h"
#include "OLSLog.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "Components/GameFrameworkComponentManager.h"
#include "Components/PlayerStateComponent.h"
DEFINE_LOG_CATEGORY(LogOLSModularPlayerState);
AOLSModularPlayerState::AOLSModularPlayerState(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
{
// Create ability system component, and set it to be explicitly replicated
@ -41,8 +44,9 @@ void AOLSModularPlayerState::PostInitProperties()
if (AbilitySystemComponent)
{
//@Todo replace this log by our custom log.
UE_LOG(LogTemp, Verbose, TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), *GetName(), ReplicationMode);
OLS_LOG(LogOLSModularPlayerState, Verbose,
TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), GET_UOBJECT_NAME(this),
ReplicationMode);
AbilitySystemComponent->SetReplicationMode(ReplicationMode);
}
}

View File

@ -5,9 +5,12 @@
#include "AbilitySystemComponent.h"
#include "AbilitySystemGlobals.h"
#include "OLSLog.h"
#include "Components/GameFrameworkComponentManager.h"
#include "GameFramework/PlayerState.h"
DEFINE_LOG_CATEGORY(LogOLSModularPlayerStateCharacter);
AOLSModularPlayerStateCharacter::AOLSModularPlayerStateCharacter(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
{
SetMinNetUpdateFrequency(33.f);
@ -40,8 +43,9 @@ void AOLSModularPlayerStateCharacter::PostInitProperties()
if (AbilitySystemComponent.IsValid())
{
//@Todo replace this log by our custom log.
UE_LOG(LogTemp, Verbose, TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), *GetName(), ReplicationMode);
OLS_LOG(LogOLSModularPlayerStateCharacter, Verbose,
TEXT("PostInitProperties for %s - Setting up ASC Replication Mode to: %d"), GET_UOBJECT_NAME(this),
ReplicationMode);
AbilitySystemComponent->SetReplicationMode(ReplicationMode);
}
}

View File

@ -3,6 +3,7 @@
#include "Player/OLSPlayerState.h"
#include "OLSLog.h"
#include "AbilitySystem/OLSAbilitySystemComponent.h"
#include "AbilitySystem/Attributes/OLSCombatAttributeSet.h"
#include "AbilitySystem/Attributes/OLSHealthAttributeSet.h"
@ -15,6 +16,8 @@
#include UE_INLINE_GENERATED_CPP_BY_NAME(OLSPlayerState)
DEFINE_LOG_CATEGORY(LogOLSPlayerState);
const FName AOLSPlayerState::NAME_OLSAbilityReady("OLSAbilitiesReady");
AOLSPlayerState::AOLSPlayerState(const FObjectInitializer& objectInitializer) : Super(objectInitializer)
@ -44,8 +47,9 @@ void AOLSPlayerState::SetPawnData(const UOLSPawnDataAsset* pawnData)
if (PawnData)
{
// @Todo: replace this by our custom log.
// UE_LOG(LogLyra, Error, TEXT("Trying to set PawnData [%s] on player state [%s] that already has valid PawnData [%s]."), *GetNameSafe(InPawnData), *GetNameSafe(this), *GetNameSafe(PawnData));
OLS_LOG(LogOLSPlayerState, Error,
TEXT("Trying to set PawnData [%s] on player state [%s] that already has valid PawnData [%s]."),
GET_UOBJECT_NAME(pawnData), GET_UOBJECT_NAME(this), GET_UOBJECT_NAME(PawnData));
return;
}
@ -94,8 +98,7 @@ void AOLSPlayerState::OnExperienceLoaded(const UOLSExperienceDefinitionDataAsset
}
else
{
// @T ODO: Replace this with our custom.
// UE_LOG(LogLyra, Error, TEXT("ALyraPlayerState::OnExperienceLoaded(): Unable to find PawnData to initialize player state [%s]!"), *GetNameSafe(this));
OLS_LOG(LogOLSPlayerState, Error, TEXT("Unable to find PawnData to initialize player state [%s]!"), GET_UOBJECT_NAME(this));
}
}
}

View File

@ -11,6 +11,8 @@ DECLARE_MULTICAST_DELEGATE_OneParam(FOLSDeathEventNativeDelegate, class AActor*
DECLARE_DYNAMIC_MULTICAST_DELEGATE_FourParams(FOLSAttributeChangedDynamicDelegate, class UOLSHealthComponent*, healthComponent, float, oldValue, float, newValue, class AActor*, instigator);
DECLARE_MULTICAST_DELEGATE_FourParams(FOLSAttributeChangedNativeDelegate, class UOLSHealthComponent* /* healthComponent */, float /* oldValue */, float /* newValue */, class AActor* /* instigator */)
DECLARE_LOG_CATEGORY_EXTERN(LogOLSHealthComponent, Verbose, All);
/**
* EOLSDeathState
*

View File

@ -26,6 +26,8 @@ public:
FGameplayTag InputTag = FGameplayTag::EmptyTag;
};
DECLARE_LOG_CATEGORY_EXTERN(LogOLSInputConfigDataAsset, Verbose, All);
/**
* UOLSInputConfigDataAsset
*

View File

@ -9,6 +9,8 @@
#include "GameFramework/Actor.h"
#include "OLSModularActor.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSModularActor, Verbose, All);
/** Minimal class that supports extension by game feature plugins, direct child of AActor */
UCLASS(Blueprintable)
class OLS_API AOLSModularActor : public AActor, public IAbilitySystemInterface, public IGameplayTagAssetInterface

View File

@ -9,6 +9,8 @@
#include "GameFramework/Character.h"
#include "OLSModularCharacter.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSModularCharacter, Verbose, All);
/**
* Minimal class that supports extension by game feature plugins
*

View File

@ -9,6 +9,8 @@
#include "GameFramework/DefaultPawn.h"
#include "OLSModularDefaultPawn.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSModularDefaultPawn, Verbose, All);
/** Minimal class that supports extension by game feature plugins, direct child of ADefaultPawn */
UCLASS(Blueprintable)
class OLS_API AOLSModularDefaultPawn : public ADefaultPawn, public IAbilitySystemInterface, public IGameplayTagAssetInterface

View File

@ -9,6 +9,8 @@
#include "GameFramework/Pawn.h"
#include "OLSModularPawn.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSModularPawn, Verbose, All);
/** Minimal class that supports extension by game feature plugins, direct child of APawn */
UCLASS(Blueprintable)
class OLS_API AOLSModularPawn : public APawn, public IAbilitySystemInterface, public IGameplayTagAssetInterface

View File

@ -8,6 +8,8 @@
#include "GameFramework/PlayerState.h"
#include "OLSModularPlayerState.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSModularPlayerState, Verbose, All);
/** Minimal class that supports extension by game feature plugins */
UCLASS(Blueprintable)
class OLS_API AOLSModularPlayerState : public APlayerState, public IAbilitySystemInterface

View File

@ -9,6 +9,8 @@
#include "GameFramework/Character.h"
#include "OLSModularPlayerStateCharacter.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSModularPlayerStateCharacter, Verbose, All);
/**
* Minimal class that supports extension by game feature plugins.
*

View File

@ -7,6 +7,7 @@
#include "Systems/OLSGameplayTagStack.h"
#include "OLSPlayerState.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSPlayerState, Verbose, All);
/**
* AOLSPlayerState