yow it's working or wat
This commit is contained in:
@@ -113,7 +113,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
[ExportGroup("Abilities")]
|
||||
[ExportSubgroup("WeaponThrow")]
|
||||
[Export] public RAbilityBase[] AbilityLoadout = [];
|
||||
[Export] public RExplodingSword[] AbilityLoadout = [];
|
||||
|
||||
// Combat stuff
|
||||
[ExportCategory("Combat")]
|
||||
@@ -712,93 +712,49 @@ 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(tagsManager, weaponLeftTag, WeaponSystem),
|
||||
// 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)));
|
||||
//
|
||||
// var weaponLandedTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer();
|
||||
// var landGrantAbilityConfig = new GrantAbilityConfig(
|
||||
// weaponLandAbility.Ability(tagsManager, weaponLandedTag, WeaponSystem),
|
||||
// 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)));
|
||||
//
|
||||
//////////////////////////////////////////////
|
||||
|
||||
var weaponFlyingTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying").GetSingleTagContainer();
|
||||
var weaponFlyingAbilityData = new AbilityData(
|
||||
name: "Exploding Flying Sword",
|
||||
abilityTags: weaponFlyingTag,
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
abilityTriggerData: AbilityTriggerData.ForEvent<WeaponFlyingPayload>(WeaponSystem.WeaponFlyingTickTag),
|
||||
behaviorFactory: () => new ExplodingSwordThrowBehavior<WeaponFlyingPayload>(WeaponSystem, Explosion));
|
||||
|
||||
var flyingGrantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponFlyingAbilityData,
|
||||
var weaponLeftTag = Tag.RequestTag(tagsManager,"abilities.weapon.left").GetSingleTagContainer();
|
||||
var leftGrantAbilityConfig = new GrantAbilityConfig(
|
||||
weaponLandAbility.Ability(new ExplodingSwordCreation(WeaponSystem), weaponLeftTag),
|
||||
ScalableLevel: new ScalableInt(1),
|
||||
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
|
||||
TryActivateOnGrant: false,
|
||||
TryActivateOnEnable: true,
|
||||
TryActivateOnEnable: false,
|
||||
LevelOverridePolicy: LevelComparison.Higher);
|
||||
|
||||
var flyingGrantComponent = new GrantAbilityEffectComponent([flyingGrantAbilityConfig]);
|
||||
var flyingGrantEffect = new EffectData(
|
||||
"Grant Weapon Flying Ability",
|
||||
var leftGrantComponent = new GrantAbilityEffectComponent([leftGrantAbilityConfig]);
|
||||
var leftGrantEffect = new EffectData(
|
||||
"Grant Weapon Left Ability",
|
||||
new DurationData(DurationType.Infinite),
|
||||
effectComponents: [flyingGrantComponent]
|
||||
);
|
||||
effectComponents: [leftGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(leftGrantEffect, new EffectOwnership(this, this)));
|
||||
|
||||
EffectsManager.ApplyEffect(new Effect(flyingGrantEffect, new EffectOwnership(this, this)));
|
||||
|
||||
flyingWeaponEffect = new EffectData(
|
||||
"Flying Weapon",
|
||||
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),
|
||||
customExecutions:
|
||||
[
|
||||
new FlyingWeaponExecution(WeaponSystem)
|
||||
],
|
||||
periodicData: new PeriodicData(new ScalableFloat(1f), false, PeriodInhibitionRemovedPolicy.ResetPeriod)
|
||||
);
|
||||
flyingWeaponEffectHandle = EffectsManager.ApplyEffect(new Effect(flyingWeaponEffect, new EffectOwnership(this, this)));
|
||||
flyingWeaponEffectHandle?.SetInhibit(true);
|
||||
effectComponents: [landGrantComponent]);
|
||||
EffectsManager.ApplyEffect(new Effect(landGrantEffect, new EffectOwnership(this, this)));
|
||||
|
||||
GetTree().CreateTimer(5).Timeout += () => WeaponSystem.GrantNewAbilityForWeaponFly(weaponLandAbility);
|
||||
}
|
||||
// Forge events
|
||||
var weaponLeftToken = WeaponSystem.Events.Subscribe<WeaponLeftPayload>(WeaponSystem.WeaponLeftTag, OnWeaponLeft);
|
||||
var weaponFlyingToken = WeaponSystem.Events.Subscribe<WeaponFlyingPayload>(WeaponSystem.WeaponFlyingTickTag, data => Events.Raise(data));
|
||||
var weaponLandedToken = WeaponSystem.Events.Subscribe<WeaponLandPayload>(WeaponSystem.WeaponLandTag, OnWeaponLanded);
|
||||
var weaponLeftToken = WeaponSystem.Events.Subscribe<WeaponEventPayload>(WeaponSystem.WeaponStartedFlyingEventTag, OnWeaponLeft);
|
||||
var weaponLandedToken = WeaponSystem.Events.Subscribe<WeaponEventPayload>(WeaponSystem.WeaponStoppedFlyingEventTag, OnWeaponLanded);
|
||||
}
|
||||
|
||||
private EffectData flyingWeaponEffect;
|
||||
private ActiveEffectHandle? flyingWeaponEffectHandle;
|
||||
|
||||
public void OnWeaponLeft(EventData<WeaponLeftPayload> data)
|
||||
public void OnWeaponLeft(EventData<WeaponEventPayload> data)
|
||||
{
|
||||
//flyingWeaponEffectHandle?.SetInhibit(false);
|
||||
|
||||
var target = data.Target;
|
||||
|
||||
var tagsManager = ForgeManager.GetTagsManager(this);
|
||||
@@ -807,10 +763,8 @@ public partial class PlayerController : CharacterBody3D,
|
||||
Abilities.TryActivateAbilitiesByTag(weaponLeftTag, target, out var landedFailures);
|
||||
}
|
||||
|
||||
public void OnWeaponLanded(EventData<WeaponLandPayload> data)
|
||||
public void OnWeaponLanded(EventData<WeaponEventPayload> data)
|
||||
{
|
||||
flyingWeaponEffectHandle?.SetInhibit(true);
|
||||
|
||||
var source = data.Source;
|
||||
var target = data.Target;
|
||||
var magnitude = data.EventMagnitude;
|
||||
|
||||
Reference in New Issue
Block a user