fix(swap): give our NPC the prefab's id again (Rust 11/25) #34
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/swap-prefab-id"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What & why
A live bug on public Rust since the 11/25 patch. That patch made
BaseNetworkable.prefabIDa property over an encrypted value that only Unity's deserialisation fills (OnAfterDeserializereadsserializedPrefabID). The swap adds our components withAddComponentand copies the field list, and that never deserialises. So every RunicNPC NPC on public Rust has prefab id 0 (ShortPrefabNameempty), on Oxide and Carbon alike.rnpc.statusshows it asmissing=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 onedge(#33 there), so the wipe-dayedge→maincutover merges cleanly. The field list itself isn't touched here:edgecarries 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
RunicNpc_Spawnand compares the NPC'sprefabIDwith the prefab's:rust-carbon(Carbon 2.0.267, Kits 4.4.10):maingaveactual=0in 3 of 3 spawns. With this change, 3 of 3 got4199494415(scientistnpc_roam).egg-oxide(Oxide 2.0.7925, Kits 4.4.10):main3 of 3actual=0; with this change, every spawn (6) got4199494415.rust-oxide) wasn't touched.1198055723653111326) with Oxide's public release laid over.node scripts/checkPlugin.jsok.Checklist
AI-assisted contributions (required)
Claude Code (Claude Opus 5.5). I have reviewed and understandevery change, and take responsibility for it. AI-authored commits are
marked with a
Co-Authored-By/Assisted-Bytrailer.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