Made a menu to select abilities and grant them (with a few hardcoded stuff)
This commit is contained in:
@@ -120,8 +120,9 @@ public partial class PlayerController : CharacterBody3D,
|
||||
[ExportSubgroup("Common and defaults")]
|
||||
[Export] public ForgeAbilityData EmpoweredActionAbility = null!;
|
||||
[Export] public ForgeAbilityData[] DefaultPermanentAbilities = [];
|
||||
[ExportSubgroup("WeaponThrow")]
|
||||
[Export] public ForgeAbilityData[] AbilityLoadout = [];
|
||||
|
||||
[ExportSubgroup("WeaponThrow")] [Export]
|
||||
public ForgeAbilityBehavior WeaponExplosionBehavior;
|
||||
|
||||
[ExportGroup("Effects")]
|
||||
[ExportSubgroup("Common and defaults")]
|
||||
@@ -713,25 +714,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_attackDash.StateEntered += OnDashAttackStarted;
|
||||
_parryStandard.StateEntered += OnStandardParryStarted;
|
||||
_parryDash.StateEntered += OnDashParryStarted;
|
||||
|
||||
foreach (var weaponLandAbility in AbilityLoadout)
|
||||
{
|
||||
var leftGrantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponLandAbility.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 Left Ability",
|
||||
new DurationData(DurationType.Infinite),
|
||||
effectComponents: [leftGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
|
||||
}
|
||||
|
||||
// Forge events
|
||||
var weaponLeftToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
|
||||
var weaponLandedToken = WeaponSystem.Events.Subscribe(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
|
||||
@@ -746,7 +729,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
if (weaponLeftTag == null) return;
|
||||
Abilities.TryActivateAbilitiesByTag(weaponLeftTag, target, out var landedFailures);
|
||||
}
|
||||
|
||||
|
||||
public void OnWeaponLanded(EventData data)
|
||||
{
|
||||
var source = data.Source;
|
||||
@@ -763,6 +746,11 @@ public partial class PlayerController : CharacterBody3D,
|
||||
target,
|
||||
out var failures);
|
||||
}
|
||||
|
||||
public void GrantWeaponExplosionAbilityForEvent(WeaponSystem.WeaponEvent forEvent, string abilityName)
|
||||
{
|
||||
WeaponSystem.GrantNewAbilityForEvent(forEvent, WeaponExplosionBehavior);
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Settings & tutorial //
|
||||
|
||||
Reference in New Issue
Block a user