OnTimedExplosiveExplode
OxideCarbonWeaponCalled when a timed explosive explodes.
object OnTimedExplosiveExplode(TimedExplosive timedExplosive, Vector3 explosionFxPos)Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.
Parameters
- timedExplosive
- TimedExplosive
- explosionFxPos
- Vector3
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 OnTimedExplosiveExplode(TimedExplosive timedExplosive, Vector3 explosionFxPos)
{
Puts("OnTimedExplosiveExplode");
// 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 TimedExplosive.Explode(Vector3)
Passes: TimedExplosive timedExplosive, Vector3 explosionFxPos
Method changed — checkReturnBehavior: ExitWhenValidTypeArgumentBehavior: AllAssembly-CSharp.dll
Where it is called (this branch's game code)
// …
Effect.server.Run(explosionEffect.resourcePath, posWorld, GetExplosionNormal(), sourceConnection, broadcast: true);
}
if (watersurfaceExplosionEffect.isValid && waterInfo.isValid && waterInfo.overallDepth >= watersurfaceExplosionDepth.x && waterInfo.currentDepth <= watersurfaceExplosionDepth.y)
{
Effect.server.Run(watersurfaceExplosionEffect.resourcePath, explosionFxPos.WithY(waterInfo.surfaceLevel), GetExplosionNormal(), null, broadcast: true);
}
if (GetDamageList(null).Count > 0)
{
if (Interface.CallHook("OnTimedExplosiveExplode", this, explosionFxPos) != null)
{
return;
}
Vector3 vector2 = ExplosionCenter();
if (onlyDamageParent)
{
int num = 166144;
if (!ConVar.AntiHack.explosive_vehicle_parent_damage_deployables && parentEntity.Get(serverside: true) is BaseVehicle)
// …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.