remiX- / QualityCompany

MIT License
4 stars 0 forks source link

picked up items get ghostly duplicated when rejoining game #9

Closed computer-catt closed 6 months ago

computer-catt commented 6 months ago

i assume it happens because the ui gets initiated 2 times the items take up inventory space but cant be dropped also seen in https://github.com/remiX-/QualityCompany/issues/5

error that happens when you pick up an item after restarting your save:

[Error  : Unity Log] NullReferenceException
Stack trace:
QualityCompany.Modules.Inventory.ScrapValueModule.UpdateTotalScrapValue () (at <5000f76e46234c048a44b3e1e4786b96>:IL_007E)
QualityCompany.Modules.Inventory.ScrapValueModule.OnUpdate (GrabbableObject currentHeldItem, System.Int32 currentItemSlotIndex) (at <5000f76e46234c048a44b3e1e4786b96>:IL_0000)
QualityCompany.Modules.Inventory.InventoryBaseUI.OnUpdate (GameNetcodeStuff.PlayerControllerB instance) (at <5000f76e46234c048a44b3e1e4786b96>:IL_002E)
QualityCompany.Modules.Inventory.InventoryBaseUI.OnRpcUpdate (GameNetcodeStuff.PlayerControllerB instance, System.Boolean isLocalPlayer) (at <5000f76e46234c048a44b3e1e4786b96>:IL_0004)
QualityCompany.Service.GameEvents.OnPlayerGrabObjectClientRpc (GameNetcodeStuff.PlayerControllerB instance, GrabbableObject go) (at <5000f76e46234c048a44b3e1e4786b96>:IL_002B)
QualityCompany.Patch.PlayerControllerBPatch.RefreshLootOnPickupClient (GameNetcodeStuff.PlayerControllerB __instance, Unity.Netcode.NetworkObjectReference& grabbedObject) (at <5000f76e46234c048a44b3e1e4786b96>:IL_0018)
(wrapper dynamic-method) GameNetcodeStuff.PlayerControllerB.DMD<GameNetcodeStuff.PlayerControllerB::GrabObjectClientRpc>(GameNetcodeStuff.PlayerControllerB,bool,Unity.Netcode.NetworkObjectReference)
GameNetcodeStuff.PlayerControllerB.__rpc_handler_2552479808 (Unity.Netcode.NetworkBehaviour target, Unity.Netcode.FastBufferReader reader, Unity.Netcode.__RpcParams rpcParams) (at <af9b1eec498a45aebd42601d6ab85015>:IL_0064)
Unity.Netcode.RpcMessageHelpers.Handle (Unity.Netcode.NetworkContext& context, Unity.Netcode.RpcMetadata& metadata, Unity.Netcode.FastBufferReader& payload, Unity.Netcode.__RpcParams& rpcParams) (at <895801699cfc4b4ab52267f31e2a4998>:IL_004E)
Rethrow as Exception: Unhandled RPC exception!
UnityEngine.Debug:LogException(Exception)
Unity.Netcode.RpcMessageHelpers:Handle(NetworkContext&, RpcMetadata&, FastBufferReader&, __RpcParams&)
Unity.Netcode.ClientRpcMessage:Handle(NetworkContext&)
Unity.Netcode.NetworkBehaviour:__endSendClientRpc(FastBufferWriter&, UInt32, ClientRpcParams, RpcDelivery)
GameNetcodeStuff.PlayerControllerB:DMD<GameNetcodeStuff.PlayerControllerB::GrabObjectClientRpc>(PlayerControllerB, Boolean, NetworkObjectReference)
GameNetcodeStuff.PlayerControllerB:GrabObjectServerRpc(NetworkObjectReference)
GameNetcodeStuff.PlayerControllerB:__rpc_handler_1554282707(NetworkBehaviour, FastBufferReader, __RpcParams)
Unity.Netcode.RpcMessageHelpers:Handle(NetworkContext&, RpcMetadata&, FastBufferReader&, __RpcParams&)
Unity.Netcode.ServerRpcMessage:Handle(NetworkContext&)
Unity.Netcode.NetworkBehaviour:__endSendServerRpc(FastBufferWriter&, UInt32, ServerRpcParams, RpcDelivery)
GameNetcodeStuff.PlayerControllerB:GrabObjectServerRpc(NetworkObjectReference)
GameNetcodeStuff.PlayerControllerB:DMD<GameNetcodeStuff.PlayerControllerB::BeginGrabObject>(PlayerControllerB)
MonoMod.Utils.DynamicMethodDefinition:Trampoline<GameNetcodeStuff.PlayerControllerB::BeginGrabObject>?-893793998(PlayerControllerB)
LethalThings.PouchyBelt:PlayerControllerB_BeginGrabObject(orig_BeginGrabObject, PlayerControllerB) (at O:/github/LethalThings/LethalThings/MonoBehaviours/PouchyBelt.cs:71)
MonoMod.Utils.DynamicMethodDefinition:Hook<GameNetcodeStuff.PlayerControllerB::BeginGrabObject>?-1444191004(PlayerControllerB)
GameNetcodeStuff.PlayerControllerB:Interact_performed(CallbackContext)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)

[Warning: Unity Log] PlayOneShot was called with a null AudioClip.
[Error  : Unity Log] NullReferenceException
Stack trace:
QualityCompany.Modules.Inventory.ScrapValueModule.UpdateTotalScrapValue () (at <5000f76e46234c048a44b3e1e4786b96>:IL_007E)
QualityCompany.Modules.Inventory.ScrapValueModule.OnUpdate (GrabbableObject currentHeldItem, System.Int32 currentItemSlotIndex) (at <5000f76e46234c048a44b3e1e4786b96>:IL_0000)
QualityCompany.Modules.Inventory.InventoryBaseUI.OnUpdate (GameNetcodeStuff.PlayerControllerB instance) (at <5000f76e46234c048a44b3e1e4786b96>:IL_002E)
QualityCompany.Modules.Inventory.InventoryBaseUI.OnRpcUpdate (GameNetcodeStuff.PlayerControllerB instance, System.Boolean isLocalPlayer) (at <5000f76e46234c048a44b3e1e4786b96>:IL_0004)
QualityCompany.Service.GameEvents.OnPlayerGrabObjectClientRpc (GameNetcodeStuff.PlayerControllerB instance, GrabbableObject go) (at <5000f76e46234c048a44b3e1e4786b96>:IL_002B)
QualityCompany.Patch.PlayerControllerBPatch.RefreshLootOnPickupClient (GameNetcodeStuff.PlayerControllerB __instance, Unity.Netcode.NetworkObjectReference& grabbedObject) (at <5000f76e46234c048a44b3e1e4786b96>:IL_0018)
(wrapper dynamic-method) GameNetcodeStuff.PlayerControllerB.DMD<GameNetcodeStuff.PlayerControllerB::GrabObjectClientRpc>(GameNetcodeStuff.PlayerControllerB,bool,Unity.Netcode.NetworkObjectReference)
GameNetcodeStuff.PlayerControllerB.GrabObjectServerRpc (Unity.Netcode.NetworkObjectReference grabbedObject) (at <af9b1eec498a45aebd42601d6ab85015>:IL_018C)
GameNetcodeStuff.PlayerControllerB.__rpc_handler_1554282707 (Unity.Netcode.NetworkBehaviour target, Unity.Netcode.FastBufferReader reader, Unity.Netcode.__RpcParams rpcParams) (at <af9b1eec498a45aebd42601d6ab85015>:IL_0096)
Unity.Netcode.RpcMessageHelpers.Handle (Unity.Netcode.NetworkContext& context, Unity.Netcode.RpcMetadata& metadata, Unity.Netcode.FastBufferReader& payload, Unity.Netcode.__RpcParams& rpcParams) (at <895801699cfc4b4ab52267f31e2a4998>:IL_004E)
Rethrow as Exception: Unhandled RPC exception!
UnityEngine.Debug:LogException(Exception)
Unity.Netcode.RpcMessageHelpers:Handle(NetworkContext&, RpcMetadata&, FastBufferReader&, __RpcParams&)
Unity.Netcode.ServerRpcMessage:Handle(NetworkContext&)
Unity.Netcode.NetworkBehaviour:__endSendServerRpc(FastBufferWriter&, UInt32, ServerRpcParams, RpcDelivery)
GameNetcodeStuff.PlayerControllerB:GrabObjectServerRpc(NetworkObjectReference)
GameNetcodeStuff.PlayerControllerB:DMD<GameNetcodeStuff.PlayerControllerB::BeginGrabObject>(PlayerControllerB)
MonoMod.Utils.DynamicMethodDefinition:Trampoline<GameNetcodeStuff.PlayerControllerB::BeginGrabObject>?-893793998(PlayerControllerB)
LethalThings.PouchyBelt:PlayerControllerB_BeginGrabObject(orig_BeginGrabObject, PlayerControllerB) (at O:/github/LethalThings/LethalThings/MonoBehaviours/PouchyBelt.cs:71)
MonoMod.Utils.DynamicMethodDefinition:Hook<GameNetcodeStuff.PlayerControllerB::BeginGrabObject>?-1444191004(PlayerControllerB)
GameNetcodeStuff.PlayerControllerB:Interact_performed(CallbackContext)
UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)

steps to reproduce:

  1. start legal company
  2. load a save
  3. quit save
  4. load save
  5. pick up item

my mods:

image

remiX- commented 6 months ago

Hey @computer-catt,

I cannot seem to replicate this with my current modding profile.

Could you send a share code pls? :)

computer-catt commented 6 months ago

Hey @computer-catt,

I cannot seem to replicate this with my current modding profile.

Could you send a share code pls? :)

absolutely, the code is 018da49f-586c-118f-048d-0a23c08e85bf

computer-catt commented 6 months ago

ive uploaded a video of how to reproduce the error on discord here's the link

remiX- commented 6 months ago

Thanks @computer-catt.

Will take a look at this :)

In the meantime - could you try the same with v1.3.1 once it hits Thunderstore? Should be in the next 20 mins since this post.

computer-catt commented 6 months ago

Thanks @computer-catt.

Will take a look at this :)

In the meantime - could you try the same with v1.3.1 once it hits Thunderstore? Should be in the next 20 mins since this post.

the issue is resolved

computer-catt commented 6 months ago

thank you

remiX- commented 6 months ago

Interesting. Can you check if you're getting a warning with this?

UpdateTotalScrapValue: GNM.Instance?.localPlayerController?.ItemSlots is null

TsamT commented 4 months ago

it doesn't appear to be solved to me (in the latest update v50) image