Chelimbalo/gui/weapon_display/weapon_display_indicator.gd
2025-12-10 19:35:43 +05:00

20 lines
559 B
GDScript

extends Container
class_name WeaponIndicator
const CURRENT_COLOR = Color("ffffff")
const NOT_CURRENT_COLOR = Color("d4d4d4")
@onready var texture: TextureRect = $Texture
@onready var button_mark: Label = $Mark
@export var lookup_slot: StringName
@export var lookup_action: StringName
func _ready():
button_mark.text = InputMap.get_action_description(lookup_action).left(1)
func set_weapon(resource: WeaponResource):
texture.texture = resource.preview
func set_current(current):
texture.self_modulate = CURRENT_COLOR if current else NOT_CURRENT_COLOR