RustTip

OnLiquidVesselFill

OxideCarbonEntity

Called when a liquid vessel is filled.

object OnLiquidVesselFill(BaseLiquidVessel baseLiquidVessel, BasePlayer local0, LiquidContainer local3)
Works — the game method in this build is the one the hook was written for.

Parameters

baseLiquidVessel
BaseLiquidVessel
local0
BasePlayer
local3
LiquidContainer

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 OnLiquidVesselFill(BaseLiquidVessel baseLiquidVessel, BasePlayer local0, LiquidContainer local3)
{
    Puts("OnLiquidVesselFill");

    // 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 BaseLiquidVessel.FillCheck()

Passes: BaseLiquidVessel baseLiquidVessel, BasePlayer local0, LiquidContainer local3

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: UseArgumentString (this, l0, l3)Assembly-CSharp.dll

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

// …
BasePlayer ownerPlayer = GetOwnerPlayer();
if (!ownerPlayer)
{
	return;
}
float f = (Time.realtimeSinceStartup - lastFillTime) * fillMlPerSec;
Vector3 pos = ownerPlayer.transform.position - new Vector3(0f, 1f, 0f);
LiquidContainer facingLiquidContainer = GetFacingLiquidContainer();
if (Interface.CallHook("OnLiquidVesselFill", this, ownerPlayer, facingLiquidContainer) != null)
{
	return;
}
if (facingLiquidContainer == null && CanFillFromWorld())
{
	Item contents = GetContents();
	ItemDefinition itemDefinition = WaterResource.SV_GetAtPoint(pos);
	if (contents != null && contents.info.itemid != itemDefinition.itemid)
// …

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.