removed editor granted weapon abilities and prepared granting abilites through an inventory
This commit is contained in:
@@ -188,7 +188,8 @@ MaxNumberOfEmpoweredActions = 3
|
||||
SimpleDashStrength = 18.0
|
||||
SimpleDashTime = 0.2
|
||||
AimedDashTime = 0.2
|
||||
PostDashSpeed = 30.0
|
||||
PostDashSpeed = 25.0
|
||||
TimeScaleAimInAir = 0.08
|
||||
SlamSpeed = 80.0
|
||||
FlatGroundSlideSpeedLossRate = 0.996
|
||||
GroundSlideJumpMultiplier = 0.1
|
||||
|
||||
@@ -41,13 +41,11 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
|
||||
[Export]
|
||||
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; }
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
[Export(PropertyHint.Range, "0,2,0.01,or_greater")]
|
||||
public float ThrowForce { get; set; } = 1f;
|
||||
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
|
||||
public float StraightThrowDuration { get; set; } = 0.1f;
|
||||
@@ -168,30 +166,6 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
// 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)));
|
||||
}
|
||||
|
||||
foreach (var effect in PermanentEffects)
|
||||
{
|
||||
EffectsManager.ApplyEffect(new Effect(effect.GetEffectData(), new EffectOwnership(this, this)));
|
||||
}
|
||||
|
||||
BodyEntered += OnThrownWeaponReachesGround;
|
||||
|
||||
InHandState.StateExited += WeaponLeft;
|
||||
@@ -263,13 +237,50 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
});
|
||||
};
|
||||
|
||||
Events.Subscribe(WeaponStoppedFlyingEventTag, data =>
|
||||
{
|
||||
// TODO: Waiting on bug resolve
|
||||
_weaponFlyingAbility.Cancel();
|
||||
});
|
||||
Events.Subscribe(WeaponStoppedFlyingEventTag, _ => { _weaponFlyingAbility.Cancel(); });
|
||||
}
|
||||
|
||||
private List<ActiveEffectHandle> _grantedWeaponStartedFlyingAbilities = new List<ActiveEffectHandle>();
|
||||
private List<ActiveEffectHandle> _grantedWeaponStoppedFlyingAbilities = new List<ActiveEffectHandle>();
|
||||
private List<ActiveEffectHandle> _grantedWeaponFlyingTickAbilities = new List<ActiveEffectHandle>();
|
||||
|
||||
public enum WeaponEvent
|
||||
{
|
||||
StartedFlying,
|
||||
StoppedFlying,
|
||||
FlyingTick
|
||||
}
|
||||
|
||||
public void GrantNewAbilityForEvent(WeaponEvent forEvent, ForgeAbilityData ability)
|
||||
{
|
||||
var abilitiesMap = new Dictionary<WeaponEvent, List<ActiveEffectHandle>>
|
||||
{
|
||||
{ WeaponEvent.StartedFlying, _grantedWeaponStartedFlyingAbilities },
|
||||
{ WeaponEvent.StoppedFlying, _grantedWeaponStoppedFlyingAbilities },
|
||||
{ WeaponEvent.FlyingTick, _grantedWeaponFlyingTickAbilities },
|
||||
};
|
||||
|
||||
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]);
|
||||
var effectHandle = EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
|
||||
if (effectHandle == null) return;
|
||||
|
||||
abilitiesMap[forEvent].Add(effectHandle);
|
||||
}
|
||||
|
||||
|
||||
public void WeaponLeft()
|
||||
{
|
||||
Visible = true;
|
||||
|
||||
Reference in New Issue
Block a user