using Godot;

public partial class RobotDisplay : PanelContainer
{
	[Export] public RichTextLabel listItem;
	[Export] public RichTextLabel currentScript;
	[Signal]
	public delegate void OnRobotJumpToEventHandler(Robot robot);
	public Robot robot;

	public override void _Process(double delta)
	{
		string programName = robot.currentProgram ?? "";
		string status = $"{programName} | Heat {robot.heat:0}% | Maintenance {robot.maintenance:0}%";
		if (status != currentScript.Text)
		{
			currentScript.Text = status;
		}
	}

	public void OnJumpToClicked()
	{
		EmitSignal(SignalName.OnRobotJumpTo, robot);
	}
}
