Restore landing fade and missing event sounds

This commit is contained in:
Loïc Wisniewski 2026-08-31 18:15:37 +02:00
commit eb1615ab6b
10 changed files with 91 additions and 15 deletions

View file

@ -16,6 +16,8 @@ func _verify() -> void:
return _fail("Main.tscn did not load")
var main: Node = packed.instantiate()
root.add_child(main)
if main.get_node_or_null("FadeOverlay/FadeRect") == null:
return _fail("Main lost the atmosphere fade overlay")
for menu_name in MENUS:
var menu: Node = main.get_node_or_null("UI/%s" % menu_name)
if menu == null:
@ -26,6 +28,8 @@ func _verify() -> void:
% [menu_name, expected])
if menu.get_script() == null:
return _fail("%s has no owning script" % menu_name)
if menu.get_node_or_null("FadeOverlay") != null:
return _fail("%s incorrectly owns Main's atmosphere fade overlay" % menu_name)
var source: String = FileAccess.get_file_as_string(
"res://controllers/BuildController.gd")

View file

@ -2,8 +2,9 @@ extends SceneTree
# Headless test: run with
# godot --headless -s res://tests/test_sfx.gd
# Forgejo #146: a shot, a vessel dying and a structure coming down should be
# heard.
# Forgejo #146: shots and destruction should be heard. Enemy destruction and
# incoming narration are covered too, so visual events cannot silently miss
# the shared sound pool.
#
# The interesting failures here are not "no sound came out" - they are the
# ones a play-through would not reveal for weeks. A voice pool that runs dry
@ -16,7 +17,7 @@ extends SceneTree
# B. firing plays a shot, and it survives a fleet firing together - no
# voice is lost, none is left stuck
# C. a dying ship is heard, from a node that is freed on the same frame
# D. a destroyed structure is heard
# D. enemy and structure destruction are heard
# E. levels are in proportion: a shot fires constantly and a death happens
# once, so a shot must be the quieter of the two
# F. sound keeps working while a dialog has the game stopped (#128)
@ -116,8 +117,12 @@ func _process(delta: float) -> bool:
% [Sfx.VOICES * 3, Sfx.VOICES, busy])
# --- F. and a dialog does not silence it -----------------
for voice in _pool().get_children():
(voice as AudioStreamPlayer).stop()
var narration: Control = scene.get_node("UI/NarrationBanner")
narration.say("Everything stops but this.", "TEST")
if _sounding() == 0:
return _fail("a narration line appeared in silence")
if not paused:
return _fail("the dialog did not stop the game, so this proves nothing")
for voice in _pool().get_children():
@ -149,6 +154,19 @@ func _process(delta: float) -> bool:
return _fail("a vessel died in silence")
print("a vessel freed on the frame it dies is still heard")
# An enemy uses the same persistent pool. Its own node is freed on
# this frame too, so the call must happen before queue_free().
for voice in _pool().get_children():
(voice as AudioStreamPlayer).stop()
var enemy: Node2D = load("res://enemies/Enemy.tscn").instantiate()
scene.add_child(enemy)
enemy.take_damage(enemy.hp)
if not enemy.is_queued_for_deletion():
return _fail("the enemy was not destroyed")
if _sounding() == 0:
return _fail("an enemy vessel exploded in silence")
print("an enemy vessel explosion is heard")
# --- D. a structure ------------------------------------
for voice in _pool().get_children():
(voice as AudioStreamPlayer).stop()