Repository navigation
fix(NPC): prevent post-load custom contact reinitialization on beta - #317
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the post-load crash reported in #315 for plain custom contacts on the 0.4.7f6 game beta. S1API needs
NPCDataduring inactive construction, but nativeNPC.Awakemust initialize its own data from the configured data object. The previous handoff leftNPCDatapopulated, so native Awake deinitialized the contact before initializing it again.The existing NPC Awake prefix now releases construction-time
NPCDatafor S1API custom NPCs that have a framework data object. It recognizes both modern prefabs withNPCPrefabIdentityand legacy contacts registered by ID. Native Awake then initializes the data once.This targets
betafor the planned 3.2.1-beta.5 release alongside the already merged #316. This PR does not bump or publish a version.Reproduction
0xc0000005.Player.logended afterInitializeNPC called on already initialized NPC. First deinitializing....Verification
NPCDataunset, exited with it initialized, and remained registered in playable gameplay for 15 seconds. No duplicate-initialization warning appeared.dotnet build S1API.slnand the fullS1API.Testssuite passed separately in MonoMelon (724 tests) and Il2CppMelon (710 tests).Eye.StopEyeCoroutinesnull reference during game shutdown, after the passing result; it did not occur during the measured post-load window.Compatibility
No public or protected API, save format, network payload, or identifier changes. Construction-time data remains available until native Awake. The handoff changes only S1API custom NPCs with a configured framework data object; vanilla NPCs and objects without one keep their existing Awake behavior.