From f21a468863a0116310fee305721576da1d7e00e9 Mon Sep 17 00:00:00 2001 From: wtclaude Date: Mon, 30 Nov 2026 23:09:44 -0600 Subject: [PATCH] fix(swap): give our NPC the prefab's id again (Rust 11/25) 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 Claude-Session: https://claude.ai/code/session_014HJEmd5sBSpNXicS4gmT1t --- plugin/RunicNPC.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/RunicNPC.cs b/plugin/RunicNPC.cs index aa69d14..2949df9 100644 --- a/plugin/RunicNPC.cs +++ b/plugin/RunicNPC.cs @@ -1123,6 +1123,10 @@ namespace Oxide.Plugins RunicNpcBrain brain = go.AddComponent(); CopyFields(_npcFields, stock, npc); CopyFields(_brainFields, stockBrain, brain); + // prefabID is a property now (Rust 11/25): Unity's deserialisation fills its encrypted + // value from serializedPrefabID, and an AddComponent never deserialises, so copying the + // field list leaves ours without the prefab's id (#32). + npc.prefabID = stock.prefabID; UnityEngine.Object.DestroyImmediate(stock, true); UnityEngine.Object.DestroyImmediate(stockBrain, true);