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()
|
||||
: Name("Provide_Name")
|
||||
, Category("Optional Category")
|
||||
, Category("Provide Category")
|
||||
, Description("Provide Description")
|
||||
, BaseValue(0)
|
||||
, bUseMinAttribute(false)
|
||||
, bUseMaxAttribute(false)
|
||||
, MinAttribute("Attribute behaving has minimum value")
|
||||
, MinAttribute("")
|
||||
, MinValue(0)
|
||||
, MaxAttribute("Attribute behaving has maximum value")
|
||||
, MaxAttribute("")
|
||||
, MaxValue(0)
|
||||
{}
|
||||
virtual ~FAttributeSetField()
|
||||
@ -48,13 +48,13 @@ struct GASA_API FAttributeSetField : public FTableRowBase
|
||||
bool bUseMaxAttribute;
|
||||
|
||||
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))
|
||||
float MinValue;
|
||||
|
||||
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))
|
||||
float MaxValue;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp
|
||||
// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp
|
||||
#include "GasaAttributeSet.h"
|
||||
#include "GasaAttributeSet_Inlines.h"
|
||||
#include "EffectProperties.h"
|
||||
@ -8,15 +8,21 @@
|
||||
#include "Networking/GasaNetLibrary.h"
|
||||
#include "GameplayEffectExtension.h"
|
||||
|
||||
UGasaAttributeSet::UGasaAttributeSet()
|
||||
{
|
||||
InitHealth( 100.f );
|
||||
InitMaxHealth( 100.f );
|
||||
InitMana( 50.f );
|
||||
InitMaxMana( 50.f );
|
||||
}
|
||||
UGasaAttributeSet::UGasaAttributeSet() {}
|
||||
|
||||
#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 )
|
||||
{
|
||||
// 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 ) );
|
||||
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 )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
||||
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 )
|
||||
{
|
||||
// From GAMEPLAYATTRIBUTE_REPNOTIFY
|
||||
@ -77,6 +71,14 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
|
||||
FEffectProperties Props;
|
||||
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() )
|
||||
{
|
||||
SetStrength( FMath::Clamp( GetStrength(), 0, 999.000000 ) );
|
||||
@ -93,18 +95,10 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
|
||||
{
|
||||
SetVigor( FMath::Clamp( GetVigor(), 0, 999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetHealthAttribute() )
|
||||
{
|
||||
SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetMaxHealthAttribute() )
|
||||
{
|
||||
SetMaxHealth( FMath::Clamp( GetMaxHealth(), 0, 99999.000000 ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetManaAttribute() )
|
||||
{
|
||||
SetMana( FMath::Clamp( GetMana(), 0, GetMaxMana() ) );
|
||||
}
|
||||
if ( Data.EvaluatedData.Attribute == GetMaxManaAttribute() )
|
||||
{
|
||||
SetMaxMana( FMath::Clamp( GetMaxMana(), 0, 99999.000000 ) );
|
||||
@ -115,6 +109,14 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
|
||||
{
|
||||
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() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
@ -131,18 +133,10 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
|
||||
}
|
||||
if ( Attribute == GetHealthAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() );
|
||||
}
|
||||
if ( Attribute == GetMaxHealthAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
||||
}
|
||||
if ( Attribute == GetManaAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, GetMaxMana() );
|
||||
}
|
||||
if ( Attribute == GetMaxManaAttribute() )
|
||||
{
|
||||
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
|
||||
@ -153,12 +147,12 @@ void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& O
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
|
||||
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Strength );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Intelligence );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Resilience );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Vigor );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana );
|
||||
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana );
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp
|
||||
// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp
|
||||
#pragma once
|
||||
|
||||
#include "AttributeSet.h"
|
||||
@ -11,28 +11,36 @@ class GASA_API UGasaAttributeSet : public UAttributeSet
|
||||
public:
|
||||
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;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Intelligence, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Intelligence, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" )
|
||||
FGameplayAttributeData Intelligence;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Resilience, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Resilience, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" )
|
||||
FGameplayAttributeData Resilience;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Vigor, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Vigor, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Primary" )
|
||||
FGameplayAttributeData Vigor;
|
||||
|
||||
// Vital Attribute Fields
|
||||
// Secondary Attributes
|
||||
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Health, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
||||
FGameplayAttributeData Health;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxHealth, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxHealth, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData MaxHealth;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_Mana, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
||||
FGameplayAttributeData Mana;
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes" )
|
||||
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
|
||||
FGameplayAttributeData MaxMana;
|
||||
|
||||
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Health( FGameplayAttributeData& PrevHealth );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Mana( FGameplayAttributeData& PrevMana );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Strength( FGameplayAttributeData& PrevStrength );
|
||||
UFUNCTION()
|
||||
@ -42,15 +50,21 @@ public:
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Vigor( FGameplayAttributeData& PrevVigor );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Health( FGameplayAttributeData& PrevHealth );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_Mana( FGameplayAttributeData& PrevMana );
|
||||
UFUNCTION()
|
||||
void Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana );
|
||||
|
||||
#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 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 ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetHealthAttribute()
|
||||
{
|
||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetMaxHealthAttribute()
|
||||
{
|
||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetManaAttribute()
|
||||
{
|
||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
|
||||
return Prop;
|
||||
}
|
||||
static FGameplayAttribute GetMaxManaAttribute()
|
||||
{
|
||||
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
|
||||
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 GetIntelligence() const { return Intelligence.GetCurrentValue(); }
|
||||
FORCEINLINE float GetResilience() const { return Resilience.GetCurrentValue(); }
|
||||
FORCEINLINE float GetVigor() const { return Vigor.GetCurrentValue(); }
|
||||
FORCEINLINE float GetHealth() const { return Health.GetCurrentValue(); }
|
||||
FORCEINLINE float GetMaxHealth() const { return MaxHealth.GetCurrentValue(); }
|
||||
FORCEINLINE float GetMana() const { return Mana.GetCurrentValue(); }
|
||||
FORCEINLINE float GetMaxMana() const { return MaxMana.GetCurrentValue(); }
|
||||
#pragma endregion Getters
|
||||
#pragma endregion Getters
|
||||
|
||||
#pragma region Setters
|
||||
FORCEINLINE void
|
||||
SetStrength( float NewVal );
|
||||
FORCEINLINE void SetHealth( float NewVal );
|
||||
FORCEINLINE void SetMana( float NewVal );
|
||||
FORCEINLINE void SetStrength( float NewVal );
|
||||
FORCEINLINE void SetIntelligence( float NewVal );
|
||||
FORCEINLINE void SetResilience( float NewVal );
|
||||
FORCEINLINE void SetVigor( float NewVal );
|
||||
FORCEINLINE void SetHealth( float NewVal );
|
||||
FORCEINLINE void SetMaxHealth( float NewVal );
|
||||
FORCEINLINE void SetMana( 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 )
|
||||
{
|
||||
Strength.SetBaseValue( NewVal );
|
||||
@ -133,21 +146,11 @@ public:
|
||||
Vigor.SetBaseValue( NewVal );
|
||||
Vigor.SetCurrentValue( NewVal );
|
||||
}
|
||||
FORCEINLINE void InitHealth( float NewVal )
|
||||
{
|
||||
Health.SetBaseValue( NewVal );
|
||||
Health.SetCurrentValue( NewVal );
|
||||
}
|
||||
FORCEINLINE void InitMaxHealth( float NewVal )
|
||||
{
|
||||
MaxHealth.SetBaseValue( NewVal );
|
||||
MaxHealth.SetCurrentValue( NewVal );
|
||||
}
|
||||
FORCEINLINE void InitMana( float NewVal )
|
||||
{
|
||||
Mana.SetBaseValue( NewVal );
|
||||
Mana.SetCurrentValue( NewVal );
|
||||
}
|
||||
FORCEINLINE void InitMaxMana( float NewVal )
|
||||
{
|
||||
MaxMana.SetBaseValue( NewVal );
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp
|
||||
// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp
|
||||
#pragma once
|
||||
|
||||
#include "GasaAttributeSet.h"
|
||||
@ -6,6 +6,24 @@
|
||||
|
||||
#pragma region Attribute Setters
|
||||
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 )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
@ -42,15 +60,6 @@ void UGasaAttributeSet::SetVigor( float NewVal )
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetHealth( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetHealthAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetMaxHealth( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
@ -60,15 +69,6 @@ void UGasaAttributeSet::SetMaxHealth( float NewVal )
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetMana( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
if ( ensure( AbilityComp ) )
|
||||
{
|
||||
AbilityComp->SetNumericAttributeBase( GetManaAttribute(), NewVal );
|
||||
};
|
||||
}
|
||||
FORCEINLINE
|
||||
void UGasaAttributeSet::SetMaxMana( float NewVal )
|
||||
{
|
||||
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
|
||||
|
@ -10,34 +10,18 @@ using namespace gen;
|
||||
#pragma push_macro("UFUNCTION")
|
||||
#pragma push_macro("FORCEINLINE")
|
||||
#pragma push_macro("ensure")
|
||||
#pragma push_macro("GET_MEMBER_NAME_CHECKED")
|
||||
#undef UPROPERTY
|
||||
#undef UFUNCTION
|
||||
#undef FORCEINLINE
|
||||
#undef ensure
|
||||
#undef GET_MEMBER_NAME_CHECKED
|
||||
|
||||
PRAGMA_DISABLE_OPTIMIZATION
|
||||
void generate_AttributeSets()
|
||||
void gen_attribute_set_from_table( UDataTable* table, FString asset_name )
|
||||
{
|
||||
// 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, uint8* > const& RowMap = AttributeSetTable->GetRowMap();
|
||||
TMap< FName, uint8* > const& RowMap = table->GetRowMap();
|
||||
for (const TPair<FName, uint8*>& Row : RowMap)
|
||||
{
|
||||
FAttributeSetField const* RowData = rcast( FAttributeSetField const* , Row.Value);
|
||||
@ -50,11 +34,9 @@ void generate_AttributeSets()
|
||||
}
|
||||
}
|
||||
|
||||
FString AssetName = AttributeSetTables[0].GetAssetName();
|
||||
check( AssetName.StartsWith(TEXT("DT_") ))
|
||||
AssetName = AssetName.RightChop(3);
|
||||
|
||||
String str_AssetName = to_string(AssetName);
|
||||
check( asset_name.StartsWith(TEXT("DT_") ))
|
||||
asset_name = asset_name.RightChop(3);
|
||||
String str_AssetName = to_string(asset_name);
|
||||
|
||||
String class_name = String::fmt_buf(GlobalAllocator, "U%S", 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);
|
||||
}
|
||||
}
|
||||
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("UFUNCTION")
|
||||
#pragma pop_macro("FORCEINLINE")
|
||||
#pragma pop_macro("ensure")
|
||||
#pragma pop_macro("GET_MEMBER_NAME_CHECKED")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user