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.
My mod, AutoItemPickup, calls
GenericPickupController.GrantItem(CharacterBody body, Inventory inventory)
in order to distribute an item to a player. It also always passesnull
for thebody
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 theCharacterBody.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 orbody.master
is null.Thanks to LessFluff#0505 on discord for testing!