Remove request cancellation and protect the final mother dialogue

This commit is contained in:
Codex
2026-10-30 12:49:18 +02:00
parent 2476242d27
commit aa45c6c0bd
9 changed files with 137 additions and 53 deletions
+56 -17
View File
@@ -17,7 +17,7 @@ func check_clocks(expected: String, context: String) -> void:
check(game.stage.mother_clock.text == expected, "Mother call duration " + context)
func click(id: String) -> void:
var gameplay := id in ["question", "cancel"]
var gameplay := id == "question"
for action in game.story.actions:
if action.id == id: gameplay = true
if gameplay: wait_for_speech()
@@ -145,6 +145,25 @@ func realtime_check() -> void:
game.qa_mode = true
print("PHONE_REALTIME complete")
func realtime_final_check() -> void:
start(2)
wait_for_speech()
at(float(game.story.timeline.hum)-0.5)
click("keys_search")
var finished_at: Array[float] = []
var record_final := func():
if game.running and game.heard[-1] == "hum": finished_at.append(game.elapsed)
game.voice.finished.connect(record_final)
await game.get_tree().create_timer(10.0).timeout
game.voice.finished.disconnect(record_final)
check(game.impacted and game.heard[-1] == "hum", "Real late Katya request ends with mother's final line")
check(finished_at.size() == 1, "Real final mother recording finishes without interruption")
if finished_at.size() == 1:
var gap := float(game.story.timeline.impact)-finished_at[0]
check(gap >= 5.0, "Real final line still leaves five seconds before explosion")
print("PHONE_FINAL_REALTIME gap=",gap)
check("keys_search_m" not in game.heard and not game.items.has("keys"), "Real deferred reply cannot replace final mother line")
func run(target: Node) -> void:
game = target
DirAccess.make_dir_recursive_absolute(directory())
@@ -292,11 +311,14 @@ func run(target: Node) -> void:
check(game.action_button("close_memory") != null, "Notebook opens from call screen")
click("close_memory")
click("keys_search")
check(game.cancel_button.disabled, "Cancellation cannot interrupt the spoken request")
game.cancel_task()
check(not game.busy.is_empty(), "Direct cancel rejected while speaking")
check(game.action_button("cancel") == null, "No change-answer control")
game.choose_action("lamp_search")
check(game.busy.get("id") == "keys_search", "Chosen request cannot be replaced while speaking")
at(game.speech_until + 0.1)
game.choose_action("lamp_search")
check(game.busy.get("id") == "keys_search" and not game.can_respond(), "Chosen request stays locked during the search")
at(game.reply_at + 0.01)
check(game.cancel_button.disabled, "Mother's answer cannot be interrupted")
check(not game.can_respond(), "Mother's answer cannot be interrupted by a choice")
at(game.busy_end + 0.12)
check(game.can_respond(), "Next choices enabled after response and task completion")
@@ -322,9 +344,8 @@ func run(target: Node) -> void:
perform("keys_search")
check(game.soundscape.history.any(func(cue): return cue.id == "keys"), "Key sound follows actual search")
click("lamp_search")
wait_for_speech()
click("cancel")
check(not game.soundscape.queue.any(func(cue): return cue.task), "Cancel discards pending action sounds")
at(float(game.story.timeline.hum) + 0.01)
check(not game.soundscape.queue.any(func(cue): return cue.task), "Final reaction discards pending action sounds")
# Every redial repeats the same external world, including the first call.
for number in range(1, 11):
start(number)
@@ -449,17 +470,34 @@ func run(target: Node) -> void:
at(92)
check(game.outcome == "landing", "Late frame resolves movement before impact")
# The final mother line always wins, including a request spoken by Katya
# at the boundary and a queued answer that would overlap the ending.
for number in range(2,11):
start(number)
wait_for_speech()
at(warning_at - 0.5)
click("keys_search")
check(game.stage.speaker == "Катя" and game.speech_until > warning_at, "Late Katya request crosses final cue: " + str(number))
at(warning_at + 0.01)
check(game.heard[-1] == "hum" and game.stage.speaker == "Мама", "Mother interrupts Katya at final cue: " + str(number))
check(game.busy.is_empty() and game.events.is_empty() and game.command_list.get_child_count() == 0, "Final sequence clears pending choices: " + str(number))
game.choose_action("speak_love")
game.say("here")
at(89.99)
check(game.heard[-1] == "hum" and game.heard.count("hum") == 1 and not game.can_respond(), "Nothing replaces the final line: " + str(number))
finish("flat")
check(not game.items.has("keys") and not game.facts.has("keys"), "Interrupted request grants nothing: " + str(number))
start(2)
wait_for_speech()
var search: Dictionary = game.story.actions.filter(func(action): return action.id == "keys_search")[0]
at(warning_at - game.action_duration(search) + game.voice_length(search.response)*0.5)
click("keys_search")
at(8)
click("cancel")
at(21)
check(not game.facts.has("keys") and not game.items.has("keys"), "Cancelled search grants nothing")
check(game.elapsed >= 21, "Cancellation never refunds time")
at(89)
click("keys_search")
check(game.reply_at < warning_at and game.busy_end > warning_at, "Mother reply would overlap the final cue")
at(game.reply_at + 0.01)
check(search.response not in game.heard, "Do not start a mother reply that cannot finish before the final phrase")
at(89.99)
check(game.heard[-1] == "hum" and not game.items.has("keys"), "Skipped reply cannot overtake final phrase or grant an item")
finish("flat")
check(not game.items.has("keys"), "Impact rejects unfinished search")
start(3)
perform("inner")
@@ -499,7 +537,7 @@ func run(target: Node) -> void:
# A late frame cannot complete a task after the impact. Old callbacks and
# popup buttons cannot apply a task twice.
start(10, 2)
at(82)
at(80)
click("safe")
at(92)
check(game.outcome == "flat" and not game.items.has("spare"), "Low-FPS deadline wins over pending safe")
@@ -586,6 +624,7 @@ func run(target: Node) -> void:
click("resume")
check(game.menu_screen.is_empty() and game.action_button("next") != null, "Menu returns to the completed call outcome")
game.qa_mode = true
await realtime_final_check()
if "--phone-real-time" in OS.get_cmdline_user_args():
await realtime_check()
var file := FileAccess.open(directory().path_join("phone-result.json"), FileAccess.WRITE)