Fixes for GasaGen_AttributeSets
This commit is contained in:
parent
8ba9170794
commit
7f7a041978
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
BIN
Project/Binaries/Win64/UnrealEditor-GasaEditor.dll
(Stored with Git LFS)
Binary file not shown.
@ -13,14 +13,14 @@ struct GASA_API FAttributeSetField : public FTableRowBase
|
|||||||
|
|
||||||
FAttributeSetField()
|
FAttributeSetField()
|
||||||
: Name("Provide_Name")
|
: Name("Provide_Name")
|
||||||
, Category("Optional Category")
|
, Category("Provide Category")
|
||||||
, Description("Provide Description")
|
, Description("Provide Description")
|
||||||
, BaseValue(0)
|
, BaseValue(0)
|
||||||
, bUseMinAttribute(false)
|
, bUseMinAttribute(false)
|
||||||
, bUseMaxAttribute(false)
|
, bUseMaxAttribute(false)
|
||||||
, MinAttribute("Attribute behaving has minimum value")
|
, MinAttribute("")
|
||||||
, MinValue(0)
|
, MinValue(0)
|
||||||
, MaxAttribute("Attribute behaving has maximum value")
|
, MaxAttribute("")
|
||||||
, MaxValue(0)
|
, MaxValue(0)
|
||||||
{}
|
{}
|
||||||
virtual ~FAttributeSetField()
|
virtual ~FAttributeSetField()
|
||||||
@ -48,13 +48,13 @@ struct GASA_API FAttributeSetField : public FTableRowBase
|
|||||||
bool bUseMaxAttribute;
|
bool bUseMaxAttribute;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMinAttribute", EditConditionHides))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMinAttribute", EditConditionHides))
|
||||||
FString MinAttribute;
|
FName MinAttribute;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMinAttribute==false", EditConditionHides))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMinAttribute==false", EditConditionHides))
|
||||||
float MinValue;
|
float MinValue;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMaxAttribute", EditConditionHides))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMaxAttribute", EditConditionHides))
|
||||||
FString MaxAttribute;
|
FName MaxAttribute;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMaxAttribute==false", EditConditionHides))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Gameplay Attribute", meta =( EditCondition="bUseMaxAttribute==false", EditConditionHides))
|
||||||
float MaxValue;
|
float MaxValue;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp
|
// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp
|
||||||
#include "GasaAttributeSet.h"
|
#include "GasaAttributeSet.h"
|
||||||
#include "GasaAttributeSet_Inlines.h"
|
#include "GasaAttributeSet_Inlines.h"
|
||||||
#include "EffectProperties.h"
|
#include "EffectProperties.h"
|
||||||
@ -8,15 +8,21 @@
|
|||||||
#include "Networking/GasaNetLibrary.h"
|
#include "Networking/GasaNetLibrary.h"
|
||||||
#include "GameplayEffectExtension.h"
|
#include "GameplayEffectExtension.h"
|
||||||
|
|
||||||
UGasaAttributeSet::UGasaAttributeSet()
|
UGasaAttributeSet::UGasaAttributeSet() {}
|
||||||
{
|
|
||||||
InitHealth( 100.f );
|
|
||||||
InitMaxHealth( 100.f );
|
|
||||||
InitMana( 50.f );
|
|
||||||
InitMaxMana( 50.f );
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma region Rep Notifies
|
#pragma region Rep Notifies
|
||||||
|
void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth )
|
||||||
|
{
|
||||||
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||||
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
|
||||||
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Health, PrevHealth );
|
||||||
|
}
|
||||||
|
void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana )
|
||||||
|
{
|
||||||
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||||
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
|
||||||
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Mana, PrevMana );
|
||||||
|
}
|
||||||
void UGasaAttributeSet::Client_OnRep_Strength( FGameplayAttributeData& PrevStrength )
|
void UGasaAttributeSet::Client_OnRep_Strength( FGameplayAttributeData& PrevStrength )
|
||||||
{
|
{
|
||||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||||
@ -45,24 +51,12 @@ void UGasaAttributeSet::Client_OnRep_Vigor( FGameplayAttributeData& PrevVigor )
|
|||||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Vigor ) );
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Vigor ) );
|
||||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Vigor, PrevVigor );
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Vigor, PrevVigor );
|
||||||
}
|
}
|
||||||
void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth )
|
|
||||||
{
|
|
||||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
|
||||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
|
|
||||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Health, PrevHealth );
|
|
||||||
}
|
|
||||||
void UGasaAttributeSet::Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth )
|
void UGasaAttributeSet::Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth )
|
||||||
{
|
{
|
||||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
||||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxHealth, PrevMaxHealth );
|
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxHealth, PrevMaxHealth );
|
||||||
}
|
}
|
||||||
void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana )
|
|
||||||
{
|
|
||||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
|
||||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
|
|
||||||
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Mana, PrevMana );
|
|
||||||
}
|
|
||||||
void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana )
|
void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana )
|
||||||
{
|
{
|
||||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||||
@ -77,6 +71,14 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
|
|||||||
FEffectProperties Props;
|
FEffectProperties Props;
|
||||||
Props.Populate( Data );
|
Props.Populate( Data );
|
||||||
|
|
||||||
|
if ( Data.EvaluatedData.Attribute == GetHealthAttribute() )
|
||||||
|
{
|
||||||
|
SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) );
|
||||||
|
}
|
||||||
|
if ( Data.EvaluatedData.Attribute == GetManaAttribute() )
|
||||||
|
{
|
||||||
|
SetMana( FMath::Clamp( GetMana(), 0, GetMaxMana() ) );
|
||||||
|
}
|
||||||
if ( Data.EvaluatedData.Attribute == GetStrengthAttribute() )
|
if ( Data.EvaluatedData.Attribute == GetStrengthAttribute() )
|
||||||
{
|
{
|
||||||
SetStrength( FMath::Clamp( GetStrength(), 0, 999.000000 ) );
|
SetStrength( FMath::Clamp( GetStrength(), 0, 999.000000 ) );
|
||||||
@ -93,18 +95,10 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
|
|||||||
{
|
{
|
||||||
SetVigor( FMath::Clamp( GetVigor(), 0, 999.000000 ) );
|
SetVigor( FMath::Clamp( GetVigor(), 0, 999.000000 ) );
|
||||||
}
|
}
|
||||||
if ( Data.EvaluatedData.Attribute == GetHealthAttribute() )
|
|
||||||
{
|
|
||||||
SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) );
|
|
||||||
}
|
|
||||||
if ( Data.EvaluatedData.Attribute == GetMaxHealthAttribute() )
|
if ( Data.EvaluatedData.Attribute == GetMaxHealthAttribute() )
|
||||||
{
|
{
|
||||||
SetMaxHealth( FMath::Clamp( GetMaxHealth(), 0, 99999.000000 ) );
|
SetMaxHealth( FMath::Clamp( GetMaxHealth(), 0, 99999.000000 ) );
|
||||||
}
|
}
|
||||||
if ( Data.EvaluatedData.Attribute == GetManaAttribute() )
|
|
||||||
{
|
|
||||||
SetMana( FMath::Clamp( GetMana(), 0, GetMaxMana() ) );
|
|
||||||
}
|
|
||||||
if ( Data.EvaluatedData.Attribute == GetMaxManaAttribute() )
|
if ( Data.EvaluatedData.Attribute == GetMaxManaAttribute() )
|
||||||
{
|
{
|
||||||
SetMaxMana( FMath::Clamp( GetMaxMana(), 0, 99999.000000 ) );
|
SetMaxMana( FMath::Clamp( GetMaxMana(), 0, 99999.000000 ) );
|
||||||
@ -115,6 +109,14 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
|
|||||||
{
|
{
|
||||||
Super::PreAttributeChange( Attribute, NewValue );
|
Super::PreAttributeChange( Attribute, NewValue );
|
||||||
|
|
||||||
|
if ( Attribute == GetHealthAttribute() )
|
||||||
|
{
|
||||||
|
NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() );
|
||||||
|
}
|
||||||
|
if ( Attribute == GetManaAttribute() )
|
||||||
|
{
|
||||||
|
NewValue = FMath::Clamp( NewValue, 0, GetMaxMana() );
|
||||||
|
}
|
||||||
if ( Attribute == GetStrengthAttribute() )
|
if ( Attribute == GetStrengthAttribute() )
|
||||||
{
|
{
|
||||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||||
@ -131,18 +133,10 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
|
|||||||
{
|
{
|
||||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||||
}
|
}
|
||||||
if ( Attribute == GetHealthAttribute() )
|
|
||||||
{
|
|
||||||
NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() );
|
|
||||||
}
|
|
||||||
if ( Attribute == GetMaxHealthAttribute() )
|
if ( Attribute == GetMaxHealthAttribute() )
|
||||||
{
|
{
|
||||||
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
||||||
}
|
}
|
||||||
if ( Attribute == GetManaAttribute() )
|
|
||||||
{
|
|
||||||
NewValue = FMath::Clamp( NewValue, 0, GetMaxMana() );
|
|
||||||
}
|
|
||||||
if ( Attribute == GetMaxManaAttribute() )
|
if ( Attribute == GetMaxManaAttribute() )
|
||||||
{
|
{
|
||||||
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
||||||
@ -153,12 +147,12 @@ void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& O
|
|||||||
{
|
{
|
||||||
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
|
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
|
||||||
|
|
||||||
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health );
|
||||||
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana );
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Strength );
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Strength );
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Intelligence );
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Intelligence );
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Resilience );
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Resilience );
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Vigor );
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Vigor );
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health );
|
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth );
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth );
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana );
|
|
||||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana );
|
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana );
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp
|
// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AttributeSet.h"
|
#include "AttributeSet.h"
|
||||||
@ -11,28 +11,36 @@ class GASA_API UGasaAttributeSet : public UAttributeSet
|
|||||||
public:
|
public:
|
||||||
UGasaAttributeSet();
|
UGasaAttributeSet();
|
||||||
|
|
||||||
// Primary Attribute Fields
|
// Vital Attributes
|
||||||
|
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Strength, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Vital" )
|
||||||
|
FGameplayAttributeData Health;
|
||||||
|
UPROPERTY( ReplicatedUsing = Client_OnRep_Mana, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Vital" )
|
||||||
|
FGameplayAttributeData Mana;
|
||||||
|
|
||||||
|
// Primary Attributes
|
||||||
|
|
||||||
|
UPROPERTY( ReplicatedUsing = Client_OnRep_Strength, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" )
|
||||||
FGameplayAttributeData Strength;
|
FGameplayAttributeData Strength;
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Intelligence, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
UPROPERTY( ReplicatedUsing = Client_OnRep_Intelligence, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" )
|
||||||
FGameplayAttributeData Intelligence;
|
FGameplayAttributeData Intelligence;
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Resilience, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
UPROPERTY( ReplicatedUsing = Client_OnRep_Resilience, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" )
|
||||||
FGameplayAttributeData Resilience;
|
FGameplayAttributeData Resilience;
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Vigor, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
UPROPERTY( ReplicatedUsing = Client_OnRep_Vigor, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" )
|
||||||
FGameplayAttributeData Vigor;
|
FGameplayAttributeData Vigor;
|
||||||
|
|
||||||
// Vital Attribute Fields
|
// Secondary Attributes
|
||||||
|
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxHealth, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||||
FGameplayAttributeData Health;
|
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxHealth, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
|
||||||
FGameplayAttributeData MaxHealth;
|
FGameplayAttributeData MaxHealth;
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Mana, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||||
FGameplayAttributeData Mana;
|
|
||||||
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
|
||||||
FGameplayAttributeData MaxMana;
|
FGameplayAttributeData MaxMana;
|
||||||
|
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void Client_OnRep_Health( FGameplayAttributeData& PrevHealth );
|
||||||
|
UFUNCTION()
|
||||||
|
void Client_OnRep_Mana( FGameplayAttributeData& PrevMana );
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Client_OnRep_Strength( FGameplayAttributeData& PrevStrength );
|
void Client_OnRep_Strength( FGameplayAttributeData& PrevStrength );
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
@ -42,15 +50,21 @@ public:
|
|||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Client_OnRep_Vigor( FGameplayAttributeData& PrevVigor );
|
void Client_OnRep_Vigor( FGameplayAttributeData& PrevVigor );
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Client_OnRep_Health( FGameplayAttributeData& PrevHealth );
|
|
||||||
UFUNCTION()
|
|
||||||
void Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth );
|
void Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth );
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Client_OnRep_Mana( FGameplayAttributeData& PrevMana );
|
|
||||||
UFUNCTION()
|
|
||||||
void Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana );
|
void Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana );
|
||||||
|
|
||||||
#pragma region Getters
|
#pragma region Getters
|
||||||
|
static FGameplayAttribute GetHealthAttribute()
|
||||||
|
{
|
||||||
|
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
|
||||||
|
return Prop;
|
||||||
|
}
|
||||||
|
static FGameplayAttribute GetManaAttribute()
|
||||||
|
{
|
||||||
|
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
|
||||||
|
return Prop;
|
||||||
|
}
|
||||||
static FGameplayAttribute GetStrengthAttribute()
|
static FGameplayAttribute GetStrengthAttribute()
|
||||||
{
|
{
|
||||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Strength ) );
|
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Strength ) );
|
||||||
@ -71,48 +85,47 @@ public:
|
|||||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Vigor ) );
|
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Vigor ) );
|
||||||
return Prop;
|
return Prop;
|
||||||
}
|
}
|
||||||
static FGameplayAttribute GetHealthAttribute()
|
|
||||||
{
|
|
||||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
|
|
||||||
return Prop;
|
|
||||||
}
|
|
||||||
static FGameplayAttribute GetMaxHealthAttribute()
|
static FGameplayAttribute GetMaxHealthAttribute()
|
||||||
{
|
{
|
||||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
||||||
return Prop;
|
return Prop;
|
||||||
}
|
}
|
||||||
static FGameplayAttribute GetManaAttribute()
|
|
||||||
{
|
|
||||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
|
|
||||||
return Prop;
|
|
||||||
}
|
|
||||||
static FGameplayAttribute GetMaxManaAttribute()
|
static FGameplayAttribute GetMaxManaAttribute()
|
||||||
{
|
{
|
||||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
|
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
|
||||||
return Prop;
|
return Prop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FORCEINLINE float GetHealth() const { return Health.GetCurrentValue(); }
|
||||||
|
FORCEINLINE float GetMana() const { return Mana.GetCurrentValue(); }
|
||||||
FORCEINLINE float GetStrength() const { return Strength.GetCurrentValue(); }
|
FORCEINLINE float GetStrength() const { return Strength.GetCurrentValue(); }
|
||||||
FORCEINLINE float GetIntelligence() const { return Intelligence.GetCurrentValue(); }
|
FORCEINLINE float GetIntelligence() const { return Intelligence.GetCurrentValue(); }
|
||||||
FORCEINLINE float GetResilience() const { return Resilience.GetCurrentValue(); }
|
FORCEINLINE float GetResilience() const { return Resilience.GetCurrentValue(); }
|
||||||
FORCEINLINE float GetVigor() const { return Vigor.GetCurrentValue(); }
|
FORCEINLINE float GetVigor() const { return Vigor.GetCurrentValue(); }
|
||||||
FORCEINLINE float GetHealth() const { return Health.GetCurrentValue(); }
|
|
||||||
FORCEINLINE float GetMaxHealth() const { return MaxHealth.GetCurrentValue(); }
|
FORCEINLINE float GetMaxHealth() const { return MaxHealth.GetCurrentValue(); }
|
||||||
FORCEINLINE float GetMana() const { return Mana.GetCurrentValue(); }
|
|
||||||
FORCEINLINE float GetMaxMana() const { return MaxMana.GetCurrentValue(); }
|
FORCEINLINE float GetMaxMana() const { return MaxMana.GetCurrentValue(); }
|
||||||
#pragma endregion Getters
|
#pragma endregion Getters
|
||||||
|
|
||||||
#pragma region Setters
|
#pragma region Setters
|
||||||
FORCEINLINE void
|
FORCEINLINE void SetHealth( float NewVal );
|
||||||
SetStrength( float NewVal );
|
FORCEINLINE void SetMana( float NewVal );
|
||||||
|
FORCEINLINE void SetStrength( float NewVal );
|
||||||
FORCEINLINE void SetIntelligence( float NewVal );
|
FORCEINLINE void SetIntelligence( float NewVal );
|
||||||
FORCEINLINE void SetResilience( float NewVal );
|
FORCEINLINE void SetResilience( float NewVal );
|
||||||
FORCEINLINE void SetVigor( float NewVal );
|
FORCEINLINE void SetVigor( float NewVal );
|
||||||
FORCEINLINE void SetHealth( float NewVal );
|
|
||||||
FORCEINLINE void SetMaxHealth( float NewVal );
|
FORCEINLINE void SetMaxHealth( float NewVal );
|
||||||
FORCEINLINE void SetMana( float NewVal );
|
|
||||||
FORCEINLINE void SetMaxMana( float NewVal );
|
FORCEINLINE void SetMaxMana( float NewVal );
|
||||||
|
|
||||||
|
FORCEINLINE void InitHealth( float NewVal )
|
||||||
|
{
|
||||||
|
Health.SetBaseValue( NewVal );
|
||||||
|
Health.SetCurrentValue( NewVal );
|
||||||
|
}
|
||||||
|
FORCEINLINE void InitMana( float NewVal )
|
||||||
|
{
|
||||||
|
Mana.SetBaseValue( NewVal );
|
||||||
|
Mana.SetCurrentValue( NewVal );
|
||||||
|
}
|
||||||
FORCEINLINE void InitStrength( float NewVal )
|
FORCEINLINE void InitStrength( float NewVal )
|
||||||
{
|
{
|
||||||
Strength.SetBaseValue( NewVal );
|
Strength.SetBaseValue( NewVal );
|
||||||
@ -133,21 +146,11 @@ public:
|
|||||||
Vigor.SetBaseValue( NewVal );
|
Vigor.SetBaseValue( NewVal );
|
||||||
Vigor.SetCurrentValue( NewVal );
|
Vigor.SetCurrentValue( NewVal );
|
||||||
}
|
}
|
||||||
FORCEINLINE void InitHealth( float NewVal )
|
|
||||||
{
|
|
||||||
Health.SetBaseValue( NewVal );
|
|
||||||
Health.SetCurrentValue( NewVal );
|
|
||||||
}
|
|
||||||
FORCEINLINE void InitMaxHealth( float NewVal )
|
FORCEINLINE void InitMaxHealth( float NewVal )
|
||||||
{
|
{
|
||||||
MaxHealth.SetBaseValue( NewVal );
|
MaxHealth.SetBaseValue( NewVal );
|
||||||
MaxHealth.SetCurrentValue( NewVal );
|
MaxHealth.SetCurrentValue( NewVal );
|
||||||
}
|
}
|
||||||
FORCEINLINE void InitMana( float NewVal )
|
|
||||||
{
|
|
||||||
Mana.SetBaseValue( NewVal );
|
|
||||||
Mana.SetCurrentValue( NewVal );
|
|
||||||
}
|
|
||||||
FORCEINLINE void InitMaxMana( float NewVal )
|
FORCEINLINE void InitMaxMana( float NewVal )
|
||||||
{
|
{
|
||||||
MaxMana.SetBaseValue( NewVal );
|
MaxMana.SetBaseValue( NewVal );
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp
|
// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "GasaAttributeSet.h"
|
#include "GasaAttributeSet.h"
|
||||||
@ -6,6 +6,24 @@
|
|||||||
|
|
||||||
#pragma region Attribute Setters
|
#pragma region Attribute Setters
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
|
void UGasaAttributeSet::SetHealth( float NewVal )
|
||||||
|
{
|
||||||
|
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||||
|
if ( ensure( AbilityComp ) )
|
||||||
|
{
|
||||||
|
AbilityComp->SetNumericAttributeBase( GetHealthAttribute(), NewVal );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
FORCEINLINE
|
||||||
|
void UGasaAttributeSet::SetMana( float NewVal )
|
||||||
|
{
|
||||||
|
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||||
|
if ( ensure( AbilityComp ) )
|
||||||
|
{
|
||||||
|
AbilityComp->SetNumericAttributeBase( GetManaAttribute(), NewVal );
|
||||||
|
};
|
||||||
|
}
|
||||||
|
FORCEINLINE
|
||||||
void UGasaAttributeSet::SetStrength( float NewVal )
|
void UGasaAttributeSet::SetStrength( float NewVal )
|
||||||
{
|
{
|
||||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||||
@ -42,15 +60,6 @@ void UGasaAttributeSet::SetVigor( float NewVal )
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
void UGasaAttributeSet::SetHealth( float NewVal )
|
|
||||||
{
|
|
||||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
|
||||||
if ( ensure( AbilityComp ) )
|
|
||||||
{
|
|
||||||
AbilityComp->SetNumericAttributeBase( GetHealthAttribute(), NewVal );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
FORCEINLINE
|
|
||||||
void UGasaAttributeSet::SetMaxHealth( float NewVal )
|
void UGasaAttributeSet::SetMaxHealth( float NewVal )
|
||||||
{
|
{
|
||||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||||
@ -60,15 +69,6 @@ void UGasaAttributeSet::SetMaxHealth( float NewVal )
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
void UGasaAttributeSet::SetMana( float NewVal )
|
|
||||||
{
|
|
||||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
|
||||||
if ( ensure( AbilityComp ) )
|
|
||||||
{
|
|
||||||
AbilityComp->SetNumericAttributeBase( GetManaAttribute(), NewVal );
|
|
||||||
};
|
|
||||||
}
|
|
||||||
FORCEINLINE
|
|
||||||
void UGasaAttributeSet::SetMaxMana( float NewVal )
|
void UGasaAttributeSet::SetMaxMana( float NewVal )
|
||||||
{
|
{
|
||||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||||
|
@ -10,34 +10,18 @@ using namespace gen;
|
|||||||
#pragma push_macro("UFUNCTION")
|
#pragma push_macro("UFUNCTION")
|
||||||
#pragma push_macro("FORCEINLINE")
|
#pragma push_macro("FORCEINLINE")
|
||||||
#pragma push_macro("ensure")
|
#pragma push_macro("ensure")
|
||||||
|
#pragma push_macro("GET_MEMBER_NAME_CHECKED")
|
||||||
#undef UPROPERTY
|
#undef UPROPERTY
|
||||||
#undef UFUNCTION
|
#undef UFUNCTION
|
||||||
#undef FORCEINLINE
|
#undef FORCEINLINE
|
||||||
#undef ensure
|
#undef ensure
|
||||||
|
#undef GET_MEMBER_NAME_CHECKED
|
||||||
|
|
||||||
PRAGMA_DISABLE_OPTIMIZATION
|
void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||||
void generate_AttributeSets()
|
|
||||||
{
|
{
|
||||||
// All attribute sets are tracked in Gasa's dev options for this project.
|
|
||||||
TArray< TSoftObjectPtr<UDataTable>> AttributeSetTables = Gasa::GetDevOptions()->AttributeSets;
|
|
||||||
check( AttributeSetTables.Num() > 0 );
|
|
||||||
|
|
||||||
// TODO(Ed): Doing one for now
|
|
||||||
FGraphEventRef LoadTableTask;
|
|
||||||
UDataTable* AttributeSetTable = nullptr;
|
|
||||||
FGraphEventArray Prerequisites;
|
|
||||||
LoadTableTask = FFunctionGraphTask::CreateAndDispatchWhenReady(
|
|
||||||
[ & AttributeSetTable, & AttributeSetTables ]()
|
|
||||||
{
|
|
||||||
AttributeSetTable = AttributeSetTables[0].LoadSynchronous();
|
|
||||||
},
|
|
||||||
TStatId(), &Prerequisites, ENamedThreads::GameThread
|
|
||||||
);
|
|
||||||
FTaskGraphInterface::Get().WaitUntilTaskCompletes(LoadTableTask);
|
|
||||||
|
|
||||||
TMap<FName, TArray<FAttributeSetField>> AttributesByCategory;
|
TMap<FName, TArray<FAttributeSetField>> AttributesByCategory;
|
||||||
{
|
{
|
||||||
TMap< FName, uint8* > const& RowMap = AttributeSetTable->GetRowMap();
|
TMap< FName, uint8* > const& RowMap = table->GetRowMap();
|
||||||
for (const TPair<FName, uint8*>& Row : RowMap)
|
for (const TPair<FName, uint8*>& Row : RowMap)
|
||||||
{
|
{
|
||||||
FAttributeSetField const* RowData = rcast( FAttributeSetField const* , Row.Value);
|
FAttributeSetField const* RowData = rcast( FAttributeSetField const* , Row.Value);
|
||||||
@ -50,11 +34,9 @@ void generate_AttributeSets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FString AssetName = AttributeSetTables[0].GetAssetName();
|
check( asset_name.StartsWith(TEXT("DT_") ))
|
||||||
check( AssetName.StartsWith(TEXT("DT_") ))
|
asset_name = asset_name.RightChop(3);
|
||||||
AssetName = AssetName.RightChop(3);
|
String str_AssetName = to_string(asset_name);
|
||||||
|
|
||||||
String str_AssetName = to_string(AssetName);
|
|
||||||
|
|
||||||
String class_name = String::fmt_buf(GlobalAllocator, "U%S", str_AssetName);
|
String class_name = String::fmt_buf(GlobalAllocator, "U%S", str_AssetName);
|
||||||
String header_file_name = String::fmt_buf(GlobalAllocator, "%S.h", str_AssetName);
|
String header_file_name = String::fmt_buf(GlobalAllocator, "%S.h", str_AssetName);
|
||||||
@ -454,10 +436,34 @@ void generate_AttributeSets()
|
|||||||
format_file(path_source_file);
|
format_file(path_source_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PRAGMA_ENABLE_OPTIMIZATION
|
|
||||||
|
void generate_AttributeSets()
|
||||||
|
{
|
||||||
|
// All attribute sets are tracked in Gasa's dev options for this project.
|
||||||
|
TArray< TSoftObjectPtr<UDataTable>> AttributeSetTables = Gasa::GetDevOptions()->AttributeSets;
|
||||||
|
check( AttributeSetTables.Num() > 0 );
|
||||||
|
|
||||||
|
for ( TSoftObjectPtr<UDataTable> table : AttributeSetTables )
|
||||||
|
{
|
||||||
|
FGraphEventRef LoadTableTask;
|
||||||
|
UDataTable* AttributeSetTable = nullptr;
|
||||||
|
FGraphEventArray Prerequisites;
|
||||||
|
LoadTableTask = FFunctionGraphTask::CreateAndDispatchWhenReady(
|
||||||
|
[ & AttributeSetTable, & AttributeSetTables ]()
|
||||||
|
{
|
||||||
|
AttributeSetTable = AttributeSetTables[0].LoadSynchronous();
|
||||||
|
},
|
||||||
|
TStatId(), &Prerequisites, ENamedThreads::GameThread
|
||||||
|
);
|
||||||
|
FTaskGraphInterface::Get().WaitUntilTaskCompletes(LoadTableTask);
|
||||||
|
|
||||||
|
gen_attribute_set_from_table( AttributeSetTable, table.GetAssetName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma pop_macro("UPROPERTY")
|
#pragma pop_macro("UPROPERTY")
|
||||||
#pragma pop_macro("UFUNCTION")
|
#pragma pop_macro("UFUNCTION")
|
||||||
#pragma pop_macro("FORCEINLINE")
|
#pragma pop_macro("FORCEINLINE")
|
||||||
#pragma pop_macro("ensure")
|
#pragma pop_macro("ensure")
|
||||||
|
#pragma pop_macro("GET_MEMBER_NAME_CHECKED")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user