Made a menu to select abilities and grant them (with a few hardcoded stuff)
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 26s
Create tag and build when new code gets to main / Export (push) Successful in 6m13s

This commit is contained in:
2026-04-19 11:37:55 +02:00
parent 9464fc7caa
commit 5a59d50be5
12 changed files with 164 additions and 114 deletions

View File

@@ -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 //