weapon display

This commit is contained in:
Rendo 2025-12-10 18:24:30 +05:00
commit 8fadd143c3
26 changed files with 491 additions and 46 deletions

View file

@ -0,0 +1,18 @@
extends Container
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