actually calling update effects
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 30s
Create tag and build when new code gets to main / Export (push) Successful in 6m46s

This commit is contained in:
2026-04-14 19:29:43 +02:00
parent 7ab78aa57f
commit 585c2302d6
11 changed files with 58 additions and 40 deletions

View File

@@ -10,11 +10,13 @@ namespace Movementtests.forge.abilities;
public class EffectApplicationBehavior(EffectData effectData) : IAbilityBehavior
{
private Effect? _effect;
private ActiveEffectHandle? _effectHandle;
public void OnStarted(AbilityBehaviorContext context)
{
GD.Print("This is applying the periodic effect to the flying weapon");
_effectHandle = context.Owner.EffectsManager.ApplyEffect(new Effect(effectData, new EffectOwnership(context.Owner, context.Owner)));
_effect = new Effect(effectData, new EffectOwnership(context.Owner, context.Owner));
_effectHandle = context.Owner.EffectsManager.ApplyEffect(_effect);
context.AbilityHandle.CommitAbility();
}

View File

@@ -43,6 +43,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
public ForgeTagContainer BaseTags { get; set; }
[Export] public ForgeAbilityData[] WeaponAbilities { get; set; } = Array.Empty<ForgeAbilityData>();
[Export] public ForgeAbilityData FlyingTickAbility { get; set; }
[Export] public ForgeEffectData[] PermanentEffects { get; set; } = Array.Empty<ForgeEffectData>();
[Export]
public RDamage RDamage { get; set; }
@@ -186,6 +187,11 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
}
foreach (var effect in PermanentEffects)
{
EffectsManager.ApplyEffect(new Effect(effect.GetEffectData(), new EffectOwnership(this, this)));
}
BodyEntered += OnThrownWeaponReachesGround;
InHandState.StateExited += WeaponLeft;
@@ -382,9 +388,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
public override void _Process(double delta)
{
EffectsManager.UpdateEffects(delta);
if (!FlyingState.Active) return;
WeaponMesh.Rotation = new Vector3(WeaponMesh.Rotation.X, WeaponMesh.Rotation.Y + (float) delta * 100, WeaponMesh.Rotation.Z);
//GD.Print(Attributes["WeaponAttributeSet.Level"].CurrentValue);
//LookAt(GlobalTransform.Origin + LinearVelocity.Normalized(), Vector3.Up, false);
}

View File

@@ -0,0 +1,9 @@
[gd_resource type="Resource" script_class="ForgeEffectApplicationBehavior" format=3 uid="uid://1tmxayi3nygi"]
[ext_resource type="Resource" uid="uid://bvidrwyuoos4g" path="res://scenes/player_controller/resources/forge/raise_flying_tick_event_periodically.tres" id="1_hlq5f"]
[ext_resource type="Script" uid="uid://cl5hudinl1rex" path="res://forge/abilities/ForgeEffectApplicationBehavior.cs" id="2_f5qgs"]
[resource]
script = ExtResource("2_f5qgs")
EffectData = ExtResource("1_hlq5f")
metadata/_custom_type_script = "uid://cl5hudinl1rex"

View File

@@ -0,0 +1,34 @@
[gd_resource type="Resource" script_class="ForgeEffectData" format=3 uid="uid://bvidrwyuoos4g"]
[ext_resource type="Resource" uid="uid://oe2suroa1klj" path="res://scenes/player_controller/resources/forge/raise_flying_tick_event.tres" id="1_cd13a"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="2_yyxtw"]
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="3_skmyt"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="4_7ma6b"]
[sub_resource type="Resource" id="Resource_dgkld"]
script = ExtResource("2_yyxtw")
BaseValue = 1
[sub_resource type="Resource" id="Resource_1ften"]
script = ExtResource("3_skmyt")
BaseValue = 0.2
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
[sub_resource type="Resource" id="Resource_l278c"]
script = ExtResource("2_yyxtw")
BaseValue = 1
[resource]
script = ExtResource("4_7ma6b")
Name = "Call Flying Tick Event Periodically"
Modifiers = []
Components = []
Executions = Array[Object]([ExtResource("1_cd13a")])
DurationType = 1
HasPeriodicApplication = true
Period = SubResource("Resource_1ften")
ExecuteOnApplication = true
StackLimit = SubResource("Resource_l278c")
InitialStack = SubResource("Resource_dgkld")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"

View File

@@ -1,46 +1,9 @@
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://btnnpqann3ktp"]
[ext_resource type="Resource" uid="uid://oe2suroa1klj" path="res://scenes/player_controller/resources/forge/raise_flying_tick_event.tres" id="1_pdt6v"]
[ext_resource type="Resource" uid="uid://1tmxayi3nygi" path="res://scenes/player_controller/resources/forge/flying tick application ability behavior.tres" id="1_twa0w"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="1_vh0wp"]
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="2_xkoyb"]
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="3_j2gem"]
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="4_e2sm2"]
[ext_resource type="Script" uid="uid://cl5hudinl1rex" path="res://forge/abilities/ForgeEffectApplicationBehavior.cs" id="5_trglf"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="6_napws"]
[sub_resource type="Resource" id="Resource_dgkld"]
script = ExtResource("2_xkoyb")
BaseValue = 1
[sub_resource type="Resource" id="Resource_1ften"]
script = ExtResource("3_j2gem")
BaseValue = 0.2
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
[sub_resource type="Resource" id="Resource_l278c"]
script = ExtResource("2_xkoyb")
BaseValue = 1
[sub_resource type="Resource" id="Resource_esyoj"]
script = ExtResource("4_e2sm2")
Name = "Call Flying Tick Event Periodically"
Modifiers = []
Components = []
Executions = Array[Object]([ExtResource("1_pdt6v")])
DurationType = 1
HasPeriodicApplication = true
Period = SubResource("Resource_1ften")
ExecuteOnApplication = true
StackLimit = SubResource("Resource_l278c")
InitialStack = SubResource("Resource_dgkld")
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"
[sub_resource type="Resource" id="Resource_0xegy"]
script = ExtResource("5_trglf")
EffectData = SubResource("Resource_esyoj")
metadata/_custom_type_script = "uid://cl5hudinl1rex"
[sub_resource type="Resource" id="Resource_4aw8y"]
script = ExtResource("6_napws")
Tag = "events.weapon.startedflying"
@@ -49,8 +12,9 @@ metadata/_custom_type_script = "uid://dpakv7agvir6y"
[resource]
script = ExtResource("1_vh0wp")
Name = "Weapon Flying Tick"
RetriggerInstancedAbility = true
CooldownEffects = []
AbilityBehavior = SubResource("Resource_0xegy")
AbilityBehavior = ExtResource("1_twa0w")
TriggerSource = 1
TriggerTag = SubResource("Resource_4aw8y")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"