RustTip

OnAnimalDungProduce

OxideAnimal
object OnAnimalDungProduce(RidableHorse ridableHorse)
Works — the game method in this build is the one the hook was written for.

Parameters

ridableHorse
RidableHorse

Return value

objectReturn non-null to stop the game method.

Example

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

private object OnAnimalDungProduce(RidableHorse ridableHorse)
{
    Puts("OnAnimalDungProduce");

    // 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 RidableHorse.DoDung()

Passes: RidableHorse ridableHorse

WorksReturnBehavior: ExitWhenNonNullArgumentBehavior: JustThisAssembly-CSharp.dll

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

private void DoDung()
{
	dungProduction--;
	if (Interface.CallHook("OnAnimalDungProduce", this) != null)
	{
		return;
	}
	Quaternion rotation = Quaternion.Euler(Random.Range(-180f, 180f), Random.Range(-180f, 180f), Random.Range(-180f, 180f));
	Vector3 vVelocity = new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(-1f, -3f), Random.Range(-0.5f, 0.5f));
	Item item = ItemManager.Create(dungItem, 1, 0uL, isServerSide: true, 0uL);
	item.SetItemOwnership(currentBreed.breedName.english, ItemOwnershipPhrases.Pooped);
	item.Drop(dungSpawnPoint.position + Random.insideUnitSphere * 0.1f, vVelocity, rotation);
// …

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.