Moved the exploding sword forge object from the code only hardcoded stuff to the resource based stuff
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user