rokojori_action_library/Runtime/Actions/ActionReference.cs

36 lines
670 B
C#
Raw Normal View History

2024-05-19 15:59:41 +00:00
using Godot;
2026-05-22 12:25:02 +00:00
using Rokojori.Extensions;
namespace Rokojori;
2024-05-19 15:59:41 +00:00
2026-05-22 12:25:02 +00:00
[RokojoriActionCoreExport]
[Tool][GlobalClass, Icon("res://addons/rokojori_action_library/Icons/ActionReference.svg")]
public partial class ActionReference : Action
{
[Export]
public Action referencedAction;
2025-12-18 10:29:54 +00:00
2026-05-22 12:25:02 +00:00
[ExportToolButton( "Set Reference Name" )]
public Callable setReferencedNameButton => Callable.From(
()=>
{
if ( referencedAction == null )
{
this.Name = "* (nothing)";
}
else
{
this.Name = "* " + referencedAction.Name;
}
2024-05-19 15:59:41 +00:00
}
2026-05-22 12:25:02 +00:00
);
protected override void _OnTrigger()
{
Action.TriggerSafe( referencedAction );
2024-05-19 15:59:41 +00:00
}
2026-05-22 12:25:02 +00:00
}
2024-05-19 15:59:41 +00:00