Skip to content

Add 'Show Lifebars Only When Damaged' option#7085

Open
M3RT1N99 wants to merge 2 commits intoFAForever:developfrom
M3RT1N99:feature/lifebar-only-when-damaged
Open

Add 'Show Lifebars Only When Damaged' option#7085
M3RT1N99 wants to merge 2 commits intoFAForever:developfrom
M3RT1N99:feature/lifebar-only-when-damaged

Conversation

@M3RT1N99
Copy link
Copy Markdown
Contributor

@M3RT1N99 M3RT1N99 commented Apr 10, 2026

Summary

Adds a new HUD toggle "Show Lifebars Only When Damaged" that hides lifebars on units at full HP. Bars only appear once a unit has taken damage. Provides a noticeable FPS gain in dense crowds where most units are undamaged.

https://discord.com/channels/197033481883222026/1492294267492634674

Requires

FAForever/FA-Binary-Patches#151 — the binary patch that exposes the ui_LifebarOnlyDamaged ConVar that this option drives via ConExecute. Without that patch the option toggle is a no-op (the ConVar is unrecognised by the engine).

Changes

  • lua/options/options.lua — new toggle in the HUD section, key gui_lifebar_only_damaged, calls ConExecute("ui_LifebarOnlyDamaged " .. value) on apply
  • lua/ui/help/tooltips.lua — tooltip entry options_gui_lifebar_only_damaged with title + description LOC tags (matches the existing FAF pattern, e.g. options_show_attached_unit_lifebars)
  • loc/US/strings_db.luaOPTIONS_0287 (title) and OPTIONS_0288 (description) strings

Test plan

  • With the binary patch installed, toggle the new setting on — verify lifebars disappear for full-HP units
  • Damage a unit — verify its lifebar appears immediately
  • Heal back to full HP — verify lifebar disappears again
  • Toggle off — verify all lifebars come back (vanilla behaviour)
  • Hover over the option in settings — verify the tooltip shows the proper title and description, not the raw key fallback

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a graphics option "Show Lifebars Only When Damaged": when enabled, lifebars appear only after a unit takes damage and stay hidden for full‑HP units, reducing visual clutter and improving FPS in dense crowds.
    • Added an in‑game tooltip/help entry describing the option and its effect.

Adds a new HUD setting that hides lifebars on units at full HP. Bars
only appear once a unit has taken damage. Provides a noticeable FPS
gain in dense crowds where most units are undamaged.

Requires the matching binary patch (FAForever/FA-Binary-Patches#151)
which exposes the ui_LifebarOnlyDamaged ConVar this option drives via
ConExecute. Without that patch the option toggle is a no-op (the
ConVar is unrecognised).

- lua/options/options.lua: new toggle in the HUD section
- lua/ui/help/tooltips.lua: tooltip entry options_gui_lifebar_only_damaged
- loc/US/strings_db.lua: OPTIONS_0287 / OPTIONS_0288 strings

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1c6a3e24-a1a6-42c1-ac7e-77d212b8dbdf

📥 Commits

Reviewing files that changed from the base of the PR and between 039c310 and 1ae94e4.

📒 Files selected for processing (1)
  • loc/US/strings_db.lua
✅ Files skipped from review due to trivial changes (1)
  • loc/US/strings_db.lua

📝 Walkthrough

Walkthrough

Added a new UI toggle to show lifebars only after units take damage, plus its localization strings and a help tooltip describing the behavior and FPS impact.

Changes

Cohort / File(s) Summary
Lifebar Conditional Rendering
loc/US/strings_db.lua, lua/options/options.lua, lua/ui/help/tooltips.lua
Added localization strings OPTIONS_0287 and OPTIONS_0288, a new toggle option gui_lifebar_only_damaged (default 0) that runs ui_LifebarOnlyDamaged <value>, and a tooltip entry options_gui_lifebar_only_damaged with title/description.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • lL1l1

Poem

🐇 I hop in code with a cheerful nod,
Lifebars hide till the first struck sod,
Crowds breathe easy, frames gleam bright,
I nibble bugs by lantern light. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change—adding a new UI toggle option for conditional lifebar display.
Description check ✅ Passed The description comprehensively covers all required sections including a clear summary of changes, detailed implementation across three files, thorough test plan with checkmarks, and crucial context about the binary patch dependency. The checklist items are acknowledged, though changelog documentation was not explicitly mentioned as completed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@lua/options/options.lua`:
- Around line 994-995: The LOC tag OPTIONS_0287 is duplicated; change the title
LOC tag for the option with key 'gui_lifebar_only_damaged' to a new unique ID
(e.g., OPTIONS_0330) and update its paired tooltip LOC ID (e.g., OPTIONS_0331)
wherever referenced (the tooltip pair for the same option), then add those new
IDs and text entries to the strings_db locale file so the label and tooltip are
unique and won't overwrite the existing OPTIONS_0287 entry used by the
"Factories Default to Repeat Build" option.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e4083ba8-81d2-4308-b2d3-5d9707b46d4d

📥 Commits

Reviewing files that changed from the base of the PR and between 1d1530b and 039c310.

📒 Files selected for processing (3)
  • loc/US/strings_db.lua
  • lua/options/options.lua
  • lua/ui/help/tooltips.lua

Comment on lines +994 to +995
title = "<LOC OPTIONS_0287>Show Lifebars Only When Damaged",
key = 'gui_lifebar_only_damaged',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use unique LOC IDs; OPTIONS_0287 is already in use.

Line 994 reuses OPTIONS_0287, which is already referenced at Line 657 for Factories Default to Repeat Build. This will cause the existing option label to be overwritten/mislabeled once localization is updated.

💡 Suggested fix
-                title = "<LOC OPTIONS_0287>Show Lifebars Only When Damaged",
+                title = "<LOC OPTIONS_0330>Show Lifebars Only When Damaged",

Also update:

  • lua/ui/help/tooltips.lua to use new unique IDs for this tooltip pair.
  • loc/US/strings_db.lua to define the new IDs (for example OPTIONS_0330 / OPTIONS_0331).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
title = "<LOC OPTIONS_0287>Show Lifebars Only When Damaged",
key = 'gui_lifebar_only_damaged',
title = "<LOC OPTIONS_0330>Show Lifebars Only When Damaged",
key = 'gui_lifebar_only_damaged',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lua/options/options.lua` around lines 994 - 995, The LOC tag OPTIONS_0287 is
duplicated; change the title LOC tag for the option with key
'gui_lifebar_only_damaged' to a new unique ID (e.g., OPTIONS_0330) and update
its paired tooltip LOC ID (e.g., OPTIONS_0331) wherever referenced (the tooltip
pair for the same option), then add those new IDs and text entries to the
strings_db locale file so the label and tooltip are unique and won't overwrite
the existing OPTIONS_0287 entry used by the "Factories Default to Repeat Build"
option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant