fix: card_board was unable to return a solid Array[Draggable]

This commit is contained in:
tiger tiger tiger 2026-05-06 15:40:50 +02:00
parent 6d72a09e1d
commit 06b06d8ada
8 changed files with 14 additions and 8 deletions

View File

@ -54,7 +54,7 @@ func _ready() -> void:
func set_line(line: StringName): func set_line(line: StringName):
subway.set_line(line) subway.set_line(line)
## One arrival and departure ## One arrival and departure
func cycle() -> void: func cycle() -> void:
await arrive() await arrive()

View File

@ -5,4 +5,4 @@ class_name Station
@export var train_labels : Dictionary[StringName,String] = {} @export var train_labels : Dictionary[StringName,String] = {}
func get_label(line: StringName, next_stop: Station) -> String: func get_label(line: StringName, next_stop: Station) -> String:
return train_labels.get(line+next_stop.name, line+next_stop.name) return train_labels.get(line+next_stop.name, line+next_stop.name)

View File

@ -19,4 +19,3 @@ func set_line(line : StringName):
$TrainModel/traun_hull.material_overlay = materials[line] $TrainModel/traun_hull.material_overlay = materials[line]
$TrainModel/LineLabelBack.text = line.to_upper() $TrainModel/LineLabelBack.text = line.to_upper()
$TrainModel/LineLabelFront.text = line.to_upper() $TrainModel/LineLabelFront.text = line.to_upper()

View File

@ -46,10 +46,10 @@ func start_room_async():
func play() -> String: func play() -> String:
for i in range(20): await get_tree().process_frame #HACK - can probably be removed for i in range(20): await get_tree().process_frame #HACK - can probably be removed
await get_ready_async() await get_ready_async()
await start_room_async() await start_room_async()
var next_room : StringName = await proceed var next_room : StringName = await proceed
prints("----------", "PROCEEDING", next_room, "--------------") prints("----------", "PROCEEDING", next_room, "--------------")
return next_room return next_room

View File

@ -545,15 +545,22 @@ var dropzone_size: Vector2:
var _selection_candidates : Array[Draggable]: var _selection_candidates : Array[Draggable]:
get: get:
match selection_state: match selection_state:
SelectionState.CARDS: return cards as Array[Draggable] SelectionState.CARDS:
SelectionState.STICKIES: return notes as Array[Draggable] return as_draggable(cards)
SelectionState.STICKIES:
return as_draggable(notes)
SelectionState.FREE: SelectionState.FREE:
print("switching from free selection to guided stickies selection") print("switching from free selection to guided stickies selection")
# Otherwise default to sticky selection # Otherwise default to sticky selection
selection_state = SelectionState.STICKIES selection_state = SelectionState.STICKIES
return notes as Array[Draggable] return as_draggable(notes)
func as_draggable(items : Array) -> Array[Draggable]:
var result : Array[Draggable] = []
for item in items:
result.append(item)
return result
# === Util === # === Util ===