RustTip

OnItemDropped

OxideCarbonItem

Called when an item is dropped.

void OnItemDropped(Item item, BaseEntity local1)
Works — the game method in this build is the one the hook was written for.

Parameters

item
Item
local1
BaseEntity

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnItemDropped(Item item, BaseEntity local1)
{
    Puts("OnItemDropped");
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Rust.opj (Oxide)
BaseEntity Item.Drop(Vector3, Vector3, Quaternion)

Passes: Item item, BaseEntity local1

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l1)Assembly-CSharp.dll

Where it is called (this branch's game code)

// …
				droppedItem.Rigidbody.centerOfMass = info.DropCenterOfMass;
			}
		}
	}
	else
	{
		Remove();
	}
	Interface.CallHook("OnItemDropped", this, baseEntity);
	RemoveFromContainer();
	return baseEntity;
}

Sources: Rust.opj from OxideMod/Oxide.Rust (MIT) and hook metadata of the Carbon documentation (MIT). Method code is decompiled from this branch's server.