diff --git a/client/scripts/main.gd b/client/scripts/main.gd index 2914b4dfa..a68af9dd5 100644 --- a/client/scripts/main.gd +++ b/client/scripts/main.gd @@ -220,6 +220,8 @@ func _play_close_sound_events() -> void: func _play_recognition_chimes() -> void: var active_ids: Dictionary = {} for rec in GameState.pending_recognitions: + if not rec is Dictionary or not rec.has("entity_id"): + continue var eid: int = rec.entity_id active_ids[eid] = true if not _known_recognition_ids.has(eid): diff --git a/client/scripts/rendering/sound_indicator_renderer.gd b/client/scripts/rendering/sound_indicator_renderer.gd index 6dc0864ef..1ed633cbc 100644 --- a/client/scripts/rendering/sound_indicator_renderer.gd +++ b/client/scripts/rendering/sound_indicator_renderer.gd @@ -111,7 +111,7 @@ func _draw() -> void: else: alpha = lerpf(1.0, 0.0, (t - fade_start) / (FADE_DURATION / INDICATOR_LIFETIME)) - var color: Color = _color_for_type(ind.event_type) + var color: Color = color_for_type(ind.event_type) color.a = alpha * 0.9 _draw_arrow(edge_pt, dir, color) @@ -142,7 +142,7 @@ func _draw_arrow(pos: Vector2, dir: Vector2, color: Color) -> void: ## Map event type string → D-018 color category. -func _color_for_type(event_type: String) -> Color: +func color_for_type(event_type: String) -> Color: var et := event_type.to_lower() if et.contains("voice") or et.contains("speech") or et.contains("convers") or et.contains("talk"): return COLOR_VOICE diff --git a/client/tests/test_rendering.gd b/client/tests/test_rendering.gd index 4e4a760fe..100be1862 100644 --- a/client/tests/test_rendering.gd +++ b/client/tests/test_rendering.gd @@ -461,23 +461,23 @@ func test_sound_indicator_empty_update_preserves_existing() -> void: func test_sound_indicator_color_voice() -> void: var renderer := _make_sound_indicator_renderer() - assert_that(renderer._color_for_type("voice")).is_equal(SoundIndicatorRenderer.COLOR_VOICE) - assert_that(renderer._color_for_type("Voice")).is_equal(SoundIndicatorRenderer.COLOR_VOICE) - assert_that(renderer._color_for_type("speech")).is_equal(SoundIndicatorRenderer.COLOR_VOICE) + assert_that(renderer.color_for_type("voice")).is_equal(SoundIndicatorRenderer.COLOR_VOICE) + assert_that(renderer.color_for_type("Voice")).is_equal(SoundIndicatorRenderer.COLOR_VOICE) + assert_that(renderer.color_for_type("speech")).is_equal(SoundIndicatorRenderer.COLOR_VOICE) renderer.queue_free() func test_sound_indicator_color_danger() -> void: var renderer := _make_sound_indicator_renderer() - assert_that(renderer._color_for_type("Gunshot")).is_equal(SoundIndicatorRenderer.COLOR_DANGER) - assert_that(renderer._color_for_type("alert")).is_equal(SoundIndicatorRenderer.COLOR_DANGER) - assert_that(renderer._color_for_type("danger")).is_equal(SoundIndicatorRenderer.COLOR_DANGER) + assert_that(renderer.color_for_type("Gunshot")).is_equal(SoundIndicatorRenderer.COLOR_DANGER) + assert_that(renderer.color_for_type("alert")).is_equal(SoundIndicatorRenderer.COLOR_DANGER) + assert_that(renderer.color_for_type("danger")).is_equal(SoundIndicatorRenderer.COLOR_DANGER) renderer.queue_free() func test_sound_indicator_color_neutral_for_unknown() -> void: var renderer := _make_sound_indicator_renderer() - assert_that(renderer._color_for_type("Footstep")).is_equal(SoundIndicatorRenderer.COLOR_NEUTRAL) - assert_that(renderer._color_for_type("")).is_equal(SoundIndicatorRenderer.COLOR_NEUTRAL) - assert_that(renderer._color_for_type("Unknown")).is_equal(SoundIndicatorRenderer.COLOR_NEUTRAL) + assert_that(renderer.color_for_type("Footstep")).is_equal(SoundIndicatorRenderer.COLOR_NEUTRAL) + assert_that(renderer.color_for_type("")).is_equal(SoundIndicatorRenderer.COLOR_NEUTRAL) + assert_that(renderer.color_for_type("Unknown")).is_equal(SoundIndicatorRenderer.COLOR_NEUTRAL) renderer.queue_free() func test_sound_indicator_deduplicates_same_position() -> void: