LegaSource / CursedScraps

Other
2 stars 1 forks source link

[Bug] Compatibility with Emergency Dice #12

Closed 1111-glitch closed 5 months ago

1111-glitch commented 5 months ago

So when this mod is installed with Emergency Dice only the host can use the dice. I already presented the issue to the dev of the mod but I have no idea if they are working on fixing it. You can view the issue here.

The exact error is this:

22:16:43.3174267] [Error  : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
CursedScraps.Patches.PlayerManagerPatch.PostDropObject (GameNetcodeStuff.PlayerControllerB& __instance) (at <304603177630431c9196bdc591bf903d>:IL_001C)
(wrapper dynamic-method) GameNetcodeStuff.PlayerControllerB.DMD<GameNetcodeStuff.PlayerControllerB::DiscardHeldObject>(GameNetcodeStuff.PlayerControllerB,bool,Unity.Netcode.NetworkObject,UnityEngine.Vector3,bool)
MysteryDice.Dice.DieBehaviour.ItemActivate (System.Boolean used, System.Boolean buttonDown) (at <7e76924f43cc44ff9a2d93d4df210d8b>:IL_0085)
GrabbableObject.UseItemOnClient (System.Boolean buttonDown) (at <255c0877f9414c3aa6f1fe5079ac13f3>:IL_005C)
(wrapper dynamic-method) GameNetcodeStuff.PlayerControllerB.DMD<GameNetcodeStuff.PlayerControllerB::ActivateItem_performed>(GameNetcodeStuff.PlayerControllerB,UnityEngine.InputSystem.InputAction/CallbackContext)
UnityEngine.InputSystem.Utilities.DelegateHelpers.InvokeCallbacksSafe[TValue] (UnityEngine.InputSystem.Utilities.CallbackArray`1[System.Action`1[TValue]]& callbacks, TValue argument, System.String callbackName, System.Object context) (at <dbb0ce7b96144bd8bcbcb8b0d765f970>:IL_001B)
UnityEngine.Logger:LogException(Exception, Object)
AsyncLoggers.Wrappers.Unity.<>c__DisplayClass4_0:<LogException>b__0() (at ./src/Wrappers/Unity/AsyncLoggerWrapper.cs:36)
AsyncLoggers.Wrappers.Unity.<>c__DisplayClass28_0:<wrapCallback>b__0() (at ./src/Wrappers/Unity/AsyncLoggerWrapper.cs:136)
AsyncLoggers.Wrappers.JobWrapper:LogWorker() (at ./src/Wrappers/JobWrapper.cs:84)
AsyncLoggers.Wrappers.LogJob:Execute() (at ./src/Wrappers/JobWrapper.cs:68)
Unity.Jobs.JobStruct`1:Execute(LogJob&, IntPtr, IntPtr, JobRanges&, Int32)

[22:16:43.3174267] [Error  : Unity Log] NullReferenceException while executing 'performed' callbacks of 'Movement/ActivateItem[/Mouse/leftButton]' 

Also, since this mod works by giving you a curse until you return it to the ship, items that get destroyed on use (like the aforementioned dice) make the curses remain until you end the whole day.

I'm not sure if you want to fix this issue since it's not really dependent on your mod specifically, just thought I'd raise the concern in case something like this is present in the future with other mods.

LegaSource commented 5 months ago

Thanks for the feedback, I'll look into it more closely For the destroyed items, it shouldn't be an issue: bringing a cursed object to the ship removes the curse from it For curses affecting the player, it's not necessary to bring back the object; simply being in the ship removes all curses

1111-glitch commented 5 months ago

Thank you so much for fixing it! I haven't tested it yet but will be able to later, if anything goes wrong I will re-open the issue.