Repository navigation
Conversation
Clients get custom NPCs as clones of the S1API template and never run the instance constructor, so the owners the host sets there were missing. On a client the "Customer attend deal" behaviour of a custom customer had Behaviour.beh and _customer null. The host's Enable/Activate RPCs then threw inside the behaviour, FishNet dropped the exception, and the customer never waited at the drop: scheduled deals offered no handover on the client. CreateFromClientNetworkSpawn now repairs the behaviour owners of the clone and binds the attend behaviour to the NPC's NPCBehaviour and Customer, and the Customer to the behaviour. Each binding that had to be set is logged.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Linked issue
Fixes #391
Contributor checklist
Summary
Co-op clients can now complete scheduled deals with custom customers. Before, the client's copy of the customer never offered the handover.
Clients never run the custom NPC instance constructor; their NPC is a clone of the S1API template. The owners the host sets in
InitializeBehaviourComponentswere missing there: the "Customer attend deal" behaviour hadBehaviour.behand_customernull. The host's Enable/Activate RPCs then threw inside the behaviour, FishNet dropped the exception, and the behaviour stayed disabled on the client.NPC.CreateFromClientNetworkSpawnnow runsRepairBehaviourOwnershipon the clone and thenNPCCustomer.BindDealAttendance.NPCCustomer.BindDealAttendance(internal) points the attend behaviour at the NPC'sNPCBehaviourandCustomer, and setsCustomer._attendDealBehaviourwhen it is missing. Each binding it had to set is logged once per NPC:Bound deal attendance for '<id>': set customer, customer link.A missingNPCBehaviouror attend behaviour is logged as a warning.Compatibility
NPCCustomer.BindDealAttendance.Validation
Mono
Build and tests:
dotnet test S1API.Tests -c MonoMelon, 862/862 passed. Not run in the Mono game.IL2CPP
Build and tests:
dotnet test S1API.Tests -c Il2CppMelon, 825/825 passed.Runtime evidence
Schedule I 0.4.7f12, IL2CPP, MelonLoader 0.7.3, host and client on one machine (two installs, LocalLobby). Mods: S1API, Personnel (custom customers from packs) with its own client workaround switched off, a debug probe. The host books a scheduled deal for the custom customer
devtest_customer_cleoand for a vanilla customer (control); the probe then reads the attend behaviour on both sides.stablea5a7e2aClient log with this PR:
[NPCCustomer] Bound deal attendance for 'devtest_customer_cleo': set customer, customer link.Documentation
None.
Summary by CodeRabbit