Files
MovementTests/addons/forge/resources/statescript/resolvers/MagnitudeResolverResource.cs
Minimata 1d856fd937
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 5m42s
Replicated the weapon flying tick setup using resources
2026-04-07 16:32:26 +02:00

39 lines
1.1 KiB
C#

// Copyright © Gamesmiths Guild.
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Statescript;
using Gamesmiths.Forge.Statescript.Properties;
using Godot;
using ForgeNode = Gamesmiths.Forge.Statescript.Node;
namespace Gamesmiths.Forge.Godot.Resources.Statescript.Resolvers;
/// <summary>
/// Resolver resource that reads the ability activation magnitude from the <see cref="GraphContext.ActivationContext"/>
/// at runtime. Produces a <see langword="float"/> value.
/// </summary>
[Tool]
[GlobalClass]
public partial class MagnitudeResolverResource : StatescriptResolverResource
{
/// <inheritdoc/>
public override string ResolverTypeId => "Magnitude";
/// <inheritdoc/>
public override void BindInput(Graph graph, ForgeNode runtimeNode, string nodeId, byte index)
{
var propertyName = new StringKey($"__mag_{nodeId}_{index}");
graph.VariableDefinitions.DefineProperty(propertyName, new MagnitudeResolver());
runtimeNode.BindInput(index, propertyName);
}
/// <inheritdoc/>
public override IPropertyResolver BuildResolver(Graph graph)
{
return new MagnitudeResolver();
}
}