new forge entity node to benefit from autoinject
This commit is contained in:
@@ -128,7 +128,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="addons\" />
|
<Folder Include="addons\" />
|
||||||
<Folder Include="tests\" />
|
<Folder Include="tests\" />
|
||||||
<Folder Include="tools\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="RustyOptions" Version="0.10.1" />
|
<PackageReference Include="RustyOptions" Version="0.10.1" />
|
||||||
|
|||||||
74
forge/ForgeEntityNode.cs
Normal file
74
forge/ForgeEntityNode.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
// Copyright © Gamesmiths Guild.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Chickensoft.AutoInject;
|
||||||
|
using Chickensoft.Introspection;
|
||||||
|
using Gamesmiths.Forge.Core;
|
||||||
|
using Gamesmiths.Forge.Cues;
|
||||||
|
using Gamesmiths.Forge.Effects;
|
||||||
|
using Gamesmiths.Forge.Events;
|
||||||
|
using Gamesmiths.Forge.Godot.Core;
|
||||||
|
using Gamesmiths.Forge.Godot.Resources;
|
||||||
|
using Gamesmiths.Forge.Statescript;
|
||||||
|
using Gamesmiths.Forge.Tags;
|
||||||
|
using Godot;
|
||||||
|
using Node = Godot.Node;
|
||||||
|
|
||||||
|
namespace Movementtests.tools;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
[Icon("uid://cu6ncpuumjo20")]
|
||||||
|
[Meta(typeof(IAutoNode))]
|
||||||
|
public partial class ForgeEntityNode : Node, IForgeEntity
|
||||||
|
{
|
||||||
|
public override void _Notification(int what) => this.Notify(what);
|
||||||
|
|
||||||
|
[Dependency]
|
||||||
|
public TagsManager TagsManager => this.DependOn<TagsManager>();
|
||||||
|
[Dependency]
|
||||||
|
public CuesManager CuesManager => this.DependOn<CuesManager>();
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public ForgeTagContainer? BaseTags { get; set; }
|
||||||
|
[Export]
|
||||||
|
public ForgeSharedVariableSet? SharedVariableDefinitions { get; set; }
|
||||||
|
|
||||||
|
public required EntityAttributes Attributes { get; set; }
|
||||||
|
|
||||||
|
public required EntityTags Tags { get; set; }
|
||||||
|
|
||||||
|
public required EffectsManager EffectsManager { get; set; }
|
||||||
|
|
||||||
|
public required EntityAbilities Abilities { get; set; }
|
||||||
|
|
||||||
|
public required EventManager Events { get; set; }
|
||||||
|
|
||||||
|
public required Variables SharedVariables { get; set; }
|
||||||
|
|
||||||
|
public void OnReady()
|
||||||
|
{
|
||||||
|
BaseTags ??= new ForgeTagContainer();
|
||||||
|
Tags = new EntityTags(BaseTags.GetTagContainer());
|
||||||
|
Attributes = new EntityAttributes([.. ForgeUtils.CollectAttributeList(this)]);
|
||||||
|
Abilities = new EntityAbilities(this);
|
||||||
|
Events = new EventManager();
|
||||||
|
|
||||||
|
SharedVariables = new Variables();
|
||||||
|
SharedVariableDefinitions?.PopulateVariables(SharedVariables);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnResolved()
|
||||||
|
{
|
||||||
|
EffectsManager = new EffectsManager(this, CuesManager);
|
||||||
|
var effectApplier = new EffectApplier(this);
|
||||||
|
effectApplier.ApplyEffects(this, this, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
base._Process(delta);
|
||||||
|
|
||||||
|
EffectsManager.UpdateEffects(delta);
|
||||||
|
Abilities.UpdateAbilities(delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
forge/ForgeEntityNode.cs.uid
Normal file
1
forge/ForgeEntityNode.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://rpcbb54q4atx
|
||||||
@@ -8,13 +8,13 @@ using Gamesmiths.Forge.Core;
|
|||||||
using Gamesmiths.Forge.Cues;
|
using Gamesmiths.Forge.Cues;
|
||||||
using Gamesmiths.Forge.Effects;
|
using Gamesmiths.Forge.Effects;
|
||||||
using Gamesmiths.Forge.Events;
|
using Gamesmiths.Forge.Events;
|
||||||
using Gamesmiths.Forge.Godot.Nodes;
|
|
||||||
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
||||||
using Gamesmiths.Forge.Statescript;
|
using Gamesmiths.Forge.Statescript;
|
||||||
using Gamesmiths.Forge.Tags;
|
using Gamesmiths.Forge.Tags;
|
||||||
using Godot;
|
using Godot;
|
||||||
using Movementtests.interfaces;
|
using Movementtests.interfaces;
|
||||||
using Movementtests.systems;
|
using Movementtests.systems;
|
||||||
|
using Movementtests.tools;
|
||||||
using Node = Godot.Node;
|
using Node = Godot.Node;
|
||||||
|
|
||||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_beetle.png"), Meta(typeof(IAutoNode))]
|
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_beetle.png"), Meta(typeof(IAutoNode))]
|
||||||
@@ -118,15 +118,19 @@ public partial class Enemy : CharacterBody3D,
|
|||||||
set => ForgeEntity.Events = value;
|
set => ForgeEntity.Events = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
public Variables SharedVariables
|
||||||
|
{
|
||||||
|
get => ForgeEntity.SharedVariables;
|
||||||
|
set => ForgeEntity.SharedVariables = value;
|
||||||
|
}
|
||||||
|
|
||||||
public Variables SharedVariables { get; }
|
#endregion
|
||||||
|
|
||||||
// Private stuff
|
// Private stuff
|
||||||
[Node("DamageBox")] public required Area3D DamageBox { get; set;}
|
[Node("DamageBox")] public required Area3D DamageBox { get; set;}
|
||||||
[Node("CTarget")] public required Node3D TargetComponent { get; set;}
|
[Node("CTarget")] public required Node3D TargetComponent { get; set;}
|
||||||
[Node("CHealthBar")] public required CHealthbar HealthBarWrapper { get; set;}
|
[Node("CHealthBar")] public required CHealthbar HealthBarWrapper { get; set;}
|
||||||
[Node("ForgeEntity")] public required ForgeEntity ForgeEntity { get; set;}
|
[Node("ForgeEntityNode")] public required ForgeEntityNode ForgeEntity { get; set;}
|
||||||
|
|
||||||
private AbilityHandle? _hitAbilityHandle;
|
private AbilityHandle? _hitAbilityHandle;
|
||||||
private EntityAttribute _healthAttribute;
|
private EntityAttribute _healthAttribute;
|
||||||
|
|||||||
@@ -7,19 +7,19 @@
|
|||||||
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="2_on7rt"]
|
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="2_on7rt"]
|
||||||
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="4_dejyg"]
|
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="4_dejyg"]
|
||||||
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://scenes/components/health/CHealth.cs" id="4_ys4jv"]
|
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://scenes/components/health/CHealth.cs" id="4_ys4jv"]
|
||||||
[ext_resource type="Script" uid="uid://8uj04dfe8oql" path="res://addons/forge/nodes/ForgeEntity.cs" id="6_wxisp"]
|
|
||||||
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="7_2digf"]
|
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="7_2digf"]
|
||||||
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="7_46wn3"]
|
[ext_resource type="Script" uid="uid://rpcbb54q4atx" path="res://forge/ForgeEntityNode.cs" id="7_46wn3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dmw5ibwrb483f" path="res://scenes/components/movement/CFlyingMovement.tscn" id="7_vaeds"]
|
[ext_resource type="PackedScene" uid="uid://dmw5ibwrb483f" path="res://scenes/components/movement/CFlyingMovement.tscn" id="7_vaeds"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="7_ykkxn"]
|
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="7_ykkxn"]
|
||||||
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_46wn3"]
|
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="8_46wn3"]
|
||||||
|
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="8_oj1ws"]
|
||||||
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_on7rt"]
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_on7rt"]
|
||||||
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/components/damage/CDamageable.cs" id="8_uotso"]
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/components/damage/CDamageable.cs" id="8_uotso"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_dejyg"]
|
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_dejyg"]
|
||||||
[ext_resource type="Resource" uid="uid://dt7a1io5o0b8s" path="res://scenes/enemies/flying_enemy/flying_enemy_knockback.tres" id="11_mpa2u"]
|
[ext_resource type="Resource" uid="uid://dt7a1io5o0b8s" path="res://scenes/enemies/flying_enemy/flying_enemy_knockback.tres" id="11_mpa2u"]
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_vfi88"]
|
[sub_resource type="Resource" id="Resource_vfi88"]
|
||||||
script = ExtResource("7_46wn3")
|
script = ExtResource("8_oj1ws")
|
||||||
ContainerTags = Array[String](["character.enemy"])
|
ContainerTags = Array[String](["character.enemy"])
|
||||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ Default = 1
|
|||||||
Min = 1
|
Min = 1
|
||||||
Max = 100
|
Max = 100
|
||||||
|
|
||||||
[sub_resource type="ViewportTexture" id="ViewportTexture_46wn3"]
|
[sub_resource type="ViewportTexture" id="ViewportTexture_oj1ws"]
|
||||||
viewport_path = NodePath("SubViewport")
|
viewport_path = NodePath("SubViewport")
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_jnv07"]
|
[sub_resource type="Resource" id="Resource_jnv07"]
|
||||||
@@ -85,12 +85,12 @@ RDamage = ExtResource("2_on7rt")
|
|||||||
RKnockback = ExtResource("11_mpa2u")
|
RKnockback = ExtResource("11_mpa2u")
|
||||||
RMovement = ExtResource("4_dejyg")
|
RMovement = ExtResource("4_dejyg")
|
||||||
|
|
||||||
[node name="ForgeEntity" type="Node" parent="." unique_id=622209781]
|
[node name="ForgeEntityNode" type="Node" parent="." unique_id=22374325]
|
||||||
script = ExtResource("6_wxisp")
|
script = ExtResource("7_46wn3")
|
||||||
BaseTags = SubResource("Resource_vfi88")
|
BaseTags = SubResource("Resource_vfi88")
|
||||||
metadata/_custom_type_script = "uid://8uj04dfe8oql"
|
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||||
|
|
||||||
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntity" unique_id=1840910245]
|
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=1840910245]
|
||||||
script = ExtResource("7_2digf")
|
script = ExtResource("7_2digf")
|
||||||
AttributeSetClass = "EnemyAttributeSet"
|
AttributeSetClass = "EnemyAttributeSet"
|
||||||
InitialAttributeValues = Dictionary[String, ExtResource("8_46wn3")]({
|
InitialAttributeValues = Dictionary[String, ExtResource("8_46wn3")]({
|
||||||
@@ -108,7 +108,7 @@ metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
|
|||||||
|
|
||||||
[node name="CHealthBar" parent="." unique_id=1635725931 instance=ExtResource("7_ykkxn")]
|
[node name="CHealthBar" parent="." unique_id=1635725931 instance=ExtResource("7_ykkxn")]
|
||||||
transform = Transform3D(0.3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.70000005, 0)
|
transform = Transform3D(0.3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.70000005, 0)
|
||||||
texture = SubResource("ViewportTexture_46wn3")
|
texture = SubResource("ViewportTexture_oj1ws")
|
||||||
|
|
||||||
[node name="CDamageable" type="Node" parent="." unique_id=1785297232]
|
[node name="CDamageable" type="Node" parent="." unique_id=1785297232]
|
||||||
script = ExtResource("8_uotso")
|
script = ExtResource("8_uotso")
|
||||||
|
|||||||
@@ -7,19 +7,19 @@
|
|||||||
[ext_resource type="Resource" uid="uid://bohbojc68j7y1" path="res://scenes/enemies/grounded_enemy/grounded_enemy_health.tres" id="2_w4lm8"]
|
[ext_resource type="Resource" uid="uid://bohbojc68j7y1" path="res://scenes/enemies/grounded_enemy/grounded_enemy_health.tres" id="2_w4lm8"]
|
||||||
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="4_na24f"]
|
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="4_na24f"]
|
||||||
[ext_resource type="Resource" uid="uid://qpdw62ubaclc" path="res://forge/resources/ability_datas/grounded_enemy_hit.tres" id="6_4jf2q"]
|
[ext_resource type="Resource" uid="uid://qpdw62ubaclc" path="res://forge/resources/ability_datas/grounded_enemy_hit.tres" id="6_4jf2q"]
|
||||||
[ext_resource type="Script" uid="uid://8uj04dfe8oql" path="res://addons/forge/nodes/ForgeEntity.cs" id="6_x50ya"]
|
|
||||||
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="6_yk4hc"]
|
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="6_yk4hc"]
|
||||||
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/components/damage/CDamageable.cs" id="7_1tw73"]
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/components/damage/CDamageable.cs" id="7_1tw73"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="7_18xwy"]
|
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="7_18xwy"]
|
||||||
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="7_f22p3"]
|
[ext_resource type="Script" uid="uid://rpcbb54q4atx" path="res://forge/ForgeEntityNode.cs" id="7_f22p3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://scenes/components/movement/CGroundedMovement.tscn" id="7_qyswd"]
|
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://scenes/components/movement/CGroundedMovement.tscn" id="7_qyswd"]
|
||||||
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="7_x50ya"]
|
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="7_x50ya"]
|
||||||
|
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="8_4jf2q"]
|
||||||
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_6d4gl"]
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_6d4gl"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_jqqi6"]
|
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_jqqi6"]
|
||||||
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"]
|
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"]
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_4jf2q"]
|
[sub_resource type="Resource" id="Resource_4jf2q"]
|
||||||
script = ExtResource("7_f22p3")
|
script = ExtResource("8_4jf2q")
|
||||||
ContainerTags = Array[String](["character.enemy"])
|
ContainerTags = Array[String](["character.enemy"])
|
||||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||||
|
|
||||||
@@ -85,12 +85,12 @@ RDamage = ExtResource("2_bn56u")
|
|||||||
RKnockback = ExtResource("11_8k3xb")
|
RKnockback = ExtResource("11_8k3xb")
|
||||||
RMovement = ExtResource("4_na24f")
|
RMovement = ExtResource("4_na24f")
|
||||||
|
|
||||||
[node name="ForgeEntity" type="Node" parent="." unique_id=432521027]
|
[node name="ForgeEntityNode" type="Node" parent="." unique_id=136254637]
|
||||||
script = ExtResource("6_x50ya")
|
script = ExtResource("7_f22p3")
|
||||||
BaseTags = SubResource("Resource_4jf2q")
|
BaseTags = SubResource("Resource_4jf2q")
|
||||||
metadata/_custom_type_script = "uid://8uj04dfe8oql"
|
metadata/_custom_type_script = "uid://rpcbb54q4atx"
|
||||||
|
|
||||||
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntity" unique_id=804252284]
|
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntityNode" unique_id=804252284]
|
||||||
script = ExtResource("6_yk4hc")
|
script = ExtResource("6_yk4hc")
|
||||||
AttributeSetClass = "EnemyAttributeSet"
|
AttributeSetClass = "EnemyAttributeSet"
|
||||||
InitialAttributeValues = Dictionary[String, ExtResource("7_x50ya")]({
|
InitialAttributeValues = Dictionary[String, ExtResource("7_x50ya")]({
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ using Godot;
|
|||||||
using GodotStateCharts;
|
using GodotStateCharts;
|
||||||
using Movementtests.addons.godot_state_charts.csharp;
|
using Movementtests.addons.godot_state_charts.csharp;
|
||||||
using Movementtests.interfaces;
|
using Movementtests.interfaces;
|
||||||
|
using Movementtests.tools;
|
||||||
using Node = Godot.Node;
|
using Node = Godot.Node;
|
||||||
|
|
||||||
namespace Movementtests.systems;
|
namespace Movementtests.systems;
|
||||||
@@ -90,13 +91,14 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Publics
|
#region Publics
|
||||||
|
|
||||||
public EntityAttributes Attributes { get; set; } = null!;
|
public required EntityAttributes Attributes { get; set; }
|
||||||
public EntityTags Tags { get; set; } = null!;
|
public required EntityTags Tags { get; set; }
|
||||||
public EffectsManager EffectsManager { get; set; } = null!;
|
public required EffectsManager EffectsManager { get; set; }
|
||||||
public EntityAbilities Abilities { get; set; } = null!;
|
public required EntityAbilities Abilities { get; set; }
|
||||||
public EventManager Events { get; set; } = null!;
|
public required EventManager Events { get; set; }
|
||||||
public Variables SharedVariables { get; }
|
public required Variables SharedVariables { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public StateChartState InHandState = null!;
|
public StateChartState InHandState = null!;
|
||||||
public StateChartState FlyingState = null!;
|
public StateChartState FlyingState = null!;
|
||||||
@@ -176,16 +178,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
|||||||
|
|
||||||
WeaponFlyingAbilityTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying");
|
WeaponFlyingAbilityTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying");
|
||||||
|
|
||||||
List<AttributeSet> attributeSetList = [];
|
Attributes = new EntityAttributes([.. ForgeUtils.CollectAttributeList(this)]);
|
||||||
foreach (var node in GetChildren())
|
|
||||||
{
|
|
||||||
if (node is not ForgeAttributeSet attributeSetNode) continue;
|
|
||||||
var attributeSet = attributeSetNode.GetAttributeSet();
|
|
||||||
if (attributeSet is not null)
|
|
||||||
attributeSetList.Add(attributeSet);
|
|
||||||
}
|
|
||||||
Attributes = new EntityAttributes([.. attributeSetList]);
|
|
||||||
|
|
||||||
Tags = new(BaseTags.GetTagContainer());
|
Tags = new(BaseTags.GetTagContainer());
|
||||||
EffectsManager = new EffectsManager(this, cuesManager);
|
EffectsManager = new EffectsManager(this, cuesManager);
|
||||||
Abilities = new(this);
|
Abilities = new(this);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ using Movementtests.interfaces;
|
|||||||
using Movementtests.systems;
|
using Movementtests.systems;
|
||||||
using Movementtests.player_controller.Scripts;
|
using Movementtests.player_controller.Scripts;
|
||||||
using Movementtests.managers;
|
using Movementtests.managers;
|
||||||
|
using Movementtests.tools;
|
||||||
using RustyOptions;
|
using RustyOptions;
|
||||||
using Node = Godot.Node;
|
using Node = Godot.Node;
|
||||||
|
|
||||||
@@ -455,15 +456,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
|||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
// General use stuff
|
// General use stuff
|
||||||
List<AttributeSet> attributeSetList = [];
|
Attributes = new EntityAttributes([.. ForgeUtils.CollectAttributeList(this)]);
|
||||||
foreach (var node in GetChildren())
|
|
||||||
{
|
|
||||||
if (node is not ForgeAttributeSet attributeSetNode) continue;
|
|
||||||
var attributeSet = attributeSetNode.GetAttributeSet();
|
|
||||||
if (attributeSet is not null)
|
|
||||||
attributeSetList.Add(attributeSet);
|
|
||||||
}
|
|
||||||
Attributes = new EntityAttributes([.. attributeSetList]);
|
|
||||||
HealthAttribute = Attributes["PlayerAttributeSet.Health"];
|
HealthAttribute = Attributes["PlayerAttributeSet.Health"];
|
||||||
ManaAttribute = Attributes["PlayerAttributeSet.Mana"];
|
ManaAttribute = Attributes["PlayerAttributeSet.Mana"];
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
using Godot;
|
|
||||||
using GdUnit4;
|
|
||||||
using static GdUnit4.Assertions;
|
|
||||||
using Movementtests.systems;
|
|
||||||
using Movementtests.systems.damage;
|
|
||||||
|
|
||||||
namespace Movementtests.tests;
|
|
||||||
|
|
||||||
[TestSuite, RequireGodotRuntime]
|
|
||||||
public class WeaponSystemUnitTest
|
|
||||||
{
|
|
||||||
private WeaponSystem _weapon;
|
|
||||||
|
|
||||||
[BeforeTest]
|
|
||||||
public void SetupTest()
|
|
||||||
{
|
|
||||||
_weapon = new WeaponSystem();
|
|
||||||
_weapon.RDamage = new RDamage(5.0f, EDamageTypes.Normal);
|
|
||||||
|
|
||||||
_weapon.WeaponMesh = new MeshInstance3D();
|
|
||||||
_weapon.AddChild(_weapon.WeaponMesh);
|
|
||||||
_weapon.WeaponLocationIndicator = new MeshInstance3D();
|
|
||||||
_weapon.AddChild(_weapon.WeaponLocationIndicator);
|
|
||||||
}
|
|
||||||
|
|
||||||
[AfterTest]
|
|
||||||
public void CleanupTest()
|
|
||||||
{
|
|
||||||
_weapon?.Free();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCase]
|
|
||||||
public void TestWeaponLeftAndBackVisibility()
|
|
||||||
{
|
|
||||||
_weapon.Visible = false;
|
|
||||||
|
|
||||||
_weapon.WeaponLeft();
|
|
||||||
AssertBool(_weapon.Visible).IsTrue();
|
|
||||||
|
|
||||||
_weapon.WeaponBack();
|
|
||||||
AssertBool(_weapon.Visible).IsFalse();
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestCase]
|
|
||||||
public void TestThrowWeaponOnCurveSetsUnfrozen()
|
|
||||||
{
|
|
||||||
_weapon.Freeze = true;
|
|
||||||
_weapon.ThrowWeaponOnCurve();
|
|
||||||
AssertBool(_weapon.Freeze).IsFalse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://vkv8aderakcb
|
|
||||||
22
tools/ForgeUtils.cs
Normal file
22
tools/ForgeUtils.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Gamesmiths.Forge.Attributes;
|
||||||
|
using Gamesmiths.Forge.Godot.Nodes;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.tools;
|
||||||
|
|
||||||
|
public static class ForgeUtils
|
||||||
|
{
|
||||||
|
public static List<AttributeSet> CollectAttributeList(Node node)
|
||||||
|
{
|
||||||
|
List<AttributeSet> attributeSetList = [];
|
||||||
|
foreach (var child in node.GetChildren())
|
||||||
|
{
|
||||||
|
if (child is not ForgeAttributeSet attributeSetNode) continue;
|
||||||
|
var attributeSet = attributeSetNode.GetAttributeSet();
|
||||||
|
if (attributeSet is not null)
|
||||||
|
attributeSetList.Add(attributeSet);
|
||||||
|
}
|
||||||
|
return attributeSetList;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
tools/ForgeUtils.cs.uid
Normal file
1
tools/ForgeUtils.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://nxk6tvisusva
|
||||||
Reference in New Issue
Block a user