OnEntityDestroy
OxideEntityobject OnEntityDestroy(CH47HelicopterAIController cH47HelicopterAIController)
object OnEntityDestroy(BradleyAPC bradleyAPC)Works — the game method in this build is the one the hook was written for.
Parameters
- cH47HelicopterAIController
- CH47HelicopterAIController
Return value
objectReturn a value of the method's result type and the game returns it immediately; null continues as usual.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnEntityDestroy(CH47HelicopterAIController cH47HelicopterAIController)
{
Puts("OnEntityDestroy");
// 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 CH47HelicopterAIController.OnDied(HitInfo)
Passes: CH47HelicopterAIController cH47HelicopterAIController
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: JustThisAssembly-CSharp.dll
Where it is called (this branch's game code)
public override void OnDied(HitInfo info)
{
if (Interface.CallHook("OnEntityDestroy", this) != null)
{
return;
}
if (!OutOfCrates())
{
DropCrate();
}
base.OnDied(info);
// …Injection point 2
Rust.opj (Oxide)
void BradleyAPC.OnDied(HitInfo)
Passes: BradleyAPC bradleyAPC
WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: JustThisAssembly-CSharp.dll
Where it is called (this branch's game code)
public override void OnDied(HitInfo info)
{
if (isClient)
{
return;
}
if (Interface.CallHook("OnEntityDestroy", this) != null)
{
return;
}
CreateExplosionMarker(10f);
Effect.server.Run(explosionEffect.resourcePath, mainTurretEyePos.transform.position, Vector3.up, null, broadcast: true);
Vector3 zero = Vector3.zero;
GameObject gibSource = servergibs.Get().GetComponent<ServerGib>()._gibSource;
List<ServerGib> list = ServerGib.CreateGibs(servergibs.resourcePath, gameObject, gibSource, zero, 3f);
// …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.