extends Button

var weapon = null
var player = null
var started = false

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if !started: return
	
	$Sprite.texture = load("res://textures/weapons/inhands/" + weapon.id + ".png")
	
	if weapon.cooldown > 0:
		$Cooldown.visible = true
		$Cooldown.max_value = Global.weapons[weapon.id].recharge_time
		$Cooldown.value = weapon.cooldown
	else:
		$Cooldown.visible = false
		
	if player.current_weapon == weapon: modulate.v = 1.0
	else: modulate.v = 0.5
