diff --git a/scripts/scenes/battle_scene.gd b/scripts/scenes/battle_scene.gd index aab5c62..a67ab0a 100644 --- a/scripts/scenes/battle_scene.gd +++ b/scripts/scenes/battle_scene.gd @@ -6143,7 +6143,8 @@ func _draw_units() -> void: if selected_unit and not selection_frame_drawn: draw_arc(center, 29, 0.0, TAU, 48, Color(UI_OLD_BRONZE.r, UI_OLD_BRONZE.g, UI_OLD_BRONZE.b, 0.92), 3.0) - _draw_unit_nameplate(rect, _short_name(String(unit["name"]))) + if _should_draw_unit_nameplate(unit, selected_unit): + _draw_unit_nameplate(rect, _short_name(String(unit["name"]))) func _draw_target_selection_markers() -> void: @@ -6268,6 +6269,22 @@ func _draw_unit_nameplate(rect: Rect2, label: String) -> void: _draw_ink_text(font, label_rect.position + Vector2(0, 10), label, HORIZONTAL_ALIGNMENT_CENTER, label_rect.size.x, 9, UI_PARCHMENT_TEXT) +func _should_draw_unit_nameplate(unit: Dictionary, selected_unit: bool = false) -> bool: + if unit.is_empty(): + return false + if selected_unit: + return true + if str(unit.get("team", "")) == BattleState.TEAM_PLAYER: + return true + if not _is_generic_enemy_unit(unit): + return true + if state.is_inside(hover_cell): + var hovered_unit := state.get_unit_at(hover_cell) + if not hovered_unit.is_empty() and str(hovered_unit.get("id", "")) == str(unit.get("id", "")): + return true + return false + + func _draw_unit_hp_bar(rect: Rect2, hp_ratio: float) -> void: var bar_rect := _unit_hp_bar_rect(rect) _draw_generated_badge_panel( diff --git a/tools/smoke_visual_assets.gd b/tools/smoke_visual_assets.gd index 6a8458e..0d1e800 100644 --- a/tools/smoke_visual_assets.gd +++ b/tools/smoke_visual_assets.gd @@ -4790,6 +4790,18 @@ func _check_terrain_and_unit_presentation(failures: Array[String]) -> void: failures.append("enemy with officer_id should not be marked as generic") if scene._is_generic_enemy_unit({"team": "player", "officer_id": ""}): failures.append("player unit should not be marked as generic enemy") + scene.hover_cell = Vector2i(-1, -1) + if scene._should_draw_unit_nameplate(generic_enemy, false): + failures.append("generic enemy nameplates should stay hidden until hovered or selected") + var generic_enemy_pos: Vector2i = generic_enemy.get("pos", Vector2i(-1, -1)) + scene.hover_cell = generic_enemy_pos + if not scene._should_draw_unit_nameplate(generic_enemy, false): + failures.append("generic enemy nameplate should appear on hover for inspection") + scene.hover_cell = Vector2i(-1, -1) + if not scene._should_draw_unit_nameplate(named_officer, false): + failures.append("named officers should keep visible nameplates for command clarity") + if not scene._should_draw_unit_nameplate(generic_enemy, true): + failures.append("selected generic enemy should expose a nameplate") var enemy_modulate: Color = scene._unit_sprite_modulate(generic_enemy, false) if enemy_modulate.r < 0.99 or enemy_modulate.g < 0.99 or enemy_modulate.b < 0.99 or enemy_modulate.a < 0.97: failures.append("transparent enemy class sprite should render near its original colors")