Moved the exploding sword forge object from the code only hardcoded stuff to the resource based stuff
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Gamesmiths.Forge.Attributes;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Effects.Calculator;
|
||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Modifiers;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Godot;
|
||||
using Movementtests.systems;
|
||||
|
||||
namespace Movementtests.tools.calculators;
|
||||
|
||||
|
||||
public class FlyingWeaponExecution(WeaponSystem weaponSystem) : CustomExecution
|
||||
{
|
||||
public override ModifierEvaluatedData[] EvaluateExecution(Effect effect, IForgeEntity target, EffectEvaluatedData? effectEvaluatedData)
|
||||
{
|
||||
GD.Print("Custom execution executed");
|
||||
weaponSystem.Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = weaponSystem.WeaponFlyingTickEventTag.GetSingleTagContainer()!,
|
||||
Source = weaponSystem,
|
||||
EventMagnitude = 12f,
|
||||
Payload = new WeaponEventPayload(Message: "flying")
|
||||
});
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
48
forge/calculators/ForgeRaiseEventTagExecution.cs
Normal file
48
forge/calculators/ForgeRaiseEventTagExecution.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Gamesmiths.Forge.Attributes;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Effects.Calculator;
|
||||
using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Modifiers;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Gamesmiths.Forge.Godot.Resources;
|
||||
using Gamesmiths.Forge.Godot.Resources.Calculators;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using Movementtests.systems;
|
||||
|
||||
namespace Movementtests.tools.calculators;
|
||||
|
||||
|
||||
public class FlyingWeaponExecution(TagContainer eventTags) : CustomExecution
|
||||
{
|
||||
public override ModifierEvaluatedData[] EvaluateExecution(Effect effect, IForgeEntity target, EffectEvaluatedData? effectEvaluatedData)
|
||||
{
|
||||
GD.Print("Custom execution executed");
|
||||
var owner = effect.Ownership.Owner;
|
||||
if (owner == null) return [];
|
||||
|
||||
owner.Events.Raise(new EventData
|
||||
{
|
||||
EventTags = eventTags,
|
||||
Source = owner,
|
||||
EventMagnitude = 12f
|
||||
});
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ForgeRaiseEventTagExecution : ForgeCustomExecution
|
||||
{
|
||||
[Export] ForgeTagContainer EventTags { get; set; } = new();
|
||||
|
||||
public override CustomExecution GetExecutionClass()
|
||||
{
|
||||
return new FlyingWeaponExecution(EventTags.GetTagContainer());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user