removed dependency on Forge Attribute Set node
This commit is contained in:
@@ -29,6 +29,8 @@ public partial class ForgeEntityNode : Node3D, IForgeEntity
|
||||
[Export]
|
||||
public ForgeTagContainer? BaseTags { get; set; }
|
||||
[Export]
|
||||
public Godot.Collections.Array<ForgeUtils.AttributeSetType> AttributeSets { get; set; } = [];
|
||||
[Export]
|
||||
public ForgeSharedVariableSet? SharedVariableDefinitions { get; set; }
|
||||
|
||||
public required EntityAttributes Attributes { get; set; }
|
||||
@@ -51,7 +53,7 @@ public partial class ForgeEntityNode : Node3D, IForgeEntity
|
||||
{
|
||||
BaseTags ??= new ForgeTagContainer();
|
||||
Tags = new EntityTags(BaseTags.GetTagContainer());
|
||||
Attributes = new EntityAttributes([.. ForgeUtils.CollectAttributeList(this)]);
|
||||
Attributes = new EntityAttributes([.. ForgeUtils.CollectAttributeList(AttributeSets)]);
|
||||
Abilities = new EntityAbilities(this);
|
||||
Events = new EventManager();
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ public class DamageExecution : CustomExecution
|
||||
|
||||
public DamageExecution(DamageType damageType, ForgeTagContainer? damageDealerEventTags, ForgeTagContainer? damageReceiverEventTags)
|
||||
{
|
||||
|
||||
// Capture target mana and magic resistance
|
||||
TargetHealth = new AttributeCaptureDefinition(
|
||||
"CharacterAttributeSet.Health",
|
||||
@@ -60,8 +59,6 @@ public class DamageExecution : CustomExecution
|
||||
effect,
|
||||
target,
|
||||
effectEvaluatedData);
|
||||
|
||||
GD.Print(targetIncomingDamage);
|
||||
|
||||
if (targetIncomingDamage <= 0)
|
||||
{
|
||||
|
||||
@@ -103,6 +103,7 @@ RMovement = ExtResource("4_dejyg")
|
||||
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=1255429192]
|
||||
script = ExtResource("7_46wn3")
|
||||
BaseTags = ExtResource("8_oj1ws")
|
||||
AttributeSets = Array[int]([0, 4, 2])
|
||||
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||
|
||||
[node name="CharacterAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=418635308]
|
||||
|
||||
@@ -56,15 +56,15 @@ BaseValue = 1
|
||||
[sub_resource type="Resource" id="Resource_5eesh"]
|
||||
script = ExtResource("13_jryek")
|
||||
Name = "Grant abilities"
|
||||
Modifiers = null
|
||||
Modifiers = []
|
||||
Components = Array[Object]([SubResource("Resource_3gkmr")])
|
||||
Executions = null
|
||||
Executions = []
|
||||
StackLimit = SubResource("Resource_q86ag")
|
||||
InitialStack = SubResource("Resource_oo2a1")
|
||||
Cues = null
|
||||
Cues = []
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_5lf6m"]
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_4jf2q"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6d4gl"]
|
||||
@@ -95,7 +95,6 @@ radius = 2.0
|
||||
collision_layer = 16
|
||||
collision_mask = 273
|
||||
script = ExtResource("1_r6506")
|
||||
HitAbility = ExtResource("6_4jf2q")
|
||||
EnemyHeight = 2.0
|
||||
RKnockback = ExtResource("11_8k3xb")
|
||||
RMovement = ExtResource("4_na24f")
|
||||
@@ -103,6 +102,7 @@ RMovement = ExtResource("4_na24f")
|
||||
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=289553407]
|
||||
script = ExtResource("7_f22p3")
|
||||
BaseTags = ExtResource("8_4jf2q")
|
||||
AttributeSets = Array[int]([0, 4, 2])
|
||||
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||
|
||||
[node name="CharacterAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=1699781551]
|
||||
@@ -141,7 +141,7 @@ metadata/_custom_type_script = "uid://dps0oef50noil"
|
||||
|
||||
[node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("7_18xwy")]
|
||||
transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0)
|
||||
texture = SubResource("ViewportTexture_5lf6m")
|
||||
texture = SubResource("ViewportTexture_4jf2q")
|
||||
|
||||
[node name="CMovement" parent="." unique_id=1080640834 node_paths=PackedStringArray("WallInFrontRayCast") instance=ExtResource("7_qyswd")]
|
||||
RMovement = SubResource("Resource_6d4gl")
|
||||
|
||||
@@ -183,6 +183,7 @@ RMovement = ExtResource("4_0f52b")
|
||||
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=289553407]
|
||||
script = ExtResource("5_ya0fp")
|
||||
BaseTags = ExtResource("6_ttkdf")
|
||||
AttributeSets = Array[int]([0, 4, 2])
|
||||
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||
|
||||
[node name="CharacterAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=1699781551]
|
||||
|
||||
@@ -78,6 +78,7 @@ surface_material_override/0 = SubResource("StandardMaterial3D_hys74")
|
||||
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=806020391]
|
||||
script = ExtResource("3_wikc1")
|
||||
BaseTags = SubResource("Resource_nqbbv")
|
||||
AttributeSets = Array[int]([0])
|
||||
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||
|
||||
[node name="ForgeEffect" type="Node" parent="ForgeEntityNode" unique_id=2068515708]
|
||||
|
||||
@@ -130,6 +130,7 @@ PlantedTickAbility = ExtResource("3_7bruw")
|
||||
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=1798885192]
|
||||
script = ExtResource("5_7bruw")
|
||||
BaseTags = SubResource("Resource_rgbou")
|
||||
AttributeSets = Array[int]([3])
|
||||
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||
|
||||
[node name="WeaponAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=14845649]
|
||||
|
||||
@@ -206,6 +206,7 @@ HomingFactor = 0.8
|
||||
|
||||
[node name="ForgeEntityNode" type="Node3D" parent="." unique_id=1961065393]
|
||||
script = ExtResource("3_0m0gv")
|
||||
AttributeSets = Array[int]([0])
|
||||
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||
|
||||
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=100377985]
|
||||
|
||||
@@ -1,12 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Gamesmiths.Forge.Attributes;
|
||||
using Gamesmiths.Forge.Godot.Nodes;
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using Movementtests.forge.attribute_sets;
|
||||
using Movementtests.scenes.enemies;
|
||||
using Movementtests.scenes.player_controller.components.weapon;
|
||||
using Movementtests.scenes.player_controller.scripts;
|
||||
|
||||
namespace Movementtests.tools;
|
||||
|
||||
public static class ForgeUtils
|
||||
{
|
||||
public enum AttributeSetType
|
||||
{
|
||||
Meta,
|
||||
Player,
|
||||
Enemy,
|
||||
Weapon,
|
||||
Character
|
||||
}
|
||||
|
||||
public static System.Collections.Generic.Dictionary<AttributeSetType, Func<AttributeSet>> AttributeSetMap { get; } = new()
|
||||
{
|
||||
{ AttributeSetType.Meta, () => new MetaAttributeSet() },
|
||||
{ AttributeSetType.Player, () => new PlayerAttributeSet() },
|
||||
{ AttributeSetType.Enemy, () => new EnemyAttributeSet() },
|
||||
{ AttributeSetType.Weapon, () => new WeaponAttributeSet() },
|
||||
{ AttributeSetType.Character, () => new CharacterAttributeSet() },
|
||||
};
|
||||
|
||||
public static List<AttributeSet> CollectAttributeList(Node node)
|
||||
{
|
||||
List<AttributeSet> attributeSetList = [];
|
||||
@@ -19,4 +44,9 @@ public static class ForgeUtils
|
||||
}
|
||||
return attributeSetList;
|
||||
}
|
||||
|
||||
public static List<AttributeSet> CollectAttributeList(Array<AttributeSetType> types)
|
||||
{
|
||||
return types.Select(type => AttributeSetMap[type]()).ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user