fix: attach NPC data before ConfigurePrefab for dealers and suppliers too - #334
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 |
c2adc76 to
79c36e4
Compare
… too
ConfigurePrefab only had a framework data object for plain NPCs. A supplier or dealer built from a donor with
none threw from WithVoice ("Could not apply S1API voice 'tyler' because the custom NPC has no framework
data", Drug Expansion's Disco Davey) and never registered. Any prefab whose NPC component has no data now
gets one before ConfigurePrefab, matching the component's own type; a role's own data still replaces it
afterwards and identity and voice are re-applied to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79c36e4 to
08d0edb
Compare
|
@Diffuin review plz |
Diffuin reviewVerdict: Approve No actionable defects found. The change attaches role-appropriate framework data before ConfigurePrefab and preserves the existing plain-NPC path. Build, test, and live-runtime claims were not independently rerun because the checkout lacks the required .NET SDK and game runtime. No actionable findings. Evidence and validationEvidence inspected
Validation performed
Runtime validation remaining
Diffuin run details
AI notice: Generated with AI assistance and not guaranteed accurate. Verify findings and plans against the current source and runtime. |
|
I pushed 787e377 to trim the comments that repeated the implementation and test. Kept the donor-role ordering explanation and XML docs. No runtime changes in this follow-up. Full builds and suites pass: 742 Mono, 722 IL2CPP. |
|
Tested on 0.4.7f7 Mono and IL2CPP. Plain, dealer and supplier NPCs configured WithVoice and spawned through ConfigurePrefab/OnCreated on the first load and after reloading. Dealer and supplier components and contacts initialized correctly. CI passed. The combined build of #332, #333, #334, #336 and #337 also passed all 770 Mono and 744 IL2CPP tests. Merged into beta. |
Summary
A supplier or dealer NPC that calls
WithVoiceinConfigurePrefabnever registers. Drug Expansion's Disco Davey, for example:ConfigurePrefabonly had a framework data object for plain NPCs. A supplier or dealer is built from a donor prefab that can have none, and its own data is created afterConfigurePrefab.WithVoicethrows without data, as documented.WithIdentityandWithIconignored the same failure.The change. Any prefab whose NPC component has no data object now gets one before
ConfigurePrefab, for every role. It matches the component's own type (NPC.DataRoleForComponent): plain, or dealer or supplier when the donor already is one. A dealer or supplier built from a plain donor still gets its own data afterwards, and identity and voice are re-applied to it from the prefab's identity component. Plain NPCs are unchanged.Compatibility
WithVoicekeeps its contract. A dealer or supplier prefab now has data duringConfigurePrefab; the final prefab is unchanged.Validation
Mono
dotnet build S1API.sln -c MonoMelon --no-restore -p:AutomateLocalDeployment=false: 0 errors, 0 warnings.dotnet test ... -c MonoMelon: 742 passed (740 onbetaplus 2 new: the data kind a donor gets).IL2CPP
dotnet build S1API.sln -c Il2CppMelon --no-restore -p:AutomateLocalDeployment=false: 0 errors, 0 warnings.dotnet test ... -c Il2CppMelon: 722 passed (720 plus 2 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.
Registered NPC prefab 'S1API_DiscoDavey'with no voice warning on both runtimes, and Disco Davey exists on both loads.Documentation
None needed.
🤖 Generated with Claude Code