24 lines
526 B
GDScript
24 lines
526 B
GDScript
@tool
|
|
|
|
extends TextureButton
|
|
|
|
@export var state_colors: Array
|
|
|
|
func _on_toggled(toggled_on): $frame.visible = toggled_on
|
|
func _enter_tree() -> void: $label.self_modulate = state_colors[state]
|
|
|
|
|
|
@export var state: int:
|
|
set(v):
|
|
v = 0 if v < 0 else v % state_colors.size()
|
|
state = v
|
|
if is_inside_tree():
|
|
$label.self_modulate = state_colors[v]
|
|
|
|
|
|
@export var show_functional: bool:
|
|
set(v):
|
|
show_functional = v
|
|
if is_inside_tree():
|
|
$pic_functional.visible = v
|