fix #107: resolve syntax and logical errors in scene reference causing scene completion to not register

This commit is contained in:
betalars 2025-03-05 22:58:56 +01:00
parent 60edd018ab
commit b03469ba67
3 changed files with 9 additions and 4 deletions

View File

@ -230,6 +230,8 @@ func pick_cards(id: int, repeat: bool):
selection_state = CARDS selection_state = CARDS
else: else:
Scenes.end_current_sequence() Scenes.end_current_sequence()
#FIXME this workaround should be included in the Scene Manager.
get_parent().get_parent().get_parent().dnd = false
func play_scene(_id, _repeat): func play_scene(_id, _repeat):
pass pass

View File

@ -43,6 +43,7 @@ class_name Collectable_Ui
has_stage = false has_stage = false
get_viewport().gui_release_focus() get_viewport().gui_release_focus()
# FIXME needs to be outsourced to scene reference state
@export var collected: bool = false: @export var collected: bool = false:
set(set_collected): set(set_collected):
collected = set_collected collected = set_collected

View File

@ -2,6 +2,7 @@ extends Node
var sequence_actors:Array[Array] = [] var sequence_actors:Array[Array] = []
var started_sequences: int = 0 var started_sequences: int = 0
var completed_sequences: int = 2
var current_sequence: int = -1 var current_sequence: int = -1
var current_sequence_index: int = 0 var current_sequence_index: int = 0
@ -32,7 +33,7 @@ func start_sequence(index: id):
if State.pass_stage_to(sequence_actors[index][0].get_object()): if State.pass_stage_to(sequence_actors[index][0].get_object()):
sequence_actors[index][0].call(index) sequence_actors[index][0].call(index)
current_sequence = index current_sequence = index
started_sequences &= 1 << index started_sequences = started_sequences | (1 << index)
scene_starting.emit(current_sequence, is_sequence_repeating(index)) scene_starting.emit(current_sequence, is_sequence_repeating(index))
else: else:
push_error("Sequence could not be started.") push_error("Sequence could not be started.")
@ -57,9 +58,10 @@ func continue_sequence(former_actor: Object):
scene_continuing.emit(current_sequence, current_sequence_index, is_sequence_repeating(current_sequence)) scene_continuing.emit(current_sequence, current_sequence_index, is_sequence_repeating(current_sequence))
func end_current_sequence(): func end_current_sequence():
current_sequence = -1
current_sequence_index = 0
State.leave_stage(State.stage_list[0]) State.leave_stage(State.stage_list[0])
scene_finished.emit(current_sequence, is_sequence_repeating(current_sequence)) scene_finished.emit(current_sequence, is_sequence_repeating(current_sequence))
completed_sequences = completed_sequences | (1 << current_sequence)
current_sequence = -1
current_sequence_index = 0
func is_sequence_repeating(index: int) -> bool: return started_sequences && 1 << index > 0 func is_sequence_repeating(index: int) -> bool: return completed_sequences & (1 << index) > 0