FunkFrog / ShareSuite

Risk of Rain 2 Item, Money, & Equipment sharing mod build upon BepInEx
https://thunderstore.io/package/FunkFrog-and-Sipondo/ShareSuite/
GNU General Public License v3.0
39 stars 26 forks source link

Fix incompatibility with AutoItemPickup #97

Closed KubeRoot closed 3 years ago

KubeRoot commented 3 years ago

My mod, AutoItemPickup, calls GenericPickupController.GrantItem(CharacterBody body, Inventory inventory) in order to distribute an item to a player. It also always passes null for the body argument, in part because the items may be distributed to dead, body-less players.

This does not cause an issue with the base game, since the argument is completely unused. In ShareSuite, however, body is used to get the CharacterBody.master field without a null check. This causes an incompatibility between the mods.

The incompatibility can be resolved by retrieving the master using inventory.GetComponent<CharacterMaster>(), which is used by the game.

In this commit, the new method is implemented as a fallback, only used if body is null or body.master is null.

Thanks to LessFluff#0505 on discord for testing!

Sipondo commented 3 years ago

Seems reasonable! Thanks for the fix.