OnImpactEffectCreate
OxideCarbonWeaponCalled when an impact effect is created.
object OnImpactEffectCreate(HitInfo info, string customEffect)Works — the game method in this build is the one the hook was written for.
Parameters
- info
- HitInfo
- customEffect
- string
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 OnImpactEffectCreate(HitInfo info, string customEffect)
{
Puts("OnImpactEffectCreate");
// 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 Effect.server.ImpactEffect(HitInfo, string)
Passes: HitInfo info, string customEffect
WorksReturnBehavior: ExitWhenNonNullArgumentBehavior: UseArgumentString (a0, a1)Assembly-CSharp.dll
Where it is called (this branch's game code)
public static void ImpactEffect(HitInfo info, string customEffect = null)
{
if (Interface.CallHook("OnImpactEffectCreate", info, customEffect) != null)
{
return;
}
if (!info.DoHitEffects || !CanPlayImpactEffect(info))
{
return;
}
string materialName = StringPool.Get(info.HitMaterial);
// …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.