Moved the exploding sword forge object from the code only hardcoded stuff to the resource based stuff
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 24s
Create tag and build when new code gets to main / Export (push) Failing after 3m55s

This commit is contained in:
2026-04-04 12:06:48 +02:00
parent bfa1f251dd
commit 7a787a36d6
22 changed files with 365 additions and 272 deletions

View File

@@ -6,7 +6,6 @@
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="3_cb2lu"]
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://inputs/base_mode/base_mode.tres" id="3_cresl"]
[ext_resource type="PackedScene" uid="uid://c4ikbhojckpnc" path="res://scenes/components/health/CHealth.tscn" id="3_q7bng"]
[ext_resource type="Resource" uid="uid://cdxbwirfiaipi" path="res://scenes/player_controller/resources/forge/exploding_sword_throw.tres" id="4_11013"]
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="4_abfq8"]
[ext_resource type="Resource" uid="uid://bjyd801wvverk" path="res://scenes/player_controller/resources/player_health.tres" id="4_m8gvy"]
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
@@ -151,7 +150,6 @@ collision_mask = 272
script = ExtResource("1_poq2x")
EmpoweredActionUsed = SubResource("Resource_5gbhg")
EmpoweredActionAbility = ExtResource("10_2rkt1")
AbilityLoadout = [ExtResource("4_11013")]
DefaultPermanentEffects = [ExtResource("5_2rkt1")]
EmpoweredActionEffects = [ExtResource("6_u8yay")]
AimAssistStrength = 0.3

View File

@@ -13,6 +13,7 @@ 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;
using Godot;
using GodotStateCharts;
@@ -26,20 +27,6 @@ using Movementtests.tools.calculators;
namespace Movementtests.systems;
public record struct WeaponEventPayload(String Message);
public class ClosureBehavior<TPayload>(
Action<AbilityBehaviorContext, TPayload> callback) : IAbilityBehavior<TPayload>
{
public void OnStarted(AbilityBehaviorContext context, TPayload data)
{
callback(context, data);
context.InstanceHandle.End();
}
public void OnEnded(AbilityBehaviorContext context){}
}
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_sword.png")]
public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
@@ -50,9 +37,10 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
[Signal]
public delegate void WeaponRetrievedEventHandler();
[Export]
public ForgeTagContainer BaseTags { get; set; } = new();
[Export] public ForgeAbilityData[] WeaponAbilities { get; set; } = Array.Empty<ForgeAbilityData>();
[Export] public ForgeAbilityData FlyingTickAbility { get; set; } = new();
[Export]
public RDamage RDamage { get; set; }
@@ -107,6 +95,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
public Tag WeaponFlyingAbilityTag;
private AbilityHandle? _weaponFlyingAbility;
public void Init()
{
_weaponState = StateChart.Of(GetNode("StateChart"));
@@ -171,7 +161,27 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
Abilities = new(this);
Events = new();
CreateFlyingAbility();
// TODO: Waiting on bug resolve
// _weaponFlyingAbility = Abilities.GrantAbilityPermanently(FlyingTickAbility.GetAbilityData(), 1, LevelComparison.None, this);
foreach (var ability in WeaponAbilities)
{
var leftGrantAbilityConfig = new GrantAbilityConfig(
ability.GetAbilityData(),
ScalableLevel: new ScalableInt(1),
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
TryActivateOnGrant: false,
TryActivateOnEnable: false,
LevelOverridePolicy: LevelComparison.Higher);
var leftGrantComponent = new GrantAbilityEffectComponent([leftGrantAbilityConfig]);
var leftGrantEffect = new EffectData(
"Grant Weapon Ability",
new DurationData(DurationType.Infinite),
effectComponents: [leftGrantComponent]);
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
}
BodyEntered += OnThrownWeaponReachesGround;
@@ -180,136 +190,76 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
_handToFlying.Taken += () =>
{
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponHandToFlyingEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "handToFlying")
Source = this
});
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponStartedFlyingEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "startedFlying")
Source = this
});
};
_flyingToHand.Taken += () =>
{
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponFlyingToHandEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "flyingToHand")
Source = this
});
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponStoppedFlyingEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "stoppedFlying")
Source = this
});
};
_plantedToHand.Taken += () =>
{
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponPlantedToHandEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "plantedToHand")
Source = this
});
};
_plantedToFlying.Taken += () =>
{
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponPlantedToFlyingEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "plantedToFlying")
Source = this
});
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponStartedFlyingEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "startedFlying")
Source = this
});
};
_toPlanted.Taken += () =>
{
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponPlantedEventTag.GetSingleTagContainer()!,
Source = this,
Target = _plantedEntity,
Payload = new WeaponEventPayload(Message: "planted")
Target = _plantedEntity
});
Events.Raise(new EventData<WeaponEventPayload>
Events.Raise(new EventData
{
EventTags = WeaponStoppedFlyingEventTag.GetSingleTagContainer()!,
Source = this,
Payload = new WeaponEventPayload(Message: "stoppedFlying")
Source = this
});
};
Events.Subscribe<WeaponEventPayload>(WeaponStoppedFlyingEventTag, data =>
Events.Subscribe(WeaponStoppedFlyingEventTag, data =>
{
_weaponFlyingAbility.Cancel();
// TODO: Waiting on bug resolve
// _weaponFlyingAbility.Cancel();
});
}
private ActiveEffectHandle? _flyingWeaponEffectHandle;
public void CreateFlyingAbility()
{
var flyingWeaponEffectData = new EffectData(
"Flying Weapon Effect Data",
new DurationData(DurationType.Infinite),
customExecutions:
[
new FlyingWeaponExecution(this)
],
periodicData: new PeriodicData(new ScalableFloat(0.2f), false, PeriodInhibitionRemovedPolicy.ResetPeriod)
);
var weaponHandToFlyingAbilityData = new AbilityData(
name: "WeaponHandToFlyingSword",
abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(),
instancingPolicy: AbilityInstancingPolicy.PerEntity,
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponStartedFlyingEventTag),
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(
name: "WeaponFlyingSwordAbility",
abilityTags: WeaponFlyingAbilityTag.GetSingleTagContainer(),
instancingPolicy: AbilityInstancingPolicy.PerEntity,
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponEventPayload>(WeaponFlyingTickEventTag),
behaviorFactory: () => ability.Behavior(new ExplodingSwordCreation(this)));
var weaponFlyGrantAbilityConfig = new GrantAbilityConfig(
weaponFlyingAbilityData,
ScalableLevel: new ScalableInt(1),
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
TryActivateOnGrant: false,
TryActivateOnEnable: false,
LevelOverridePolicy: LevelComparison.Higher);
var weaponFlyGrantComponent = new GrantAbilityEffectComponent([weaponFlyGrantAbilityConfig]);
var weaponFlyGrantEffect = new EffectData(
"Grant Weapon Fly Ability",
new DurationData(DurationType.Infinite),
effectComponents: [weaponFlyGrantComponent]);
EffectsManager.ApplyEffect(new Effect(weaponFlyGrantEffect, new EffectOwnership(this, this)));
GD.Print("New weapon flight ability granted");
}
public void WeaponLeft()
{

View File

@@ -2,9 +2,12 @@
[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="Resource" uid="uid://cu0685gspk2fk" path="res://scenes/player_controller/resources/forge/exploding_sword_weapon_land.tres" id="2_pgbtr"]
[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="Resource" uid="uid://busdbvfi3jiic" path="res://scenes/player_controller/resources/forge/exploding_sword_weapon_left.tres" id="3_7bruw"]
[ext_resource type="ArrayMesh" uid="uid://cho5fixitrbds" path="res://assets/meshes/swords/resources/sword23.tres" id="3_svc06"]
[ext_resource type="Resource" uid="uid://btnnpqann3ktp" path="res://scenes/player_controller/resources/forge/weapon_flying_tick_ability.tres" id="4_7bruw"]
[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"]
@@ -56,6 +59,8 @@ continuous_cd = true
contact_monitor = true
max_contacts_reported = 1
script = ExtResource("1_csqwk")
WeaponAbilities = [ExtResource("2_pgbtr"), ExtResource("3_7bruw")]
FlyingTickAbility = ExtResource("4_7bruw")
RDamage = SubResource("Resource_jpdh0")
[node name="WeaponAttributeSet" type="Node" parent="." unique_id=14845649]

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="ForgeExplodingSwordBehavior" format=3 uid="uid://ifeavnlps7hy"]
[ext_resource type="PackedScene" uid="uid://duju3atqgltkg" path="res://scenes/explosion/explosion.tscn" id="1_mnals"]
[ext_resource type="Script" uid="uid://bnee6amtc2bhj" path="res://forge/abilities/ForgeExplodingSwordBehavior.cs" id="1_ot53g"]
[resource]
script = ExtResource("1_ot53g")
Explosion = ExtResource("1_mnals")

View File

@@ -1,10 +0,0 @@
[gd_resource type="Resource" script_class="RExplodingSword" format=3 uid="uid://cdxbwirfiaipi"]
[ext_resource type="PackedScene" uid="uid://duju3atqgltkg" path="res://scenes/explosion/explosion.tscn" id="1_aru71"]
[ext_resource type="Script" path="res://forge/abilities/RExplodingSword.cs" id="2_syk3q"]
[resource]
script = ExtResource("2_syk3q")
Explosion = ExtResource("1_aru71")
Cost = 10.0
metadata/_custom_type_script = "uid://rux15j7q78e8"

View File

@@ -0,0 +1,26 @@
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://bl0mng4kl1xy8"]
[ext_resource type="Resource" uid="uid://ifeavnlps7hy" path="res://scenes/player_controller/resources/forge/exploding_sword.tres" id="1_postf"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="2_km5rh"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="3_spdwn"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="4_cm86c"]
[sub_resource type="Resource" id="Resource_ixeut"]
script = ExtResource("2_km5rh")
ContainerTags = Array[String](["abilities.weapon.land"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_6c3kr"]
script = ExtResource("3_spdwn")
Tag = "events.weapon.flyingtick"
metadata/_custom_type_script = "uid://dpakv7agvir6y"
[resource]
script = ExtResource("4_cm86c")
Name = "Exploding Sword on Weapon Flight"
CooldownEffects = []
AbilityBehavior = ExtResource("1_postf")
TriggerSource = 1
TriggerTag = SubResource("Resource_6c3kr")
AbilityTags = SubResource("Resource_ixeut")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"

View File

@@ -0,0 +1,26 @@
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://cu0685gspk2fk"]
[ext_resource type="Resource" uid="uid://ifeavnlps7hy" path="res://scenes/player_controller/resources/forge/exploding_sword.tres" id="1_l4v7e"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="2_6c3kr"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="2_l4v7e"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="3_ixeut"]
[sub_resource type="Resource" id="Resource_ixeut"]
script = ExtResource("2_6c3kr")
ContainerTags = Array[String](["abilities.weapon.land"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_6c3kr"]
script = ExtResource("2_l4v7e")
Tag = "events.weapon.stoppedflying"
metadata/_custom_type_script = "uid://dpakv7agvir6y"
[resource]
script = ExtResource("3_ixeut")
Name = "Exploding Sword on Weapon Land"
CooldownEffects = []
AbilityBehavior = ExtResource("1_l4v7e")
TriggerSource = 1
TriggerTag = SubResource("Resource_6c3kr")
AbilityTags = SubResource("Resource_ixeut")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"

View File

@@ -0,0 +1,26 @@
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://busdbvfi3jiic"]
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="1_85dnt"]
[ext_resource type="Resource" uid="uid://ifeavnlps7hy" path="res://scenes/player_controller/resources/forge/exploding_sword.tres" id="1_m0rkb"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="2_u5iw7"]
[ext_resource type="Script" uid="uid://dpakv7agvir6y" path="res://addons/forge/resources/ForgeTag.cs" id="3_u5iw7"]
[sub_resource type="Resource" id="Resource_cjh4j"]
script = ExtResource("2_u5iw7")
ContainerTags = Array[String](["abilities.weapon.left"])
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
[sub_resource type="Resource" id="Resource_mtsda"]
script = ExtResource("3_u5iw7")
Tag = "events.weapon.startedflying"
metadata/_custom_type_script = "uid://dpakv7agvir6y"
[resource]
script = ExtResource("1_85dnt")
Name = "Exploding Sword on Weapon Left"
CooldownEffects = []
AbilityBehavior = ExtResource("1_m0rkb")
TriggerSource = 1
TriggerTag = SubResource("Resource_mtsda")
AbilityTags = SubResource("Resource_cjh4j")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"

View File

@@ -66,10 +66,10 @@ script = ExtResource("2_scapu")
Name = "Inhibit Player Mana Regen Temp"
Modifiers = []
Components = Array[Object]([SubResource("Resource_bi1d8")])
Executions = null
Executions = []
DurationType = 2
Duration = SubResource("Resource_exi3e")
StackLimit = SubResource("Resource_ijayu")
InitialStack = SubResource("Resource_1go02")
Cues = null
Cues = []
metadata/_custom_type_script = "uid://b83hf13nj37k3"

View File

@@ -0,0 +1,12 @@
[gd_resource type="Resource" script_class="ForgeRaiseEventTagExecution" format=3 uid="uid://oe2suroa1klj"]
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="1_iqjlm"]
[ext_resource type="Script" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="2_am2ak"]
[sub_resource type="Resource" id="Resource_sxbq4"]
script = ExtResource("1_iqjlm")
ContainerTags = Array[String](["events.weapon.flyingtick"])
[resource]
script = ExtResource("2_am2ak")
metadata/_custom_type_script = "uid://br7ut4lbau66w"

View File

@@ -0,0 +1,55 @@
[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="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")
Modifiers = null
Components = null
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 = null
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"
metadata/_custom_type_script = "uid://dpakv7agvir6y"
[resource]
script = ExtResource("1_vh0wp")
Name = "Weapon Flying Tick"
CooldownEffects = null
AbilityBehavior = SubResource("Resource_0xegy")
TriggerSource = 1
TriggerTag = SubResource("Resource_4aw8y")
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"

View File

@@ -1,9 +0,0 @@
[gd_resource type="Resource" script_class="RManaRegen" format=3 uid="uid://dtmhtlix2amme"]
[ext_resource type="Script" uid="uid://di04jvuqp0h7m" path="res://forge/effects/RManaRegen.cs" id="1_ecb1p"]
[resource]
script = ExtResource("1_ecb1p")
ManaRegenRate = 20.0
Frequency = 0.05
metadata/_custom_type_script = "uid://di04jvuqp0h7m"

View File

@@ -122,7 +122,7 @@ public partial class PlayerController : CharacterBody3D,
[Export] public ForgeAbilityData EmpoweredActionAbility = null!;
[Export] public ForgeAbilityData[] DefaultPermanentAbilities = [];
[ExportSubgroup("WeaponThrow")]
[Export] public RExplodingSword[] AbilityLoadout = [];
[Export] public ForgeAbilityData[] AbilityLoadout = [];
[ExportGroup("Effects")]
[ExportSubgroup("Common and defaults")]
@@ -747,9 +747,8 @@ public partial class PlayerController : CharacterBody3D,
foreach (var weaponLandAbility in AbilityLoadout)
{
var weaponLeftTag = Tag.RequestTag(tagsManager,"abilities.weapon.left").GetSingleTagContainer();
var leftGrantAbilityConfig = new GrantAbilityConfig(
weaponLandAbility.Ability(new ExplodingSwordCreation(WeaponSystem), weaponLeftTag),
weaponLandAbility.GetAbilityData(),
ScalableLevel: new ScalableInt(1),
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
@@ -763,32 +762,14 @@ public partial class PlayerController : CharacterBody3D,
new DurationData(DurationType.Infinite),
effectComponents: [leftGrantComponent]);
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
var weaponLandedTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer();
var landGrantAbilityConfig = new GrantAbilityConfig(
weaponLandAbility.Ability(new ExplodingSwordCreation(WeaponSystem), weaponLandedTag),
ScalableLevel: new ScalableInt(1),
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
TryActivateOnGrant: false,
TryActivateOnEnable: false,
LevelOverridePolicy: LevelComparison.Higher);
var landGrantComponent = new GrantAbilityEffectComponent([landGrantAbilityConfig]);
var landGrantEffect = new EffectData(
"Grant Weapon Land Ability",
new DurationData(DurationType.Infinite),
effectComponents: [landGrantComponent]);
EffectsManager.ApplyEffect(new Effect(landGrantEffect, new EffectOwnership(this, this)));
GetTree().CreateTimer(5).Timeout += () => WeaponSystem.GrantNewAbilityForWeaponFly(weaponLandAbility);
}
// GetTree().CreateTimer(5).Timeout += () => WeaponSystem.GrantNewAbilityForWeaponFly(weaponLandAbility);
// Forge events
var weaponLeftToken = WeaponSystem.Events.Subscribe<WeaponEventPayload>(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
var weaponLandedToken = WeaponSystem.Events.Subscribe<WeaponEventPayload>(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
}
public void OnWeaponLeft(EventData<WeaponEventPayload> data)
public void OnWeaponLeft(EventData data)
{
var target = data.Target;
@@ -798,7 +779,7 @@ public partial class PlayerController : CharacterBody3D,
Abilities.TryActivateAbilitiesByTag(weaponLeftTag, target, out var landedFailures);
}
public void OnWeaponLanded(EventData<WeaponEventPayload> data)
public void OnWeaponLanded(EventData data)
{
var source = data.Source;
var target = data.Target;