fix(swap): give our NPC the prefab's id again (Rust 11/25) #34

Merged
whitlocktech merged 1 commits from fix/swap-prefab-id into main 2026-11-30 23:16:53 -06:00
Member

What & why

A live bug on public Rust since the 11/25 patch. That patch made BaseNetworkable.prefabID a property over an encrypted value that only Unity's deserialisation fills (OnAfterDeserialize reads serializedPrefabID). The swap adds our components with AddComponent and copies the field list, and that never deserialises. So every RunicNPC NPC on public Rust has prefab id 0 (ShortPrefabName empty), on Oxide and Carbon alike. rnpc.status shows it as missing=BaseNetworkable.prefabID.

The swap now sets npc.prefabID = stock.prefabID; between the field copy and the stock component's destruction (D398). That's four lines, three of them a comment, the same text as on edge (#33 there), so the wipe-day edge → main cutover merges cleanly. The field list itself isn't touched here: edge carries the regenerated list for the December build. Found while working on #32.

Merging this cuts a patch release (release.yml, fix:).

How it was tested

  • Live on public Rust 26921919 with a scratch probe that spawns through RunicNpc_Spawn and compares the NPC's prefabID with the prefab's:
    • rust-carbon (Carbon 2.0.267, Kits 4.4.10): main gave actual=0 in 3 of 3 spawns. With this change, 3 of 3 got 4199494415 (scientistnpc_roam).
    • egg-oxide (Oxide 2.0.7925, Kits 4.4.10): main 3 of 3 actual=0; with this change, every spawn (6) got 4199494415.
    • Both rigs were stopped afterwards; the demo rig (rust-oxide) wasn't touched.
  • Compiles against public Rust (manifest 1198055723653111326) with Oxide's public release laid over.
  • node scripts/checkPlugin.js ok.
  • Not checked: how a prefab-id-0 NPC looks in a game client. The probe reads only the id.

Checklist

  • I have read CONTRIBUTING.md.
  • The change builds and existing tests/checks pass locally.
  • I have added or updated tests/docs where it makes sense. (docs: RunicGateway/docs PR, D398)
  • My commits are reasonably scoped with clear messages.

AI-assisted contributions (required)

  • No AI tools were used to produce this contribution.
  • AI tools were used. Tool(s): Claude Code (Claude Opus 5.5). I have reviewed and understand
    every change, and take responsibility for it. AI-authored commits are
    marked with a Co-Authored-By / Assisted-By trailer.

License

  • I agree that my contribution is licensed under this project's license
    (GNU GPL v3.0 or later), and I have the right to contribute it.

🤖 Generated with Claude Code

https://claude.ai/code/session_014HJEmd5sBSpNXicS4gmT1t

## What & why **A live bug on public Rust since the 11/25 patch.** That patch made `BaseNetworkable.prefabID` a property over an encrypted value that only Unity's deserialisation fills (`OnAfterDeserialize` reads `serializedPrefabID`). The swap adds our components with `AddComponent` and copies the field list, and that never deserialises. So every RunicNPC NPC on public Rust has prefab id **0** (`ShortPrefabName` empty), on Oxide and Carbon alike. `rnpc.status` shows it as `missing=BaseNetworkable.prefabID`. The swap now sets `npc.prefabID = stock.prefabID;` between the field copy and the stock component's destruction (D398). That's four lines, three of them a comment, the same text as on `edge` (#33 there), so the wipe-day `edge` → `main` cutover merges cleanly. The field list itself isn't touched here: `edge` carries the regenerated list for the December build. Found while working on #32. Merging this cuts a patch release (`release.yml`, `fix:`). ## How it was tested - Live on public Rust 26921919 with a scratch probe that spawns through `RunicNpc_Spawn` and compares the NPC's `prefabID` with the prefab's: - `rust-carbon` (Carbon 2.0.267, Kits 4.4.10): `main` gave `actual=0` in 3 of 3 spawns. With this change, 3 of 3 got `4199494415` (`scientistnpc_roam`). - `egg-oxide` (Oxide 2.0.7925, Kits 4.4.10): `main` 3 of 3 `actual=0`; with this change, every spawn (6) got `4199494415`. - Both rigs were stopped afterwards; the demo rig (`rust-oxide`) wasn't touched. - Compiles against public Rust (manifest `1198055723653111326`) with Oxide's public release laid over. - `node scripts/checkPlugin.js` ok. - **Not checked:** how a prefab-id-0 NPC looks in a game client. The probe reads only the id. ## Checklist - [x] I have read [CONTRIBUTING.md](CONTRIBUTING.md). - [x] The change builds and existing tests/checks pass locally. - [x] I have added or updated tests/docs where it makes sense. (docs: RunicGateway/docs PR, D398) - [x] My commits are reasonably scoped with clear messages. ## AI-assisted contributions (required) - [ ] No AI tools were used to produce this contribution. - [x] AI tools were used. Tool(s): `Claude Code (Claude Opus 5.5)`. I have reviewed and understand every change, and take responsibility for it. AI-authored commits are marked with a `Co-Authored-By` / `Assisted-By` trailer. ## License - [x] I agree that my contribution is licensed under this project's license (**GNU GPL v3.0 or later**), and I have the right to contribute it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014HJEmd5sBSpNXicS4gmT1t
wtclaude added 1 commit 2026-11-30 23:10:27 -06:00
fix(swap): give our NPC the prefab's id again (Rust 11/25)
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in 9s
f21a468863
Rust's 11/25 public patch made BaseNetworkable.prefabID a property over an
encrypted value that only Unity's deserialisation fills (from
serializedPrefabID). The swap's AddComponent never deserialises, so every
RunicNPC NPC on public Rust has had prefab id 0 (ShortPrefabName empty) on
Oxide and Carbon. The swap now sets npc.prefabID = stock.prefabID after the
field copy (D398). The same lines are on edge, so the wipe-day cutover merges
cleanly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HJEmd5sBSpNXicS4gmT1t
whitlocktech merged commit 9895187815 into main 2026-11-30 23:16:53 -06:00
whitlocktech deleted branch fix/swap-prefab-id 2026-11-30 23:16:53 -06:00
Sign in to join this conversation.
No description provided.