fix #187, also resolving hotfixes to prevent its occurrence. Was caused by postit selection state having one less option

This commit is contained in:
betalars 2025-06-04 13:58:53 +02:00
parent dd90f191fd
commit 3ef3647f45
1 changed files with 6 additions and 7 deletions

View File

@ -130,8 +130,6 @@ func _input(event):
if event.is_action_pressed("ui_accept"): if event.is_action_pressed("ui_accept"):
pick(curr_selection_id) pick(curr_selection_id)
elif event.is_action_pressed("skip"): elif event.is_action_pressed("skip"):
#FIXME resolve weird issues when animations are being skipped
return
$Meaning.stop() $Meaning.stop()
if selection_state == CARDS_SELECTED: if selection_state == CARDS_SELECTED:
picked_player.play("skip_pick", .1) picked_player.play("skip_pick", .1)
@ -184,14 +182,15 @@ func pick(id: int):
var winning_id var winning_id
print("Randomly selected card %s" % options[1].text) print("Randomly selected card %s" % options[1].text)
if not current_scene_id == Scenes.id.YOUTH_JUI_JUTSU: if not (current_scene_id == Scenes.id.YOUTH_JUI_JUTSU and selection_state == CARDS_SELECTED):
randomize() randomize()
# investigate if this fixes error on line 197 # investigate if this fixes error on line 197
winning_id = randi() % options.size()-1 winning_id = randi() % options.size() - ( 1 if selection_state == POSTS_SELECTED else 0)
else: else:
winning_id = 1 if id == 0 else 0 winning_id = 1 if id == 0 else 0
Steam.setAchievement("FIGHT_BACK") if Steamworks.has_initialized:
Steam.storeStats() Steam.setAchievement("FIGHT_BACK")
Steam.storeStats()
output.append(options.pop_at(winning_id)) output.append(options.pop_at(winning_id))
# FIXME: this causes a hickup when skippin the first animation # FIXME: this causes a hickup when skippin the first animation
@ -231,7 +230,7 @@ func transition():
func show_posts(): func show_posts():
for player:AnimationPlayer in anim_players: for player:AnimationPlayer in anim_players:
player.play("RESET") player.play("RESET")
await get_tree().create_timer(1).timeout await get_tree().create_timer(.5).timeout
selection_state = POSTS selection_state = POSTS