Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ilure 0.4.7's ConsumeProductBehaviour.OnStartServer dereferences beh.Npc, both set only in Awake. An S1API NPC's behaviour whose Awake ran before it was parented keeps nulls, and the NullReferenceException aborts FishNet's scene setup, so the save never finishes loading. A prefix repairs the references as Awake would; if there is still no NPC, a finalizer contains that one exception and logs it (at most 20 times). S1API NPCs only. A test fails if a game member the patch relies on goes missing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3773bfa to
8860d65
Compare
S1API repairs and contains a custom NPC's ConsumeProductBehaviour.OnStartServer failure itself (ifBars/S1API#335), so S1UMF no longer patches it. The README moves it to a "Fixed by S1API" section. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ifBars
left a comment
There was a problem hiding this comment.
I would like a supported-lifecycle reproduction before we accept this, for the same reason discussed on #338 and #339.
The NPC guidance requires configuring defaults in ConfigurePrefab, doing runtime setup in OnCreated, and letting S1API own instancing. Big Pimpin's manual construction sequence does not establish that this fails when following that contract. S1API already runs RepairBehaviourOwnership during prefab preparation and instance behaviour initialization. Please provide a minimal NPC using automatic instancing that shows where ownership is missed or undone, along with the exception and runtime/version.
The finalizer also suppresses any exception once it finds a custom NPC with missing ownership. It never checks which exception occurred or whether base.OnStartServer completed. That can hide a different initialization failure and leave a partially initialized object, despite the description saying unrelated exceptions still surface.
I would prefer repairing the owning construction or activation path and reusing the existing ownership repair. If a native patch is still necessary, please narrow it around a demonstrated failure and test that unrelated exceptions remain visible. The current member-existence test does not exercise either the repair or the finalizer. Leaving this open so we can work through that reproduction.
|
Closing this for the same reason as #338 and #339: it doesn't reproduce through S1API's documented NPC lifecycle. The only evidence for this PR was the inactive The reproduction I posted on #338 never hit this exception. That was one NPC written as the documented Physical NPC skeleton, on unmodified So there's no failure in S1API's own lifecycle for this patch to repair. The workaround goes back into S1UMF, gated to Big Pimpin 1.0.11 and the game builds it was measured on, where it stands down as soon as either changes. |
Reverts b033800. S1API won't carry this fix: NPCs made through its documented lifecycle don't hit the ConsumeProductBehaviour.OnStartServer exception (a minimal NPC on IL2CPP and Mono, first load and reload), so ifBars/S1API#335 is closed. The failure comes from The Big Pimpin constructing its escorts with `new` from its Main-scene callback, so the fix now applies only alongside Big Pimpin 1.0.11 on the game builds it was measured on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
A custom NPC's product behaviour can stop a save from loading:
0.4.7's
ConsumeProductBehaviour.OnStartServerisbase.OnStartServer(); Npc.OnNPCDeinitialized += ..., whereNpcisbeh.Npc. Both references are set only byGetComponentInParentinAwake. An instance whoseAwakeran before it was parented keeps nulls, and the exception aborts FishNet'sSetupSceneObjectsfor every scene object after it. Seen on the inactiveConsume Productbehaviour of an S1API NPC created for The Big Pimpin's escorts. S1UMF has carried a workaround for this.The change. A Harmony patch on
ConsumeProductBehaviour.OnStartServer, for S1API's own NPCs only:Awakewould have.base.OnStartServerhas run. Any other exception surfaces as before.A test fails if a game member the patch relies on goes missing. On Mono, that includes the auto-property backing fields it writes.
Compatibility
internal staticmethod onNPCPatches; the patch class is private.Validation
Mono
dotnet build S1API.sln -c MonoMelon --no-restore -p:AutomateLocalDeployment=false: 0 errors, 0 warnings.dotnet test ... -c MonoMelon: 741 passed (740 onbetaplus 1 new).IL2CPP
dotnet build S1API.sln -c Il2CppMelon --no-restore -p:AutomateLocalDeployment=false: 0 errors, 0 warnings.dotnet test ... -c Il2CppMelon: 721 passed (720 plus 1 new).Runtime evidence
How it was tested. Automated runs on 0.4.7f7 load a save, teleport to each custom NPC, record whether its model is shown and its network state, return to the menu and load again. They used a combined build of #332 to #339.
I also played the IL2CPP case by hand.
Contained an OnStartServer failure on 'Consume Product (Inactive) (Disabled)'on the first load, and both loads finish, with and without S1UMF installed.Documentation
XML
<remarks>on the patch class. No DocFX changes.🤖 Generated with Claude Code