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"]
[resource]
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 Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Components;
@@ -70,4 +71,25 @@ public class ExplodingSwordThrowBehavior<TPayload>(Node3D owner, PackedScene? ex
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"
"Forge Bootstrap"="*uid://ba8fquhtwu5mu"
GlobalHelpers="*uid://dqcm83o8e66a2"
ForgeManager="*uid://c75tpswl62eew"
[display]

View File

@@ -2,6 +2,8 @@ using System;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Core;
using Gamesmiths.Forge.Godot.Nodes;
using Gamesmiths.Forge.Tags;
using Godot;
using Movementtests.interfaces;
@@ -63,16 +65,38 @@ public partial class Enemy : CharacterBody3D,
set => CHealth.CurrentHealth = value;
}
public EntityAttributes Attributes { get; set; } = null!;
public EntityTags Tags { get; set; } = null!;
public EffectsManager EffectsManager { get; set; } = null!;
public EntityAbilities Abilities { get; set; } = null!;
public EventManager Events { get; set; } = null!;
// Perfectly forward the IForgeEntity interface to the ForgeEntity component
public EntityAttributes Attributes
{
get => _forgeEntity.Attributes;
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 Area3D _damageBox = null!;
internal Node3D _target = null!;
private Healthbar _healthbar = null!;
private ForgeEntity _forgeEntity;
public override void _Ready()
{
@@ -84,20 +108,7 @@ public partial class Enemy : CharacterBody3D,
{
_damageBox = GetNode<Area3D>("DamageBox");
_target = GetNode<Node3D>("CTarget");
// 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();
_forgeEntity = GetNode<ForgeEntity>("ForgeEntity");
CDamageable = (GetNode<Node>("CDamageable") as IDamageable)!;
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://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://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://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://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="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")
[sub_resource type="Resource" id="Resource_jnv07"]
@@ -62,6 +82,20 @@ RDamage = ExtResource("2_on7rt")
RKnockback = ExtResource("11_mpa2u")
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]
script = ExtResource("4_ys4jv")
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")]
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]
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="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="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="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="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="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"]
[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")
[sub_resource type="Resource" id="Resource_qj0ob"]
@@ -62,6 +82,20 @@ RDamage = ExtResource("2_bn56u")
RKnockback = ExtResource("11_8k3xb")
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]
script = ExtResource("2_gsmti")
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")]
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]
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="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="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="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"]
@@ -71,6 +73,28 @@ script = ExtResource("4_abfq8")
StartingHealth = 10.0
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"]
height = 1.7
@@ -172,6 +196,17 @@ MinimumWallRunHorizontalSpeed = 8.0
WallRunAltitudeLossSpeed = 8.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")]
RHealth = ExtResource("4_m8gvy")

View File

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

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Attributes;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Calculator;
@@ -9,6 +10,9 @@ using Gamesmiths.Forge.Effects.Duration;
using Gamesmiths.Forge.Effects.Magnitudes;
using Gamesmiths.Forge.Effects.Periodic;
using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Godot.Core;
using Gamesmiths.Forge.Godot.Nodes;
using Gamesmiths.Forge.Godot.Resources;
using Gamesmiths.Forge.Tags;
using Godot;
using GodotStateCharts;
@@ -46,6 +50,10 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
[Signal]
public delegate void WeaponRetrievedEventHandler();
[Export]
public ForgeTagContainer BaseTags { get; set; } = new();
[Export]
public RDamage RDamage { get; set; }
[Export(PropertyHint.Range, "0,100,1,or_greater")]
@@ -128,8 +136,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
Visible = false;
// Forge
var tagsManager = ForgeManager.GetTagsManager(this);
var cuesManager = ForgeManager.GetCuesManager(this);
var tagsManager = ForgeManagers.Instance.TagsManager;
var cuesManager = ForgeManagers.Instance.CuesManager;
WeaponFlyingTickEventTag = Tag.RequestTag(tagsManager, "events.weapon.flyingTick");
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");
WeaponPlantedEventTag = Tag.RequestTag(tagsManager, "events.weapon.planted");
WeaponInHandStatusTag = Tag.RequestTag(tagsManager, "status.weapon.inHand");
WeaponFlyingStatusTag = Tag.RequestTag(tagsManager, "status.weapon.flying");
WeaponPlantedStatusTag = Tag.RequestTag(tagsManager, "status.weapon.planted");
// WeaponInHandStatusTag = Tag.RequestTag(tagsManager, "status.weapon.inHand");
// WeaponFlyingStatusTag = Tag.RequestTag(tagsManager, "status.weapon.flying");
// WeaponPlantedStatusTag = Tag.RequestTag(tagsManager, "status.weapon.planted");
WeaponFlyingAbilityTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying");
var baseTags = new TagContainer(
tagsManager,
[
Tag.RequestTag(tagsManager, "weapon"),
]);
List<AttributeSet> attributeSetList = [];
foreach (Node node in GetChildren())
{
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 EntityTags(baseTags);
Tags = new(BaseTags.GetTagContainer());
EffectsManager = new EffectsManager(this, cuesManager);
Abilities = new(this);
Events = new();
@@ -242,9 +258,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
Events.Subscribe<WeaponEventPayload>(WeaponStoppedFlyingEventTag, data =>
{
GD.Print("This is removing the periodic effect to the flying weapon");
GD.Print(data.Payload.Message);
if (_flyingWeaponEffectHandle is { IsValid: true }) EffectsManager.RemoveEffect(_flyingWeaponEffectHandle);
_weaponFlyingAbility.Cancel();
});
}
private ActiveEffectHandle? _flyingWeaponEffectHandle;
@@ -266,15 +280,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(),
instancingPolicy: AbilityInstancingPolicy.PerEntity,
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponStartedFlyingEventTag),
behaviorFactory: () => new ClosureBehavior<WeaponEventPayload>((ctx, payload) =>
{
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);
behaviorFactory: () => new FlyingSwordBehavior(this, flyingWeaponEffectData));
_weaponFlyingAbility = Abilities.GrantAbilityPermanently(weaponHandToFlyingAbilityData, 1, LevelComparison.None, this);
}
private AbilityHandle _weaponFlyingAbility;
public void GrantNewAbilityForWeaponFly(RExplodingSword ability)
{
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://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="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://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"]
@@ -13,6 +15,12 @@ script = ExtResource("2_m0v1h")
DamageDealt = 2.0
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"]
height = 1.0
radius = 0.1
@@ -50,6 +58,14 @@ max_contacts_reported = 1
script = ExtResource("1_csqwk")
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]
wait_time = 0.2

View File

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