fix: Rust's December build: no off-mesh links, the field list, the prefab id (#31, #32)
All checks were successful
PR Checks / plugin-checks (pull_request) Successful in 9s

- Rust removed off-mesh links from its AI (BaseNavigator.IsOnNavMeshLink and its
  traversal are gone), so the brain's reground no longer waits for one (D399).
- The swap's field list, regenerated from staging's Assembly-CSharp (D232):
  58 -> 51 NPC fields, 32 -> 31 brain fields. Seven fields are no longer
  serialised, timeSinceAiming is gone, prefabID -> serializedPrefabID.
- The swap sets our NPC's prefabID after the copy (D398): it is a property now,
  filled only by Unity's deserialisation, so an AddComponent never got it and
  every NPC had prefab id 0 (already true on public since Rust's 11/25 patch).
- README: the update surface names prefabID and drops IsOnNavMeshLink; counts.

Closes #31
Closes #32

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HJEmd5sBSpNXicS4gmT1t
This commit is contained in:
2026-11-30 23:09:43 -06:00
parent 761a9b6733
commit b9b06a62fa
2 changed files with 14 additions and 15 deletions

View File

@@ -98,7 +98,7 @@ The API version moves when a call or a raised hook changes shape, not on every r
## After a Rust update: the swap's field list ## After a Rust update: the swap's field list
Our NPC is Rust's scientist with two components swapped, and the swap copies a fixed list of fields (D232), Our NPC is Rust's scientist with two components swapped, and the swap copies a fixed list of fields (D232),
generated from Rust's unmodified assembly. `rnpc.status` reports it as `swap fields: npc=58/58 brain=32/32 generated from Rust's unmodified assembly. `rnpc.status` reports it as `swap fields: npc=51/51 brain=31/31
missing=- added=-`. On Carbon, where the assembly is unmodified, `added` names any field Rust has added since missing=- added=-`. On Carbon, where the assembly is unmodified, `added` names any field Rust has added since
the list was made. To regenerate it: the list was made. To regenerate it:
@@ -121,13 +121,14 @@ shows it, so the drill's live half and `rnpc.status` are what catch it.
| Rust type | What RunicNPC depends on | Where (`plugin/RunicNPC.cs`) | Caught by | | Rust type | What RunicNPC depends on | Where (`plugin/RunicNPC.cs`) | Caught by |
|---|---|---|---| |---|---|---|---|
| `ScientistNPC` (prefabs `scientistnpc_*`) | Subclassed by `RunicNpcPlayer`; the swap replaces the prefab's component before spawn and copies `SwapNpcFields` (58 fields up its chain to `BaseNetworkable`) | `#region The swap`, `CreateNpc` | compile; field list | | `ScientistNPC` (prefabs `scientistnpc_*`) | Subclassed by `RunicNpcPlayer`; the swap replaces the prefab's component before spawn and copies `SwapNpcFields` (51 fields up its chain to `BaseNetworkable`) | `#region The swap`, `CreateNpc` | compile; field list |
| `ScientistBrain` | Subclassed by `RunicNpcBrain`; the swap copies `SwapBrainFields` (32 fields of `BaseAIBrain`) | `#region The swap` | compile; field list | | `ScientistBrain` | Subclassed by `RunicNpcBrain`; the swap copies `SwapBrainFields` (31 fields of `BaseAIBrain`) | `#region The swap` | compile; field list |
| `ScientistNPC` / `HumanNPC` virtuals | `displayName`, `AttackerInfo(PlayerLifeStory.DeathInfo)`, `ShotTest(float)`, `TriggerDown()`, `Hurt(HitInfo)`, `OnDied(HitInfo)` overridden | `RunicNpcPlayer` | compile | | `ScientistNPC` / `HumanNPC` virtuals | `displayName`, `AttackerInfo(PlayerLifeStory.DeathInfo)`, `ShotTest(float)`, `TriggerDown()`, `Hurt(HitInfo)`, `OnDied(HitInfo)` overridden | `RunicNpcPlayer` | compile |
| `IAIAttack`, `IAISenses` | Re-implemented on `RunicNpcPlayer`: `IsTargetInRange`, `EngagementRange`, `GetBestTarget`, `AttackTick`, `IsTarget`, `IsThreat`, `IsFriendly`. Rust's `HumanNPC.IsTarget` is not virtual, which is why | `RunicNpcPlayer` | compile; a changed meaning only at run time | | `IAIAttack`, `IAISenses` | Re-implemented on `RunicNpcPlayer`: `IsTargetInRange`, `EngagementRange`, `GetBestTarget`, `AttackTick`, `IsTarget`, `IsThreat`, `IsFriendly`. Rust's `HumanNPC.IsTarget` is not virtual, which is why | `RunicNpcPlayer` | compile; a changed meaning only at run time |
| `BaseAIBrain` | `AddStates()` and `Think(float)` overridden; `states`, `CurrentState`, `Navigator`, `Senses`, `Events` used; `AIState` values `Roam`, `Chase`, `Combat`, `TakeCover`, `Cover`, `MoveTowards`, `MoveToVector3`, `FollowPath`, `NavigateHome`, `Flee`, `Blinded` replaced or held | `RunicNpcBrain` | compile; a state Rust stops adding only at run time | | `BaseAIBrain` | `AddStates()` and `Think(float)` overridden; `states`, `CurrentState`, `Navigator`, `Senses`, `Events` used; `AIState` values `Roam`, `Chase`, `Combat`, `TakeCover`, `Cover`, `MoveTowards`, `MoveToVector3`, `FollowPath`, `NavigateHome`, `Flee`, `Blinded` replaced or held | `RunicNpcBrain` | compile; a state Rust stops adding only at run time |
| `BaseAIBrain.BasicAIState` | Subclassed six times (`WanderState`, `RnRoamState`, `RnGuardState`, `RouteState`, `PursueState`, `HoldState`): `StateEnter`, `StateThink`, `StateLeave` | `#region The NPC` | compile | | `BaseAIBrain.BasicAIState` | Subclassed six times (`WanderState`, `RnRoamState`, `RnGuardState`, `RouteState`, `PursueState`, `HoldState`): `StateEnter`, `StateThink`, `StateLeave` | `#region The NPC` | compile |
| `BaseNavigator` | `SetDestination`, `Stop`, `Moving`, `Agent`, `IsOnNavMeshLink`, `NavigationSpeed` | the states | compile | | `BaseNetworkable.prefabID` | A property backed by an encrypted value that only Unity's deserialisation fills, so the swap sets it on our component by hand after the copy (#32) | `CreateNpc` | run time (a wrong id: our NPC's `ShortPrefabName` is empty) |
| `BaseNavigator` | `SetDestination`, `Stop`, `Moving`, `Agent`, `NavigationSpeed` | the states | compile |
| `AIMemory` / `AIBrainSenses` | `Memory.Targets`, `SetKnown`, `IsLOS`, `Entity`; `DelaySenseUpdate` | the states, the fight | compile | | `AIMemory` / `AIBrainSenses` | `Memory.Targets`, `SetKnown`, `IsLOS`, `Entity`; `DelaySenseUpdate` | the states, the fight | compile |
| `BaseCombatEntity.faction` | Our NPC's target is set to `Faction.Horror` for the length of our own shot, because `BaseProjectile.ServerUse` drops NPC-on-NPC hits otherwise (stage 5) | `RunicNpcPlayer.Mark` | run time (the drill's fight checks) | | `BaseCombatEntity.faction` | Our NPC's target is set to `Faction.Horror` for the length of our own shot, because `BaseProjectile.ServerUse` drops NPC-on-NPC hits otherwise (stage 5) | `RunicNpcPlayer.Mark` | run time (the drill's fight checks) |
| `NPCAutoTurret` | Harmony prefixes on the private `Ignore(BasePlayer)` and `IsEntityHostile(BaseCombatEntity)`, found by reflection (D267) | `#region Factions`, `SentryPatch` | run time: `rnpc.status` says whether the patch applied | | `NPCAutoTurret` | Harmony prefixes on the private `Ignore(BasePlayer)` and `IsEntityHostile(BaseCombatEntity)`, found by reflection (D267) | `#region Factions`, `SentryPatch` | run time: `rnpc.status` says whether the patch applied |

View File

@@ -921,7 +921,7 @@ namespace Oxide.Plugins
#region The swap (D223, D232) #region The swap (D223, D232)
// <fieldlist> // <fieldlist>
// Generated by tools/fieldlist from Rust's Assembly-CSharp.dll, module 5c6eb1c7-ffa2-4b1e-a218-0a66bcc56f9e. // Generated by tools/fieldlist from Rust's Assembly-CSharp.dll, module b2ee98e0-1091-4c90-b0c6-c52f7a4aac74.
// Do not edit by hand: regenerate after a Rust update (D232). // Do not edit by hand: regenerate after a Rust update (D232).
private static readonly string[] SwapNpcFields = private static readonly string[] SwapNpcFields =
{ {
@@ -944,15 +944,9 @@ namespace Oxide.Plugins
"NPCPlayer.damageScale", "NPCPlayer.damageScale",
"NPCPlayer.shortRange", "NPCPlayer.shortRange",
"NPCPlayer.attackLengthMaxShortRangeScale", "NPCPlayer.attackLengthMaxShortRangeScale",
"BasePlayer.debugCommandedNpcs",
"BasePlayer.GestureViewModel", "BasePlayer.GestureViewModel",
"BasePlayer.lastPlayerVisibility",
"BasePlayer.timeSinceAiming",
"BasePlayer.eyeHistory",
"BasePlayer.tickHistory",
"BasePlayer.fallDamageEffect", "BasePlayer.fallDamageEffect",
"BasePlayer.drownEffect", "BasePlayer.drownEffect",
"BasePlayer.Belt",
"BaseCombatEntity.spawnDeployableCorpseOnDeath", "BaseCombatEntity.spawnDeployableCorpseOnDeath",
"BaseCombatEntity.deployableCorpsePrefab", "BaseCombatEntity.deployableCorpsePrefab",
"BaseCombatEntity.skeletonProperties", "BaseCombatEntity.skeletonProperties",
@@ -967,7 +961,6 @@ namespace Oxide.Plugins
"BaseCombatEntity.sendsMeleeHitNotification", "BaseCombatEntity.sendsMeleeHitNotification",
"BaseCombatEntity.markAttackerHostile", "BaseCombatEntity.markAttackerHostile",
"BaseCombatEntity.faction", "BaseCombatEntity.faction",
"BaseEntity.faces",
"BaseEntity.bounds", "BaseEntity.bounds",
"BaseEntity.impactEffect", "BaseEntity.impactEffect",
"BaseEntity.enableSaving", "BaseEntity.enableSaving",
@@ -977,7 +970,7 @@ namespace Oxide.Plugins
"BaseEntity.HasBrain", "BaseEntity.HasBrain",
"BaseEntity.ServerPreProcessed", "BaseEntity.ServerPreProcessed",
"BaseNetworkable.postNetworkUpdateComponents", "BaseNetworkable.postNetworkUpdateComponents",
"BaseNetworkable.prefabID", "BaseNetworkable.serializedPrefabID",
"BaseNetworkable.globalBroadcast", "BaseNetworkable.globalBroadcast",
"BaseNetworkable.globalNetworkBehavior", "BaseNetworkable.globalNetworkBehavior",
"BaseNetworkable.globalBuildingBlock", "BaseNetworkable.globalBuildingBlock",
@@ -991,7 +984,6 @@ namespace Oxide.Plugins
"BaseAIBrain.AllowedToSleep", "BaseAIBrain.AllowedToSleep",
"BaseAIBrain.DefaultDesignSO", "BaseAIBrain.DefaultDesignSO",
"BaseAIBrain.Designs", "BaseAIBrain.Designs",
"BaseAIBrain.InstanceSpecificDesign",
"BaseAIBrain.SenseRange", "BaseAIBrain.SenseRange",
"BaseAIBrain.AttackRangeMultiplier", "BaseAIBrain.AttackRangeMultiplier",
"BaseAIBrain.TargetLostRange", "BaseAIBrain.TargetLostRange",
@@ -1123,6 +1115,10 @@ namespace Oxide.Plugins
RunicNpcBrain brain = go.AddComponent<RunicNpcBrain>(); RunicNpcBrain brain = go.AddComponent<RunicNpcBrain>();
CopyFields(_npcFields, stock, npc); CopyFields(_npcFields, stock, npc);
CopyFields(_brainFields, stockBrain, brain); 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(stock, true);
UnityEngine.Object.DestroyImmediate(stockBrain, true); UnityEngine.Object.DestroyImmediate(stockBrain, true);
@@ -1564,7 +1560,9 @@ namespace Oxide.Plugins
{ {
_nextCheck = now + 2f; _nextCheck = now + 2f;
_playerNear = npc.Profile.SleepDistance <= 0f || PlayerWithin(npc.transform.position, npc.Profile.SleepDistance); _playerNear = npc.Profile.SleepDistance <= 0f || PlayerWithin(npc.transform.position, npc.Profile.SleepDistance);
if (!Sentry && !Navigator.IsOnNavMeshLink) // Rust's AI has no off-mesh links any more (staging 27024215, #32): nothing is ever
// mid-link, so there is no traversal left to wait out.
if (!Sentry)
Reground(npc); Reground(npc);
_self?.CheckEscort(npc); _self?.CheckEscort(npc);