feat(client): #122 monologue display — multi-line, priority queue, 34 tests #49

Merged
jpmschweitzer merged 5 commits from client into main 2026-02-20 19:28:49 +01:00
2 changed files with 33 additions and 0 deletions
Showing only changes of commit b49d78ef6a - Show all commits
+30
View File
@@ -46,6 +46,36 @@ func test_stagger_timer_zero_on_init() -> void:
d.queue_free()
func test_show_monologue_with_empty_text_does_not_set_displaying() -> void:
# Empty text must be ignored — no visible slot created, no queue entry.
# Prevents ghost display nodes and stagger timer contamination.
var d = _make_display()
if d == null: return
d.show_monologue("", 5.0)
assert_int(d._visible.size()).is_equal(0)
assert_int(d._queue.size()).is_equal(0)
d.queue_free()
func test_empty_text_does_not_advance_stagger_timer() -> void:
var d = _make_display()
if d == null: return
d.show_monologue("", 5.0)
assert_float(d._next_fade_in_msec).is_equal(0.0)
d.queue_free()
func test_empty_text_when_slots_full_does_not_enqueue() -> void:
var d = _make_display()
if d == null: return
d._next_fade_in_msec = 0.0; d.show_monologue("A", 10.0)
d._next_fade_in_msec = 0.0; d.show_monologue("B", 10.0)
d._next_fade_in_msec = 0.0; d.show_monologue("C", 10.0)
d.show_monologue("", 5.0)
assert_int(d._queue.size()).is_equal(0)
d.queue_free()
# ---------------------------------------------------------------------------
# Single-line display
# ---------------------------------------------------------------------------
+3
View File
@@ -66,7 +66,10 @@ func _process(delta: float) -> void:
# Display a monologue line.
# priority: higher number = more important (default 2; urgent beats normal).
# is_urgent: visual flag — full opacity + elevated colour. Bloom deferred.
# Empty text is silently ignored — no slot created, no queue entry.
func show_monologue(text: String, duration: float, priority: int = 2, is_urgent: bool = false) -> void:
if text.is_empty():
return
var now := float(Time.get_ticks_msec())
if _visible.size() < MAX_VISIBLE and now >= _next_fade_in_msec:
_show_line(text, duration, priority, is_urgent)