using Cthangover.Core.Factories.Impls;
using Godot;
using Cthangover.Core.UI.Tool;
namespace Cthangover.Mods.Interface.Tool
{
///
/// Mod-aware TextureButton: resolves IconId through UIIconFactory at _Ready
/// and applies the result to TextureNormal. Allows tool buttons to reference
/// icons by logical ID that mods can override.
///
public partial class ButtonModIconLoader : TextureButton
{
///
/// Logical icon ID resolved through . Set in the editor
/// or via mod to reference a mod-overridable icon texture.
///
[Export] public string IconId { get; set; }
public override void _Ready()
{
if (string.IsNullOrEmpty(IconId))
return;
var texture = UIIconFactory.Instance.Get(IconId);
if (texture != null)
TextureNormal = texture;
}
}
}