Skip to content

Add Injection of CN_RemoteEntity #113

Open
Starwhip wants to merge 2 commits into
csprance:mainfrom
Starwhip:network-inject-remote-entity-flag
Open

Add Injection of CN_RemoteEntity #113
Starwhip wants to merge 2 commits into
csprance:mainfrom
Starwhip:network-inject-remote-entity-flag

Conversation

@Starwhip

@Starwhip Starwhip commented Jun 13, 2026

Copy link
Copy Markdown

Implement flagging entities with CN_RemoteEntity as described here: Authority Query Reference

It does not appear that the addon currently flags any entities with CN_RemoteEntity, only CN_LocalAuthority and CN_ServerAuthority.

Summary by CodeRabbit

  • Improvements
    • Improved multiplayer ownership tracking so entities controlled by remote players are identified and synchronized more reliably, reducing desyncs and making multiplayer behavior and state consistency more dependable during online sessions.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0c693f25-dd2e-4643-a7eb-ecf603bc0450

📥 Commits

Reviewing files that changed from the base of the PR and between 576398e and f8e6414.

📒 Files selected for processing (1)
  • addons/gecs/network/spawn_manager.gd
🚧 Files skipped from review as they are similar to previous changes (1)
  • addons/gecs/network/spawn_manager.gd

Walkthrough

The PR extends SpawnManager's authority-marker injection to track remote-owned entities. A new conditional in _inject_authority_markers() removes any stale CN_RemoteEntity and adds CN_RemoteEntity when an entity's peer_id differs from the local multiplayer unique ID and the entity is not server-owned.

Changes

Remote Entity Authority Tracking

Layer / File(s) Summary
Remote entity detection in authority markers
addons/gecs/network/spawn_manager.gd
A conditional in _inject_authority_markers() removes stale CN_RemoteEntity and detects entities owned by remote peers (peer_id differs from local multiplayer ID), adding the CN_RemoteEntity component to mark remote ownership.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: adding injection of the CN_RemoteEntity marker to explicitly track remote-owned entities in the spawn manager.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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.

@Starwhip Starwhip marked this pull request as ready for review June 13, 2026 02:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@addons/gecs/network/spawn_manager.gd`:
- Around line 257-259: The current logic marks server-owned entities as remote
and never clears stale remote markers; update the CN_RemoteEntity handling so
you only add CN_RemoteEntity when the net_id.peer_id truly differs from the
local multiplayer unique id (taking the server peer_id==0 case into account) and
always remove any existing CN_RemoteEntity during re-injection/respawn.
Concretely: in the block using net_id and
_ns.net_adapter.get_multiplayer().get_unique_id(), change the condition to skip
marking when peer_id==0 on the server (i.e. ensure the comparison treats
server-owned peers as local authority), and before possibly adding call
entity.remove_component(CN_RemoteEntity) or check
entity.has_component(CN_RemoteEntity) and remove it to avoid stale state;
reference the CN_RemoteEntity, net_id,
_ns.net_adapter.get_multiplayer().get_unique_id(), entity.add_component and
entity.remove_component symbols when applying the fix.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f24aaa0-c496-4270-a08d-91f84acc4741

📥 Commits

Reviewing files that changed from the base of the PR and between 4a9ab7a and 576398e.

📒 Files selected for processing (1)
  • addons/gecs/network/spawn_manager.gd

Comment thread addons/gecs/network/spawn_manager.gd Outdated
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