Compare commits

...

3 Commits

Author SHA1 Message Date
c1108e96d7 moving further through forge godot-available resources and interfaces
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 25s
Create tag and build when new code gets to main / Export (push) Failing after 3h11m2s
2026-04-01 15:53:38 +02:00
15cb80d045 Using provided ForgeManager singleton and forge_data resource for tags 2026-04-01 15:07:28 +02:00
1d298b3080 more encapsulated effect application 2026-04-01 10:00:22 +02:00
14 changed files with 246 additions and 135 deletions

View File

@@ -1,7 +1,7 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://8j4xg16o3qnl"] [gd_resource type="Resource" format=3 uid="uid://8j4xg16o3qnl"]
[ext_resource type="Script" uid="uid://bq4vlbfx00hea" path="res://addons/forge/core/ForgeData.cs" id="1_x0pne"] [ext_resource type="Script" uid="uid://bq4vlbfx00hea" path="res://addons/forge/core/ForgeData.cs" id="1_x0pne"]
[resource] [resource]
script = ExtResource("1_x0pne") script = ExtResource("1_x0pne")
RegisteredTags = Array[String](["effect.fire", "effect.wet", "cue.floating.text", "cue.vfx.fire", "cue.vfx.wet", "cue.vfx.regen", "cooldown.enemy.attack", "set_by_caller.damage", "event.damage", "cooldown", "cooldown.skill.projectile", "cooldown.skill.shield", "cooldown.skill.dash", "movement.block", "immunity.damage", "effect.mana_shield", "cue.vfx.shield", "event.damage.taken", "event.damage.dealt", "event", "set_by_caller", "trait.flammable", "trait.healable", "trait.damageable", "trait.wettable", "cue.vfx.reflect", "cue.vfx", "cooldown.skill", "cooldown.skill.reflect"]) RegisteredTags = Array[String](["character.player", "character.enemy", "weapon", "status.stunned", "status.burning", "status.frozen", "abilities.weapon.land", "abilities.weapon.flying", "abilities.weapon.left", "events.combat.damage", "events.combat.hit", "events.weapon.flyingTick", "events.weapon.startedFlying", "events.weapon.stoppedFlying", "events.weapon.handToFlying", "events.weapon.flyingToHand", "events.weapon.plantedToHand", "events.weapon.plantedToFlying", "events.weapon.planted", "cooldown.empoweredAction", "cooldown.empoweredSwordThrow", "cues.resources.mana"])

View File

@@ -1,66 +0,0 @@
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Tags;
using Godot;
namespace Movementtests.tools;
public partial class ForgeManager : Node
{
public CuesManager CuesManager { get; private set; } = new CuesManager();
public TagsManager TagsManager { get; private set; } = new TagsManager(
[
// entities
"character.player",
"character.enemy",
"weapon",
// Statuses
"status.stunned",
"status.weapon.inHand",
"status.weapon.flying",
"status.weapon.planted",
// Abilities
"abilities.weapon.land",
"abilities.weapon.flying",
"abilities.weapon.left",
// Events
"events.combat.damage",
"events.combat.hit",
"events.weapon.flyingTick",
"events.weapon.startedFlying",
"events.weapon.stoppedFlying",
"events.weapon.handToFlying",
"events.weapon.flyingToHand",
"events.weapon.plantedToHand",
"events.weapon.plantedToFlying",
"events.weapon.planted",
// Cooldowns
"cooldown.empoweredAction",
"cooldown.empoweredSwordThrow",
// Cues
"cues.resources.mana",
]);
public static ForgeManager GetForgeManager(Node node)
{
return node.GetTree().Root.GetNode<ForgeManager>("ForgeManager");
}
public static TagsManager GetTagsManager(Node node)
{
return GetForgeManager(node).TagsManager;
}
public static CuesManager GetCuesManager(Node node)
{
return GetForgeManager(node).CuesManager;
}
}

View File

@@ -1 +0,0 @@
uid://c75tpswl62eew

View File

@@ -1,5 +1,6 @@
using System; using System;
using Gamesmiths.Forge.Abilities; using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Cues; using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects; using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Components; using Gamesmiths.Forge.Effects.Components;
@@ -70,4 +71,25 @@ public class ExplodingSwordThrowBehavior<TPayload>(Node3D owner, PackedScene? ex
public void OnEnded(AbilityBehaviorContext context) public void OnEnded(AbilityBehaviorContext context)
{ {
} }
} }
public class FlyingSwordBehavior(IForgeEntity owner, EffectData effectData) : IAbilityBehavior
{
private ActiveEffectHandle? _effectHandle;
public void OnStarted(AbilityBehaviorContext context)
{
GD.Print("This is applying the periodic effect to the flying weapon");
_effectHandle = owner.EffectsManager.ApplyEffect(new Effect(effectData, new EffectOwnership(owner, owner)));
context.AbilityHandle.CommitAbility();
}
public void OnEnded(AbilityBehaviorContext context)
{
GD.Print("This is removing the periodic effect from the flying weapon");
if (_effectHandle is not null)
owner.EffectsManager.RemoveEffect(_effectHandle);
context.InstanceHandle.End();
}
}

7
forge/forge_data.tres Normal file
View File

@@ -0,0 +1,7 @@
[gd_resource type="Resource" format=3 uid="uid://dugyoyn4fda3s"]
[ext_resource type="Script" uid="uid://bq4vlbfx00hea" path="res://addons/forge/core/ForgeData.cs" id="1_l686n"]
[resource]
script = ExtResource("1_l686n")
RegisteredTags = Array[String](["effect.fire", "effect.wet", "cue.floating.text", "cue.vfx.fire", "cue.vfx.wet", "cue.vfx.regen", "cooldown.enemy.attack", "set_by_caller.damage", "event.damage", "cooldown", "cooldown.skill.projectile", "cooldown.skill.shield", "cooldown.skill.dash", "movement.block", "immunity.damage", "effect.mana_shield", "cue.vfx.shield", "event.damage.taken", "event.damage.dealt", "event", "set_by_caller", "trait.flammable", "trait.healable", "trait.damageable", "trait.wettable", "cue.vfx.reflect", "cue.vfx", "cooldown.skill", "cooldown.skill.reflect"])

View File

@@ -30,7 +30,6 @@ Shaker="*uid://c7flmumgr5w3u"
CsgToolkitAutoload="*uid://w8ad8q4lneis" CsgToolkitAutoload="*uid://w8ad8q4lneis"
"Forge Bootstrap"="*uid://ba8fquhtwu5mu" "Forge Bootstrap"="*uid://ba8fquhtwu5mu"
GlobalHelpers="*uid://dqcm83o8e66a2" GlobalHelpers="*uid://dqcm83o8e66a2"
ForgeManager="*uid://c75tpswl62eew"
[display] [display]

View File

@@ -2,6 +2,8 @@ using System;
using Gamesmiths.Forge.Core; using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects; using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Events; using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Core;
using Gamesmiths.Forge.Godot.Nodes;
using Gamesmiths.Forge.Tags; using Gamesmiths.Forge.Tags;
using Godot; using Godot;
using Movementtests.interfaces; using Movementtests.interfaces;
@@ -63,16 +65,38 @@ public partial class Enemy : CharacterBody3D,
set => CHealth.CurrentHealth = value; set => CHealth.CurrentHealth = value;
} }
public EntityAttributes Attributes { get; set; } = null!; // Perfectly forward the IForgeEntity interface to the ForgeEntity component
public EntityTags Tags { get; set; } = null!; public EntityAttributes Attributes
public EffectsManager EffectsManager { get; set; } = null!; {
public EntityAbilities Abilities { get; set; } = null!; get => _forgeEntity.Attributes;
public EventManager Events { get; set; } = null!; set => _forgeEntity.Attributes = value;
}
public EntityTags Tags
{
get => _forgeEntity.Tags;
set => _forgeEntity.Tags = value;
}
public EffectsManager EffectsManager
{
get => _forgeEntity.EffectsManager;
set => _forgeEntity.EffectsManager = value;
}
public EntityAbilities Abilities
{
get => _forgeEntity.Abilities;
set => _forgeEntity.Abilities = value;
}
public EventManager Events
{
get => _forgeEntity.Events;
set => _forgeEntity.Events = value;
}
// Private stuff // Private stuff
private Area3D _damageBox = null!; private Area3D _damageBox = null!;
internal Node3D _target = null!; internal Node3D _target = null!;
private Healthbar _healthbar = null!; private Healthbar _healthbar = null!;
private ForgeEntity _forgeEntity;
public override void _Ready() public override void _Ready()
{ {
@@ -84,20 +108,7 @@ public partial class Enemy : CharacterBody3D,
{ {
_damageBox = GetNode<Area3D>("DamageBox"); _damageBox = GetNode<Area3D>("DamageBox");
_target = GetNode<Node3D>("CTarget"); _target = GetNode<Node3D>("CTarget");
_forgeEntity = GetNode<ForgeEntity>("ForgeEntity");
// Forge stuff
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!;
var baseTags = new TagContainer(
forgeManager.TagsManager,
[
Tag.RequestTag(forgeManager.TagsManager, "character.enemy")
]);
Attributes = new EntityAttributes(new EnemyAttributeSet());
Tags = new EntityTags(baseTags);
EffectsManager = new EffectsManager(this, forgeManager.CuesManager);
Abilities = new(this);
Events = new();
CDamageable = (GetNode<Node>("CDamageable") as IDamageable)!; CDamageable = (GetNode<Node>("CDamageable") as IDamageable)!;
CMovement = (GetNode<Node>("CMovement") as IMoveable)!; CMovement = (GetNode<Node>("CMovement") as IMoveable)!;

View File

@@ -6,14 +6,34 @@
[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="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://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="ViewportTexture" id="ViewportTexture_ykkxn"] [sub_resource type="Resource" id="Resource_oj1ws"]
script = ExtResource("8_46wn3")
Default = 50
Max = 100
[sub_resource type="Resource" id="Resource_yk4hc"]
script = ExtResource("8_46wn3")
Default = 1
Min = 1
Max = 100
[sub_resource type="Resource" id="Resource_wxisp"]
script = ExtResource("8_46wn3")
Default = 2
Min = 1
Max = 100
[sub_resource type="ViewportTexture" id="ViewportTexture_hf6k8"]
viewport_path = NodePath("SubViewport") viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_jnv07"] [sub_resource type="Resource" id="Resource_jnv07"]
@@ -62,6 +82,20 @@ 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]
script = ExtResource("6_wxisp")
metadata/_custom_type_script = "uid://8uj04dfe8oql"
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntity" unique_id=1840910245]
script = ExtResource("7_2digf")
AttributeSetClass = "EnemyAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("8_46wn3")]({
"Health": SubResource("Resource_oj1ws"),
"Speed": SubResource("Resource_wxisp"),
"Strength": SubResource("Resource_yk4hc")
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="CHealth" type="Node" parent="." unique_id=1717035166] [node name="CHealth" type="Node" parent="." unique_id=1717035166]
script = ExtResource("4_ys4jv") script = ExtResource("4_ys4jv")
RHealth = ExtResource("2_ma2bq") RHealth = ExtResource("2_ma2bq")
@@ -69,7 +103,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_ykkxn") texture = SubResource("ViewportTexture_hf6k8")
[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")

View File

@@ -6,14 +6,34 @@
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://scenes/components/damage/RDamageModifier.cs" id="2_r3cnf"] [ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://scenes/components/damage/RDamageModifier.cs" id="2_r3cnf"]
[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="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://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="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://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="ViewportTexture" id="ViewportTexture_18xwy"] [sub_resource type="Resource" id="Resource_f22p3"]
script = ExtResource("7_x50ya")
Default = 100
Max = 100
[sub_resource type="Resource" id="Resource_yk4hc"]
script = ExtResource("7_x50ya")
Default = 1
Min = 1
Max = 100
[sub_resource type="Resource" id="Resource_x50ya"]
script = ExtResource("7_x50ya")
Default = 1
Min = 1
Max = 100
[sub_resource type="ViewportTexture" id="ViewportTexture_0mf3g"]
viewport_path = NodePath("SubViewport") viewport_path = NodePath("SubViewport")
[sub_resource type="Resource" id="Resource_qj0ob"] [sub_resource type="Resource" id="Resource_qj0ob"]
@@ -62,6 +82,20 @@ 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]
script = ExtResource("6_x50ya")
metadata/_custom_type_script = "uid://8uj04dfe8oql"
[node name="ForgeAttributeSet" type="Node" parent="ForgeEntity" unique_id=804252284]
script = ExtResource("6_yk4hc")
AttributeSetClass = "EnemyAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("7_x50ya")]({
"Health": SubResource("Resource_f22p3"),
"Speed": SubResource("Resource_x50ya"),
"Strength": SubResource("Resource_yk4hc")
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="CHealth" type="Node" parent="." unique_id=188153645] [node name="CHealth" type="Node" parent="." unique_id=188153645]
script = ExtResource("2_gsmti") script = ExtResource("2_gsmti")
RHealth = ExtResource("2_w4lm8") RHealth = ExtResource("2_w4lm8")
@@ -69,7 +103,7 @@ metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
[node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("7_18xwy")] [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) transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0)
texture = SubResource("ViewportTexture_18xwy") texture = SubResource("ViewportTexture_0mf3g")
[node name="CDamageable" type="Node" parent="." unique_id=1601518000] [node name="CDamageable" type="Node" parent="." unique_id=1601518000]
script = ExtResource("7_1tw73") script = ExtResource("7_1tw73")

View File

@@ -29,6 +29,8 @@
[ext_resource type="AudioStream" uid="uid://clfggn87oeg1s" path="res://scenes/player_controller/audio/InteractiveSFX.tres" id="9_jb43f"] [ext_resource type="AudioStream" uid="uid://clfggn87oeg1s" path="res://scenes/player_controller/audio/InteractiveSFX.tres" id="9_jb43f"]
[ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://inputs/base_mode/aim_pressed.tres" id="9_nob5r"] [ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://inputs/base_mode/aim_pressed.tres" id="9_nob5r"]
[ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://inputs/base_mode/jump.tres" id="10_4u7i3"] [ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://inputs/base_mode/jump.tres" id="10_4u7i3"]
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="10_pw5r7"]
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="11_2rkt1"]
[ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://inputs/base_mode/hit.tres" id="11_cresl"] [ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://inputs/base_mode/hit.tres" id="11_cresl"]
[ext_resource type="PackedScene" uid="uid://0ysqmqphq6mq" path="res://scenes/player_controller/components/head/head_system.tscn" id="11_rxwoh"] [ext_resource type="PackedScene" uid="uid://0ysqmqphq6mq" path="res://scenes/player_controller/components/head/head_system.tscn" id="11_rxwoh"]
[ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://inputs/base_mode/dash.tres" id="12_34snm"] [ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://inputs/base_mode/dash.tres" id="12_34snm"]
@@ -71,6 +73,28 @@ script = ExtResource("4_abfq8")
StartingHealth = 10.0 StartingHealth = 10.0
metadata/_custom_type_script = "uid://baiapod3csndf" metadata/_custom_type_script = "uid://baiapod3csndf"
[sub_resource type="Resource" id="Resource_u8yay"]
script = ExtResource("11_2rkt1")
Default = 100
Max = 100
[sub_resource type="Resource" id="Resource_uqalc"]
script = ExtResource("11_2rkt1")
Default = 100
Max = 100
[sub_resource type="Resource" id="Resource_cn5a8"]
script = ExtResource("11_2rkt1")
Default = 1
Min = 1
Max = 100
[sub_resource type="Resource" id="Resource_b0xmb"]
script = ExtResource("11_2rkt1")
Default = 1
Min = 1
Max = 100
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"] [sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
height = 1.7 height = 1.7
@@ -172,6 +196,17 @@ MinimumWallRunHorizontalSpeed = 8.0
WallRunAltitudeLossSpeed = 8.0 WallRunAltitudeLossSpeed = 8.0
WallRunSpeedThreshold = 1.0 WallRunSpeedThreshold = 1.0
[node name="PlayerAttributeSet" type="Node" parent="." unique_id=421846088]
script = ExtResource("10_pw5r7")
AttributeSetClass = "PlayerAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("11_2rkt1")]({
"Health": SubResource("Resource_u8yay"),
"Mana": SubResource("Resource_uqalc"),
"Speed": SubResource("Resource_cn5a8"),
"Strength": SubResource("Resource_b0xmb")
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="CHealth" parent="." unique_id=1244478698 instance=ExtResource("3_q7bng")] [node name="CHealth" parent="." unique_id=1244478698 instance=ExtResource("3_q7bng")]
RHealth = ExtResource("4_m8gvy") RHealth = ExtResource("4_m8gvy")

View File

@@ -2,6 +2,7 @@ using Godot;
using System; using System;
using Gamesmiths.Forge.Core; using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Cues; using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Godot.Core;
using Gamesmiths.Forge.Tags; using Gamesmiths.Forge.Tags;
using Movementtests.interfaces; using Movementtests.interfaces;
using Movementtests.tools; using Movementtests.tools;
@@ -38,9 +39,8 @@ public partial class PlayerUi : Control, ICueHandler
_healthbar = GetNode<Healthbar>("%Healthbar"); _healthbar = GetNode<Healthbar>("%Healthbar");
_manabar = GetNode<Healthbar>("%Manabar"); _manabar = GetNode<Healthbar>("%Manabar");
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!; var tagsManager = ForgeManagers.Instance.TagsManager;
var tagsManager = forgeManager.TagsManager; var cuesManager = ForgeManagers.Instance.CuesManager;
var cuesManager = forgeManager.CuesManager;
cuesManager.RegisterCue(Tag.RequestTag(tagsManager, "cues.resources.mana"), this); cuesManager.RegisterCue(Tag.RequestTag(tagsManager, "cues.resources.mana"), this);
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Gamesmiths.Forge.Abilities; using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Attributes;
using Gamesmiths.Forge.Core; using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects; using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Calculator; using Gamesmiths.Forge.Effects.Calculator;
@@ -9,6 +10,9 @@ using Gamesmiths.Forge.Effects.Duration;
using Gamesmiths.Forge.Effects.Magnitudes; using Gamesmiths.Forge.Effects.Magnitudes;
using Gamesmiths.Forge.Effects.Periodic; using Gamesmiths.Forge.Effects.Periodic;
using Gamesmiths.Forge.Events; using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Core;
using Gamesmiths.Forge.Godot.Nodes;
using Gamesmiths.Forge.Godot.Resources;
using Gamesmiths.Forge.Tags; using Gamesmiths.Forge.Tags;
using Godot; using Godot;
using GodotStateCharts; using GodotStateCharts;
@@ -46,6 +50,10 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
[Signal] [Signal]
public delegate void WeaponRetrievedEventHandler(); public delegate void WeaponRetrievedEventHandler();
[Export]
public ForgeTagContainer BaseTags { get; set; } = new();
[Export] [Export]
public RDamage RDamage { get; set; } public RDamage RDamage { get; set; }
[Export(PropertyHint.Range, "0,100,1,or_greater")] [Export(PropertyHint.Range, "0,100,1,or_greater")]
@@ -128,8 +136,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
Visible = false; Visible = false;
// Forge // Forge
var tagsManager = ForgeManager.GetTagsManager(this); var tagsManager = ForgeManagers.Instance.TagsManager;
var cuesManager = ForgeManager.GetCuesManager(this); var cuesManager = ForgeManagers.Instance.CuesManager;
WeaponFlyingTickEventTag = Tag.RequestTag(tagsManager, "events.weapon.flyingTick"); WeaponFlyingTickEventTag = Tag.RequestTag(tagsManager, "events.weapon.flyingTick");
WeaponStartedFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.startedFlying"); WeaponStartedFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.startedFlying");
@@ -140,20 +148,28 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
WeaponPlantedToFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.plantedToFlying"); WeaponPlantedToFlyingEventTag = Tag.RequestTag(tagsManager, "events.weapon.plantedToFlying");
WeaponPlantedEventTag = Tag.RequestTag(tagsManager, "events.weapon.planted"); WeaponPlantedEventTag = Tag.RequestTag(tagsManager, "events.weapon.planted");
WeaponInHandStatusTag = Tag.RequestTag(tagsManager, "status.weapon.inHand"); // WeaponInHandStatusTag = Tag.RequestTag(tagsManager, "status.weapon.inHand");
WeaponFlyingStatusTag = Tag.RequestTag(tagsManager, "status.weapon.flying"); // WeaponFlyingStatusTag = Tag.RequestTag(tagsManager, "status.weapon.flying");
WeaponPlantedStatusTag = Tag.RequestTag(tagsManager, "status.weapon.planted"); // WeaponPlantedStatusTag = Tag.RequestTag(tagsManager, "status.weapon.planted");
WeaponFlyingAbilityTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying"); WeaponFlyingAbilityTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying");
var baseTags = new TagContainer( List<AttributeSet> attributeSetList = [];
tagsManager, foreach (Node node in GetChildren())
[ {
Tag.RequestTag(tagsManager, "weapon"), if (node is ForgeAttributeSet attributeSetNode)
]); {
AttributeSet? attributeSet = attributeSetNode.GetAttributeSet();
if (attributeSet is not null)
{
attributeSetList.Add(attributeSet);
}
}
}
Attributes = new EntityAttributes([.. attributeSetList]);
Attributes = new EntityAttributes(new WeaponAttributeSet()); Tags = new(BaseTags.GetTagContainer());
Tags = new EntityTags(baseTags);
EffectsManager = new EffectsManager(this, cuesManager); EffectsManager = new EffectsManager(this, cuesManager);
Abilities = new(this); Abilities = new(this);
Events = new(); Events = new();
@@ -242,9 +258,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
Events.Subscribe<WeaponEventPayload>(WeaponStoppedFlyingEventTag, data => Events.Subscribe<WeaponEventPayload>(WeaponStoppedFlyingEventTag, data =>
{ {
GD.Print("This is removing the periodic effect to the flying weapon"); _weaponFlyingAbility.Cancel();
GD.Print(data.Payload.Message);
if (_flyingWeaponEffectHandle is { IsValid: true }) EffectsManager.RemoveEffect(_flyingWeaponEffectHandle);
}); });
} }
private ActiveEffectHandle? _flyingWeaponEffectHandle; private ActiveEffectHandle? _flyingWeaponEffectHandle;
@@ -266,15 +280,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(), abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(),
instancingPolicy: AbilityInstancingPolicy.PerEntity, instancingPolicy: AbilityInstancingPolicy.PerEntity,
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponStartedFlyingEventTag), abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponStartedFlyingEventTag),
behaviorFactory: () => new ClosureBehavior<WeaponEventPayload>((ctx, payload) => behaviorFactory: () => new FlyingSwordBehavior(this, flyingWeaponEffectData));
{ _weaponFlyingAbility = Abilities.GrantAbilityPermanently(weaponHandToFlyingAbilityData, 1, LevelComparison.None, this);
GD.Print("This is applying the periodic effect to the flying weapon");
GD.Print(payload.Message);
_flyingWeaponEffectHandle = EffectsManager.ApplyEffect(new Effect(flyingWeaponEffectData, new EffectOwnership(this, this)));
}));
Abilities.GrantAbilityPermanently(weaponHandToFlyingAbilityData, 1, LevelComparison.None, this);
} }
private AbilityHandle _weaponFlyingAbility;
public void GrantNewAbilityForWeaponFly(RExplodingSword ability) public void GrantNewAbilityForWeaponFly(RExplodingSword ability)
{ {
var weaponFlyingAbilityData = new AbilityData( var weaponFlyingAbilityData = new AbilityData(

View File

@@ -2,8 +2,10 @@
[ext_resource type="Script" uid="uid://iii3wfto4t5b" path="res://scenes/player_controller/components/weapon/WeaponSystem.cs" id="1_csqwk"] [ext_resource type="Script" uid="uid://iii3wfto4t5b" path="res://scenes/player_controller/components/weapon/WeaponSystem.cs" id="1_csqwk"]
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="2_m0v1h"] [ext_resource type="Script" uid="uid://jitubgv6judn" path="res://scenes/components/damage/RDamage.cs" id="2_m0v1h"]
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="3_3xjpi"]
[ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="3_5owyf"] [ext_resource type="Script" uid="uid://couw105c3bde4" path="res://addons/godot_state_charts/state_chart.gd" id="3_5owyf"]
[ext_resource type="ArrayMesh" uid="uid://cho5fixitrbds" path="res://assets/meshes/swords/resources/sword23.tres" id="3_svc06"] [ext_resource type="ArrayMesh" uid="uid://cho5fixitrbds" path="res://assets/meshes/swords/resources/sword23.tres" id="3_svc06"]
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="4_q6xv7"]
[ext_resource type="Script" uid="uid://jk2jm1g6q853" path="res://addons/godot_state_charts/compound_state.gd" id="4_svc06"] [ext_resource type="Script" uid="uid://jk2jm1g6q853" path="res://addons/godot_state_charts/compound_state.gd" id="4_svc06"]
[ext_resource type="Script" uid="uid://cytafq8i1y8qm" path="res://addons/godot_state_charts/atomic_state.gd" id="5_m0v1h"] [ext_resource type="Script" uid="uid://cytafq8i1y8qm" path="res://addons/godot_state_charts/atomic_state.gd" id="5_m0v1h"]
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="6_jpdh0"] [ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="6_jpdh0"]
@@ -13,6 +15,12 @@ script = ExtResource("2_m0v1h")
DamageDealt = 2.0 DamageDealt = 2.0
metadata/_custom_type_script = "uid://jitubgv6judn" metadata/_custom_type_script = "uid://jitubgv6judn"
[sub_resource type="Resource" id="Resource_pgbtr"]
script = ExtResource("4_q6xv7")
Default = 1
Min = 1
Max = 100
[sub_resource type="CylinderShape3D" id="CylinderShape3D_avini"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_avini"]
height = 1.0 height = 1.0
radius = 0.1 radius = 0.1
@@ -50,6 +58,14 @@ max_contacts_reported = 1
script = ExtResource("1_csqwk") script = ExtResource("1_csqwk")
RDamage = SubResource("Resource_jpdh0") RDamage = SubResource("Resource_jpdh0")
[node name="WeaponAttributeSet" type="Node" parent="." unique_id=14845649]
script = ExtResource("3_3xjpi")
AttributeSetClass = "WeaponAttributeSet"
InitialAttributeValues = Dictionary[String, ExtResource("4_q6xv7")]({
"Level": SubResource("Resource_pgbtr")
})
metadata/_custom_type_script = "uid://cxihb42t2mfqi"
[node name="WeaponFlyingTick" type="Timer" parent="." unique_id=656309486] [node name="WeaponFlyingTick" type="Timer" parent="." unique_id=656309486]
wait_time = 0.2 wait_time = 0.2

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Gamesmiths.Forge.Abilities; using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Attributes;
using Gamesmiths.Forge.Core; using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects; using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Calculator; using Gamesmiths.Forge.Effects.Calculator;
@@ -10,6 +11,9 @@ using Gamesmiths.Forge.Effects.Magnitudes;
using Gamesmiths.Forge.Effects.Modifiers; using Gamesmiths.Forge.Effects.Modifiers;
using Gamesmiths.Forge.Effects.Periodic; using Gamesmiths.Forge.Effects.Periodic;
using Gamesmiths.Forge.Events; using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Core;
using Gamesmiths.Forge.Godot.Nodes;
using Gamesmiths.Forge.Godot.Resources;
using Gamesmiths.Forge.Godot.Resources.Abilities; using Gamesmiths.Forge.Godot.Resources.Abilities;
using Gamesmiths.Forge.Tags; using Gamesmiths.Forge.Tags;
@@ -108,6 +112,8 @@ public partial class PlayerController : CharacterBody3D,
// Forge stuff // Forge stuff
[ExportCategory("Forge")] [ExportCategory("Forge")]
[ExportGroup("General")] [ExportGroup("General")]
[Export]
public ForgeTagContainer BaseTags { get; set; } = new();
[Export] public REmpoweredAction EmpoweredAction = null!; [Export] public REmpoweredAction EmpoweredAction = null!;
[Export] public RManaRegen ManaRegen = null!; [Export] public RManaRegen ManaRegen = null!;
@@ -441,16 +447,24 @@ public partial class PlayerController : CharacterBody3D,
_aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f); _aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f);
// Forge stuff // Forge stuff
var tagsManager = ForgeManager.GetTagsManager(this); var tagsManager = ForgeManagers.Instance.TagsManager;
var cuesManager = ForgeManager.GetCuesManager(this); var cuesManager = ForgeManagers.Instance.CuesManager;
var baseTags = new TagContainer(
tagsManager, List<AttributeSet> attributeSetList = [];
[ foreach (Node node in GetChildren())
Tag.RequestTag(tagsManager, "character.player") {
]); if (node is ForgeAttributeSet attributeSetNode)
{
AttributeSet? attributeSet = attributeSetNode.GetAttributeSet();
Attributes = new EntityAttributes(new PlayerAttributeSet()); if (attributeSet is not null)
Tags = new EntityTags(baseTags); {
attributeSetList.Add(attributeSet);
}
}
}
Attributes = new EntityAttributes([.. attributeSetList]);
Tags = new(BaseTags.GetTagContainer());
EffectsManager = new EffectsManager(this, cuesManager); EffectsManager = new EffectsManager(this, cuesManager);
Abilities = new(this); Abilities = new(this);
Events = new(); Events = new();
@@ -466,11 +480,6 @@ public partial class PlayerController : CharacterBody3D,
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(tagsManager), new EffectOwnership(this, this)); var manaRegenEffect = new Effect(ManaRegen.ManaRegen(tagsManager), new EffectOwnership(this, this));
_manaRegenEffectHandle = EffectsManager.ApplyEffect(manaRegenEffect); _manaRegenEffectHandle = EffectsManager.ApplyEffect(manaRegenEffect);
var health = Attributes["PlayerAttributeSet.Health"].CurrentValue; // 100
var mana = Attributes["PlayerAttributeSet.Mana"].CurrentValue; // 100
var strength = Attributes["PlayerAttributeSet.Strength"].CurrentValue; // 10
var speed = Attributes["PlayerAttributeSet.Speed"].CurrentValue; // 5
// DashIndicator = GetNode<TextureRect>("%DashIndicator"); // DashIndicator = GetNode<TextureRect>("%DashIndicator");
PowerCooldownIndicator = GetNode<ColorRect>("%DashCooldownIndicator"); PowerCooldownIndicator = GetNode<ColorRect>("%DashCooldownIndicator");
PowerCooldownIndicator.Visible = false; PowerCooldownIndicator.Visible = false;
@@ -757,7 +766,7 @@ public partial class PlayerController : CharacterBody3D,
{ {
var target = data.Target; var target = data.Target;
var tagsManager = ForgeManager.GetTagsManager(this); var tagsManager = ForgeManagers.Instance.TagsManager;
var weaponLeftTag = Tag.RequestTag(tagsManager, "abilities.weapon.left").GetSingleTagContainer(); var weaponLeftTag = Tag.RequestTag(tagsManager, "abilities.weapon.left").GetSingleTagContainer();
if (weaponLeftTag == null) return; if (weaponLeftTag == null) return;
Abilities.TryActivateAbilitiesByTag(weaponLeftTag, target, out var landedFailures); Abilities.TryActivateAbilitiesByTag(weaponLeftTag, target, out var landedFailures);
@@ -770,7 +779,7 @@ public partial class PlayerController : CharacterBody3D,
var magnitude = data.EventMagnitude; var magnitude = data.EventMagnitude;
var weaponLandPayload = data.Payload; var weaponLandPayload = data.Payload;
var tagsManager = ForgeManager.GetTagsManager(this); var tagsManager = ForgeManagers.Instance.TagsManager;
var weaponLandTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer(); var weaponLandTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer();
if (weaponLandTag == null) return; if (weaponLandTag == null) return;