RustTip

CanWaterBallSplash

OxideCarbonEntity

Called to determine whether to water ball splash.

Return true to allow the action and false to block it.

object CanWaterBallSplash(ItemDefinition liquidDef, Vector3 position, float radius, int amount, bool funWater)
Works — the game method in this build is the one the hook was written for.

Parameters

liquidDef
ItemDefinition
position
Vector3
radius
float
amount
int
funWater
bool

Return value

objectThe returned value replaces the game result; null lets the game decide.

Example

object — you can affect the game: return a value to change or cancel the action.

private object CanWaterBallSplash(ItemDefinition liquidDef, Vector3 position, float radius, int amount, bool funWater)
{
    Puts("CanWaterBallSplash");

    // change nothing — the game continues as usual
    return null;

    // to affect the game:
    // return false; // your value instead of the game result
}

Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.

Injection point

Rust.opj (Oxide)
bool WaterBall.DoSplash(Vector3, float, ItemDefinition, int, bool)

Passes: ItemDefinition liquidDef, Vector3 position, float radius, int amount, bool funWater

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (a2, a0, a1, a3, a4)Assembly-CSharp.dll

Where it is called (this branch's game code)

public static bool DoSplash(Vector3 position, float radius, ItemDefinition liquidDef, int amount, bool funWater = false)
{
	object returnvar = Interface.CallHook("CanWaterBallSplash", liquidDef, position, radius, amount, funWater);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	List<BaseEntity> obj = Pool.Get<List<BaseEntity>>();
	Vis.Entities(position, radius, obj, 1220225811);
	int num = 0;
	int num2 = amount;
// …

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.