OnImpactEffectCreate
OxideCarbonWeaponCalled when an impact effect is created.
object OnImpactEffectCreate(HitInfo info, string customEffect)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
- 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
Method changed — checkReturnBehavior: 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;
}
BasePlayer initiatorPlayer = info.InitiatorPlayer;
if (((object)initiatorPlayer != null && initiatorPlayer.limitNetworking) || !info.DoHitEffects || !CanPlayImpactEffect(info))
{
return;
}
// …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.