|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
// Used in the GasaGen.cpp translation unit
|
|
|
|
|
// Used in the GasaGen.cpp translation unit
|
|
|
|
|
#if GASA_INTELLISENSE_DIRECTIVES
|
|
|
|
|
#pragma once
|
|
|
|
|
#define GEN_EXPOSE_BACKEND
|
|
|
|
|
@@ -10,6 +10,8 @@
|
|
|
|
|
struct GAS_AttributeEntry
|
|
|
|
|
{
|
|
|
|
|
StringCached Name;
|
|
|
|
|
// StringCached Description;
|
|
|
|
|
// StringCached Category;
|
|
|
|
|
StringCached MinName;
|
|
|
|
|
StringCached MaxName;
|
|
|
|
|
float Min;
|
|
|
|
|
@@ -25,12 +27,58 @@ void def_attribute_field_property_setter_inlines( CodeBody body, StrC class_name
|
|
|
|
|
void def_attribute_field_initers ( CodeBody body, Array<GAS_AttributeEntry> properties );
|
|
|
|
|
void impl_attribute_fields ( CodeBody body, StrC class_name, Array<GAS_AttributeEntry> properties );
|
|
|
|
|
|
|
|
|
|
Array<GAS_AttributeEntry> get_gasa_attribute_fields()
|
|
|
|
|
Array<GAS_AttributeEntry> get_gasa_primary_attribute_fields()
|
|
|
|
|
{
|
|
|
|
|
local_persist
|
|
|
|
|
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, 64);
|
|
|
|
|
|
|
|
|
|
for (local_persist s32 do_once = 0; do_once == 0; ++ do_once)
|
|
|
|
|
{
|
|
|
|
|
StringCached str_Strength = get_cached_string(txt("Strength"));
|
|
|
|
|
StringCached str_Intelligence = get_cached_string(txt("Intelligence"));
|
|
|
|
|
StringCached str_Resilience = get_cached_string(txt("Resilience"));
|
|
|
|
|
StringCached str_Vigor = get_cached_string(txt("Vigor"));
|
|
|
|
|
|
|
|
|
|
GAS_AttributeEntry Strength = { str_Strength, {nullptr}, {nullptr}, 0, 999.f };
|
|
|
|
|
GAS_AttributeEntry Intelligence = { str_Intelligence, {nullptr}, {nullptr}, 0, 999.f };
|
|
|
|
|
GAS_AttributeEntry Resilience = { str_Resilience, {nullptr}, {nullptr}, 0, 999.f };
|
|
|
|
|
GAS_AttributeEntry Vigor = { str_Vigor, {nullptr}, {nullptr}, 0, 999.f };
|
|
|
|
|
|
|
|
|
|
attribute_fields.append(Strength);
|
|
|
|
|
attribute_fields.append(Intelligence);
|
|
|
|
|
attribute_fields.append(Resilience);
|
|
|
|
|
attribute_fields.append(Vigor);
|
|
|
|
|
}
|
|
|
|
|
return attribute_fields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Array<GAS_AttributeEntry> get_gasa_secondary_attribute_fields()
|
|
|
|
|
{
|
|
|
|
|
local_persist
|
|
|
|
|
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, 64);
|
|
|
|
|
|
|
|
|
|
for (local_persist s32 do_once = 0; do_once == 0; ++ do_once)
|
|
|
|
|
{
|
|
|
|
|
// StringCached str_Strength = get_cached_string(txt("Strength"));
|
|
|
|
|
// StringCached str_Intelligence = get_cached_string(txt("Intelligence"));
|
|
|
|
|
// StringCached str_Resilience = get_cached_string(txt("Resilience"));
|
|
|
|
|
// StringCached str_Vigor = get_cached_string(txt("Vigor"));
|
|
|
|
|
//
|
|
|
|
|
// GAS_AttributeEntry Health = { str_Health, {nullptr}, str_MaxHealth, 0, 100.f };
|
|
|
|
|
// GAS_AttributeEntry MaxHealth = { str_MaxHealth, {nullptr}, {nullptr}, 0, 99999.f };
|
|
|
|
|
// GAS_AttributeEntry Mana = { str_Mana, {nullptr}, str_MaxMana, 0, 50.f };
|
|
|
|
|
// GAS_AttributeEntry MaxMana = { str_MaxMana, {nullptr}, {nullptr}, 0, 99999.f };
|
|
|
|
|
}
|
|
|
|
|
return attribute_fields;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Array<GAS_AttributeEntry> get_gasa_vital_attribute_fields()
|
|
|
|
|
{
|
|
|
|
|
local_persist
|
|
|
|
|
Array<GAS_AttributeEntry> attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, 64);
|
|
|
|
|
|
|
|
|
|
for (local_persist s32 do_once = 0; do_once == 0; ++ do_once) {
|
|
|
|
|
for (local_persist s32 do_once = 0; do_once == 0; ++ do_once)
|
|
|
|
|
{
|
|
|
|
|
StringCached str_Health = get_cached_string(txt("Health"));
|
|
|
|
|
StringCached str_MaxHealth = get_cached_string(txt("MaxHealth"));
|
|
|
|
|
StringCached str_Mana = get_cached_string(txt("Mana"));
|
|
|
|
|
@@ -54,7 +102,17 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
CodeType type_UAttributeSet = def_type( txt("UAttributeSet") );
|
|
|
|
|
CodeComment generation_notice = def_comment(txt("Generated by GasaGen/GasaGen_UGasaAttributeSet.cpp"));
|
|
|
|
|
|
|
|
|
|
Array<GAS_AttributeEntry> attribute_fields = get_gasa_attribute_fields();
|
|
|
|
|
Array<GAS_AttributeEntry> primary_attribute_fields = get_gasa_primary_attribute_fields();
|
|
|
|
|
Array<GAS_AttributeEntry> secondary_attribute_fields = get_gasa_secondary_attribute_fields();
|
|
|
|
|
Array<GAS_AttributeEntry> vital_attribute_fields = get_gasa_vital_attribute_fields();
|
|
|
|
|
|
|
|
|
|
s32 all_attrib_count = primary_attribute_fields.num() + secondary_attribute_fields.num() + vital_attribute_fields.num();
|
|
|
|
|
|
|
|
|
|
Array< GAS_AttributeEntry>
|
|
|
|
|
all_attribute_fields = Array<GAS_AttributeEntry>::init_reserve(GlobalAllocator, all_attrib_count);
|
|
|
|
|
all_attribute_fields.append( primary_attribute_fields);
|
|
|
|
|
all_attribute_fields.append( secondary_attribute_fields);
|
|
|
|
|
all_attribute_fields.append( vital_attribute_fields);
|
|
|
|
|
|
|
|
|
|
StrC class_name = txt("UGasaAttributeSet");
|
|
|
|
|
|
|
|
|
|
@@ -67,7 +125,7 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
CodeInclude Include_AttributeSet = def_include(txt("AttributeSet.h"));
|
|
|
|
|
CodeInclude Include_GasaAttributeSet_Generated = def_include(txt("GasaAttributeSet.generated.h"));
|
|
|
|
|
|
|
|
|
|
CodeAttributes api_attribute= def_attributes( UModule_GASA_API->Name);
|
|
|
|
|
CodeAttributes api_attribute = def_attributes( UModule_GASA_API->Name);
|
|
|
|
|
|
|
|
|
|
CodeClass GasaAttributeSet = {};
|
|
|
|
|
{
|
|
|
|
|
@@ -78,26 +136,51 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
|
|
|
|
|
body.append( def_constructor() );
|
|
|
|
|
body.append(fmt_newline);
|
|
|
|
|
|
|
|
|
|
def_attribute_properties( body, attribute_fields);
|
|
|
|
|
|
|
|
|
|
body.append( def_comment(txt("Primary Attribute Fields")));
|
|
|
|
|
body.append(fmt_newline);
|
|
|
|
|
def_attribute_field_on_reps( body, attribute_fields);
|
|
|
|
|
def_attribute_properties( body, primary_attribute_fields);
|
|
|
|
|
body.append(fmt_newline);
|
|
|
|
|
body.append(fmt_newline);
|
|
|
|
|
|
|
|
|
|
// body.append( def_comment(txt("Secondary Attribute Fields")));
|
|
|
|
|
// body.append(fmt_newline);
|
|
|
|
|
// def_attribute_properties( body, secondary_attribute_fields);
|
|
|
|
|
// body.append(fmt_newline);
|
|
|
|
|
// body.append(fmt_newline);
|
|
|
|
|
|
|
|
|
|
body.append( def_comment(txt("Vital Attribute Fields")));
|
|
|
|
|
body.append(fmt_newline);
|
|
|
|
|
def_attribute_properties( body, vital_attribute_fields);
|
|
|
|
|
|
|
|
|
|
body.append(fmt_newline);
|
|
|
|
|
def_attribute_field_on_reps( body, primary_attribute_fields);
|
|
|
|
|
def_attribute_field_on_reps( body, secondary_attribute_fields);
|
|
|
|
|
def_attribute_field_on_reps( body, vital_attribute_fields);
|
|
|
|
|
|
|
|
|
|
body.append(fmt_newline);
|
|
|
|
|
|
|
|
|
|
body.append( fmt_newline );
|
|
|
|
|
body.append( def_pragma(txt( "region Getters" )));
|
|
|
|
|
def_attribute_field_property_getters( body, class_name, attribute_fields );
|
|
|
|
|
def_attribute_field_property_getters( body, class_name, primary_attribute_fields );
|
|
|
|
|
def_attribute_field_property_getters( body, class_name, secondary_attribute_fields );
|
|
|
|
|
def_attribute_field_property_getters( body, class_name, vital_attribute_fields );
|
|
|
|
|
body.append( fmt_newline );
|
|
|
|
|
def_attribute_field_value_getters( body, attribute_fields );
|
|
|
|
|
def_attribute_field_value_getters( body, primary_attribute_fields );
|
|
|
|
|
def_attribute_field_value_getters( body, secondary_attribute_fields );
|
|
|
|
|
def_attribute_field_value_getters( body, vital_attribute_fields );
|
|
|
|
|
body.append( def_pragma(txt( "endregion Getters" )));
|
|
|
|
|
body.append( fmt_newline );
|
|
|
|
|
|
|
|
|
|
body.append( def_pragma(txt( "region Setters" )));
|
|
|
|
|
def_attribute_field_value_setters( body, attribute_fields );
|
|
|
|
|
def_attribute_field_value_setters( body, primary_attribute_fields );
|
|
|
|
|
def_attribute_field_value_setters( body, secondary_attribute_fields );
|
|
|
|
|
def_attribute_field_value_setters( body, vital_attribute_fields );
|
|
|
|
|
body.append( fmt_newline );
|
|
|
|
|
body.append( fmt_newline );
|
|
|
|
|
def_attribute_field_initers( body, attribute_fields );
|
|
|
|
|
def_attribute_field_initers( body, primary_attribute_fields );
|
|
|
|
|
def_attribute_field_initers( body, secondary_attribute_fields );
|
|
|
|
|
def_attribute_field_initers( body, vital_attribute_fields );
|
|
|
|
|
body.append( def_pragma(txt( "endregion Setters" )));
|
|
|
|
|
body.append( fmt_newline );
|
|
|
|
|
|
|
|
|
|
@@ -143,7 +226,7 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
|
|
|
|
|
CodeBody body = def_body(CodeT::Global_Body);
|
|
|
|
|
{
|
|
|
|
|
def_attribute_field_property_setter_inlines( body, class_name, attribute_fields );
|
|
|
|
|
def_attribute_field_property_setter_inlines( body, class_name, all_attribute_fields );
|
|
|
|
|
}
|
|
|
|
|
inlines.print(body);
|
|
|
|
|
inlines.print(fmt_newline);
|
|
|
|
|
@@ -191,7 +274,7 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
));
|
|
|
|
|
body.append(constructor_for_UGasaAttributeSet );
|
|
|
|
|
|
|
|
|
|
impl_attribute_fields( body, class_name, attribute_fields);
|
|
|
|
|
impl_attribute_fields( body, class_name, all_attribute_fields);
|
|
|
|
|
|
|
|
|
|
CodeFn PostGameplayEffectExecute;
|
|
|
|
|
CodeFn PreAttributeChange;
|
|
|
|
|
@@ -204,7 +287,7 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
post_attribute_clamps.append(fmt_newline);
|
|
|
|
|
post_attribute_clamps.append(fmt_newline);
|
|
|
|
|
|
|
|
|
|
for (GAS_AttributeEntry field : attribute_fields)
|
|
|
|
|
for (GAS_AttributeEntry field : all_attribute_fields)
|
|
|
|
|
{
|
|
|
|
|
String clamp_min;
|
|
|
|
|
if (field.MinName.Data)
|
|
|
|
|
@@ -222,44 +305,51 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
"field", (StrC)field.Name,
|
|
|
|
|
"clamp_min", (StrC)clamp_min,
|
|
|
|
|
"clamp_max", (StrC)clamp_max,
|
|
|
|
|
stringize(
|
|
|
|
|
if (Attribute == Get<field>Attribute())
|
|
|
|
|
{
|
|
|
|
|
NewValue = FMath::Clamp(NewValue, <clamp_min>, <clamp_max>);
|
|
|
|
|
}
|
|
|
|
|
stringize(
|
|
|
|
|
if (Attribute == Get<field>Attribute())
|
|
|
|
|
{
|
|
|
|
|
NewValue = FMath::Clamp(NewValue, <clamp_min>, <clamp_max>);
|
|
|
|
|
}
|
|
|
|
|
)));
|
|
|
|
|
|
|
|
|
|
post_attribute_clamps.append( code_fmt(
|
|
|
|
|
"field", (StrC)field.Name,
|
|
|
|
|
"clamp_min", (StrC)clamp_min,
|
|
|
|
|
"clamp_max", (StrC)clamp_max,
|
|
|
|
|
stringize(
|
|
|
|
|
if ( Data.EvaluatedData.Attribute == Get<field>Attribute() )
|
|
|
|
|
{
|
|
|
|
|
Set<field>(FMath::Clamp(Get<field>(), <clamp_min>, <clamp_max> ));
|
|
|
|
|
}
|
|
|
|
|
stringize(
|
|
|
|
|
if ( Data.EvaluatedData.Attribute == Get<field>Attribute() )
|
|
|
|
|
{
|
|
|
|
|
Set<field>(FMath::Clamp(Get<field>(), <clamp_min>, <clamp_max> ));
|
|
|
|
|
}
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pre_attribute_clamps.append(fmt_newline);
|
|
|
|
|
pre_attribute_clamps.append(fmt_newline);
|
|
|
|
|
post_attribute_clamps.append(fmt_newline);
|
|
|
|
|
post_attribute_clamps.append(fmt_newline);
|
|
|
|
|
|
|
|
|
|
PreAttributeChange = parse_function( token_fmt( "attribute_clamps", (StrC)pre_attribute_clamps.to_string(), stringize(
|
|
|
|
|
void UGasaAttributeSet::PreAttributeChange(const FGameplayAttribute& Attribute, float& NewValue)
|
|
|
|
|
{
|
|
|
|
|
Super::PreAttributeChange(Attribute, NewValue);
|
|
|
|
|
|
|
|
|
|
<attribute_clamps>
|
|
|
|
|
|
|
|
|
|
PreAttributeChange_Custom();
|
|
|
|
|
}
|
|
|
|
|
)));
|
|
|
|
|
|
|
|
|
|
post_attribute_clamps.append(fmt_newline);
|
|
|
|
|
post_attribute_clamps.append(fmt_newline);
|
|
|
|
|
PostGameplayEffectExecute = parse_function( token_fmt( "attribute_clamps", (StrC)post_attribute_clamps.to_string(), stringize(
|
|
|
|
|
void UGasaAttributeSet::PostGameplayEffectExecute(FGameplayEffectModCallbackData const& Data)
|
|
|
|
|
{
|
|
|
|
|
Super::PostGameplayEffectExecute(Data);
|
|
|
|
|
FEffectProperties Props;
|
|
|
|
|
Props.Populate(Data);
|
|
|
|
|
|
|
|
|
|
<attribute_clamps>
|
|
|
|
|
|
|
|
|
|
PostAttributeChange_Custom();
|
|
|
|
|
}
|
|
|
|
|
)));
|
|
|
|
|
}
|
|
|
|
|
@@ -274,7 +364,7 @@ void gen_UGasaAttributeSet()
|
|
|
|
|
CodeBody field_lifetimes = def_body( CodeT::Function_Body);
|
|
|
|
|
field_lifetimes.append(fmt_newline);
|
|
|
|
|
field_lifetimes.append(fmt_newline);
|
|
|
|
|
for (GAS_AttributeEntry field : attribute_fields)
|
|
|
|
|
for (GAS_AttributeEntry field : all_attribute_fields)
|
|
|
|
|
{
|
|
|
|
|
field_lifetimes.append( code_fmt( "field", (StrC)field.Name, stringize(
|
|
|
|
|
DOREPLIFETIME_DEFAULT_GAS(UGasaAttributeSet, <field>);
|
|
|
|
|
|