RustTip

OnRemoveDying

OxideCarbonResource

Called when a remove is dying.

object OnRemoveDying(GrowableEntity growableEntity, BasePlayer receiver)
Works — the game method in this build is the one the hook was written for.

Parameters

growableEntity
GrowableEntity
receiver
BasePlayer

Return value

objectReturn non-null to cancel the game action.

Example

object — you can affect the game: return a value to change or cancel the action.

private object OnRemoveDying(GrowableEntity growableEntity, BasePlayer receiver)
{
    Puts("OnRemoveDying");

    // change nothing — the game continues as usual
    return null;

    // to affect the game:
    // return false; // non-null cancels the game action
}

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

Injection point

Rust.opj (Oxide)
void GrowableEntity.RemoveDying(BasePlayer)

Passes: GrowableEntity growableEntity, BasePlayer receiver

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, a0)Assembly-CSharp.dll

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

public void RemoveDying(BasePlayer receiver)
{
	if (State == PlantProperties.State.Dying && !(Properties.removeDyingItem == null))
	{
		if (Interface.CallHook("OnRemoveDying", this, receiver) != null)
		{
			return;
		}
		if (Properties.removeDyingEffect.isValid)
		{
			Effect.server.Run(Properties.removeDyingEffect.resourcePath, transform.position, Vector3.up);
		}
		Item item = ItemManager.Create(Properties.removeDyingItem, 1, 0uL, isServerSide: true, 0uL);
// …

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.