Merge pull request 'fix: Rust's December build: no off-mesh links, the field list, the prefab id (#31, #32)' (#33) from fix/staging-drill-32 into edge
Reviewed-on: #33
This commit is contained in:
@@ -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
|
||||
|
||||
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
|
||||
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 |
|
||||
|---|---|---|---|
|
||||
| `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 |
|
||||
| `ScientistBrain` | Subclassed by `RunicNpcBrain`; the swap copies `SwapBrainFields` (32 fields of `BaseAIBrain`) | `#region The swap` | 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` (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 |
|
||||
| `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.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 |
|
||||
| `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 |
|
||||
|
||||
@@ -921,7 +921,7 @@ namespace Oxide.Plugins
|
||||
#region The swap (D223, D232)
|
||||
|
||||
// <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).
|
||||
private static readonly string[] SwapNpcFields =
|
||||
{
|
||||
@@ -944,15 +944,9 @@ namespace Oxide.Plugins
|
||||
"NPCPlayer.damageScale",
|
||||
"NPCPlayer.shortRange",
|
||||
"NPCPlayer.attackLengthMaxShortRangeScale",
|
||||
"BasePlayer.debugCommandedNpcs",
|
||||
"BasePlayer.GestureViewModel",
|
||||
"BasePlayer.lastPlayerVisibility",
|
||||
"BasePlayer.timeSinceAiming",
|
||||
"BasePlayer.eyeHistory",
|
||||
"BasePlayer.tickHistory",
|
||||
"BasePlayer.fallDamageEffect",
|
||||
"BasePlayer.drownEffect",
|
||||
"BasePlayer.Belt",
|
||||
"BaseCombatEntity.spawnDeployableCorpseOnDeath",
|
||||
"BaseCombatEntity.deployableCorpsePrefab",
|
||||
"BaseCombatEntity.skeletonProperties",
|
||||
@@ -967,7 +961,6 @@ namespace Oxide.Plugins
|
||||
"BaseCombatEntity.sendsMeleeHitNotification",
|
||||
"BaseCombatEntity.markAttackerHostile",
|
||||
"BaseCombatEntity.faction",
|
||||
"BaseEntity.faces",
|
||||
"BaseEntity.bounds",
|
||||
"BaseEntity.impactEffect",
|
||||
"BaseEntity.enableSaving",
|
||||
@@ -977,7 +970,7 @@ namespace Oxide.Plugins
|
||||
"BaseEntity.HasBrain",
|
||||
"BaseEntity.ServerPreProcessed",
|
||||
"BaseNetworkable.postNetworkUpdateComponents",
|
||||
"BaseNetworkable.prefabID",
|
||||
"BaseNetworkable.serializedPrefabID",
|
||||
"BaseNetworkable.globalBroadcast",
|
||||
"BaseNetworkable.globalNetworkBehavior",
|
||||
"BaseNetworkable.globalBuildingBlock",
|
||||
@@ -991,7 +984,6 @@ namespace Oxide.Plugins
|
||||
"BaseAIBrain.AllowedToSleep",
|
||||
"BaseAIBrain.DefaultDesignSO",
|
||||
"BaseAIBrain.Designs",
|
||||
"BaseAIBrain.InstanceSpecificDesign",
|
||||
"BaseAIBrain.SenseRange",
|
||||
"BaseAIBrain.AttackRangeMultiplier",
|
||||
"BaseAIBrain.TargetLostRange",
|
||||
@@ -1123,6 +1115,10 @@ namespace Oxide.Plugins
|
||||
RunicNpcBrain brain = go.AddComponent<RunicNpcBrain>();
|
||||
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);
|
||||
|
||||
@@ -1564,7 +1560,9 @@ namespace Oxide.Plugins
|
||||
{
|
||||
_nextCheck = now + 2f;
|
||||
_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);
|
||||
_self?.CheckEscort(npc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user