Skip to content

Nametags: Let a player show their own nametag - #308

Merged
Segfaultd merged 1 commit into
developfrom
nametag_self_visible
Oct 7, 2026
Merged

Segfaultd merged 1 commit into
developfrom
nametag_self_visible

Conversation

@Kheartz

@Kheartz Kheartz commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

A client script can now show the local player's own nametag: the same tag the others see over them, with any Nametags.setLabel line on their own id. Until now the only way was projecting it from Camera.capture(), which never matched the native style or occlusion.

  • Nametags.setSelfVisible(visible) / Nametags.isSelfVisible() set NameTagView::showSelf, next to showTags and showHealth.
  • The framework only holds the switch. The mod's draw pass decides how the local avatar's tag is drawn, as it already does for every other tag.

Default is off, so existing mods behave exactly as before.

Tested: HogwartsMP builds against it (nametag_self_visible) and draws the tag in game, checked by an automated QA run: off by default, on with a label, faded with the camera up close, off again. FrameworkTests 651/651.

Summary by CodeRabbit

  • New Features
    • Added scripting controls to show or hide your own nametag and check its visibility. By default, your own nametag remains hidden.

Nametags.setSelfVisible/isSelfVisible flip NameTagView::showSelf, off
by default. The mod's draw pass owns how the local avatar's tag is drawn.
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3d3c7c81-12dc-4b89-bba2-d155cbbb0f0f
📥 Commits

Reviewing files that changed from the base of the PR and between 9bcb95b and e944d18.

📒 Files selected for processing (3)
  • code/framework/src/external/imgui/widgets/nametag.h
  • code/framework/src/integrations/client/scripting/builtins/nametags.cpp
  • code/framework/src/integrations/client/scripting/builtins/nametags.h

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

Adds scripting methods to set and query local-player nametag visibility. The value is stored in NameTagView::showSelf, which defaults to false.

Changes

Local-player nametag visibility

Layer / File(s) Summary
Visibility state and scripting API
code/framework/src/external/imgui/widgets/nametag.h, code/framework/src/integrations/client/scripting/builtins/nametags.h, code/framework/src/integrations/client/scripting/builtins/nametags.cpp
Adds the showSelf state and declares, implements, and registers setSelfVisible and isSelfVisible. The setter reports an error if the argument is missing. The scripting metadata describes the methods and visibility setting.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Suggested reviewers: segfaultd

Merge Risk: ⚪ Minimal · up to e944d

This adds an opt-in switch for showing the local player's own nametag. It is off by default, so existing behavior is unchanged. No merge-blocking risk was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: allowing a player to show their own nametag.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the nametag glow,
And toggles what the scripts can show.
One call sets the local view,
One reads the setting through,
Then hops where hidden labels go.

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

@Segfaultd
Segfaultd merged commit 3f4b590 into develop Oct 7, 2026
6 checks passed
@Segfaultd
Segfaultd deleted the nametag_self_visible branch October 7, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants