PickupShareApi

v1.0.0·Updated 2026-08-14

Library. Lets a loot-sharing mod publish which players have already collected which drop, so another mod can move that drop without the lobby losing track. Does nothing on its own.

About this mod Author’s original text

PickupShareApi

A library. Installing it on its own does nothing — something else has to use it.

It solves one specific problem: Risk of Rain 2 never synchronises the position of a

spawned pickup. CharacterNetworkTransform only ever rides on characters, and a drop's

position reaches other players exactly once, inside its spawn message. So a mod that wants

to move a drop cannot move it — it has to destroy it and spawn a replacement.

That is fine, until a loot-sharing mod is also installed. Those track drops by instance id,

and the replacement gets a new one. A drop that half the lobby had already collected comes

back looking untouched, and everyone gets a second copy.

This library is the hand-off between the two.

For a mod that tracks drops

Implement IPickupStateProvider and register in Awake:

[BepInDependency("com.majai.pickupshareapi", BepInDependency.DependencyFlags.HardDependency)]

public class MyLootPlugin: BaseUnityPlugin

{

private readonly MyStateProvider _provider = new MyStateProvider();

public void Awake() => PickupShareApi.RegisterProvider(_provider);

public void OnDestroy() => PickupShareApi.UnregisterProvider(_provider);

}

One provider at a time. Registering a second replaces the first and logs loudly about it,

because two mods tracking the same drops would contradict each other.

For a mod that moves drops

Call the static forwarders. Spawn the replacement before destroying the original —

Unity is free to hand the freed instance id straight back out, and a replacement that

inherited the old id would be matched against the very record you are moving off it.

var replacement = GenericPickupController.CreatePickup(in info);

PickupShareApi.TransferOrbState(original.GetInstanceID(), replacement.GetInstanceID());

NetworkServer.Destroy(original.gameObject);

Every call is safe with no provider registered — the transfers return false, the queries

return false, the forgets do nothing. That is the correct answer for a vanilla run, where

a drop is either untouched or already gone. So a consumer does not need to know whether a

loot-sharing mod is installed, and does not need to depend on one.

PickupShareApi.HasProvider is there if you want to check anyway. Check it at the point of

use rather than at load — load order is not guaranteed to favour you.

Also included

PickupClassifier.IsCommandCube(picker) — PickupPickerController also drives the

Scrapper, 3D printers, Meal Prep, the Hoard, the Solus vendor, Lemurian eggs, Delusion and

Rebirth. Those take an item from a player rather than handing one out, and treating one as

a Command cube breaks it badly. Fails to false when it cannot tell.

PickupClassifier.IsRuntimeSpawned(component) — whether an object was dropped during the

run or shipped with the scene. Only a runtime object can be destroyed and respawned.

API version

PickupShareApi.ApiVersion is 1. It is bumped only when an existing member changes

meaning or disappears; new members leave it alone.

ภาษาไทย

เป็น library ล้วน ลงเฉยๆ ไม่ทำอะไรเลย ต้องมี mod อื่นเรียกใช้

แก้ปัญหาเดียว: RoR2 ไม่ sync ตำแหน่งของ pickup ที่ spawn แล้ว ตำแหน่งถูกส่งครั้งเดียว

ตอน spawn เท่านั้น mod ที่อยากย้าย orb เลยย้ายตรงๆ ไม่ได้ ต้องทำลายของเดิมแล้ว spawn ตัวใหม่

ปัญหาคือ mod แชร์ของจำ orb ด้วย instance id ซึ่งตัวใหม่ได้ id ใหม่ orb ที่ครึ่งห้องเก็บไปแล้ว

จะกลับมาดูเหมือนยังไม่มีใครแตะ แล้วทุกคนเก็บซ้ำได้ library ตัวนี้คือสะพานส่งต่อสถานะระหว่างสองฝั่ง

  • ฝั่งที่เก็บสถานะ implement IPickupStateProvider แล้ว RegisterProvider ตอน Awake
  • ฝั่งที่ย้าย orb เรียก PickupShareApi.TransferOrbState(oldId, newId) — spawn ตัวใหม่ก่อน

ทำลายตัวเก่าทีหลังเสมอ เพราะ Unity คืน instance id มาใช้ซ้ำได้

  • ถ้าไม่มีใคร register ทุก call ปลอดภัยหมด (คืน false / ไม่ทำอะไร) ซึ่งถูกต้องสำหรับ run vanilla

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.

Dependencies

Install these first, or the mod will not work:

bbepis-BepInExPack

File & checksum

Filename
PickupShareApi-1.0.0.zip
File size
15.0 KiB