OnAnimalDungProduced
OxideAnimalobject OnAnimalDungProduced()
object OnAnimalDungProduced(RidableHorse ridableHorse, object l2)Works — the game method in this build is the one the hook was written for.
Parameters
No parameters.
Return value
objectThe result is checked in a special way — see the call code below.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnAnimalDungProduced()
{
Puts("OnAnimalDungProduced");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return null; // null — the game continues as usual
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point 1
Rust.opj (Oxide)
void RidableHorse.DoDung()
Passes: —
WorksReturnBehavior: CustomAssembly-CSharp.dll
Where it is called (this branch's game code)
private void DoDung()
{
dungProduction--;
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);
object result = Interface.CallHook("OnAnimalDungProduced");
// … проверка результата (Modify-хук, см. Rust.opj)
item.SetItemOwnership(currentBreed.breedName.english, ItemOwnershipPhrases.Pooped);
item.Drop(dungSpawnPoint.position + Random.insideUnitSphere * 0.1f, vVelocity, rotation);
}Injection point 2
Rust.opj (Oxide)
void RidableHorse.DoDung()
Passes: RidableHorse ridableHorse, object l2
WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this,l2)Assembly-CSharp.dll
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.