Skip to content

fix(entity): keep variant fields a metadata update leaves out - #70

Merged
notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/partial-variant
Nov 6, 2026
Merged

notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/partial-variant

Conversation

@NaySurGithub

Copy link
Copy Markdown
Contributor

Problem

On a Hive hub, every game hologram switches to Build Battle a few seconds after joining. For example, the Sky Solo NPC shows "Build Battle" above it.

Cause

The holograms (hivehub:game_hologram) pick their name texture with query.mark_variant, and index 0 is Build Battle. The server sends the right MARK_VARIANT in add_entity. Its later player-count updates (set_entity_data, every ~5 s) only carry VARIANT.

ApplyMetadata then called:

tracker.SetVariant(rid, std::max(variant, 0), std::max(mark, 0), std::max(color, 0));

Every field the packet left out was still at its -1 sentinel, so max(-1, 0) wrote 0 into markVariant and color. Metadata updates are partial: a field that is not sent keeps its value.

Change

  • EntityTracker::SetVariant takes std::optional<int> for variant, mark variant and color, and only writes the fields that are set.
  • ApplyMetadata collects the three as optionals and still clamps the values it actually received to >= 0.

Testing

  • macOS arm64 Release build.
  • Not tested in game yet: on a Hive hub, the game holograms should keep their own titles after the first player-count update.

An actor data update carrying only VARIANT reset MARK_VARIANT and COLOR to
0. Servers resend only what changed, so models that pick their texture
from query.mark_variant switched to index 0 a few seconds after joining:
every game hologram on a Hive hub showed Build Battle. SetVariant now
takes optional fields and only writes the ones the packet sent.
@notchyves
notchyves merged commit 769faf3 into theselauraproject:main Nov 6, 2026
10 checks passed
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.

2 participants