extends ProgressBar

var RemainingTime = 0
@export var column : int
@onready var LetterDisplay = $RichTextLabel
@onready var gameLogic = get_node("/root/Screen/GameLogic")
var letter = ""

func _process(delta: float) -> void:
	if RemainingTime > 0:
		RemainingTime -= delta
		value = max_value-RemainingTime
		LetterDisplay.text = letter
	if (RemainingTime <= 0 && letter != ""):
		gameLogic.freeInserters.append(self)
		gameLogic.busyInserters.erase(self)
		gameLogic.insertLetter(column, letter)
		letter = ""
		LetterDisplay.text = letter
		max_value = 1
		value = 0
