RustTip

OnQuarryConsumeFuel

OxideCarbonResource

Called when quarry consume fuel occurs.

object OnQuarryConsumeFuel(MiningQuarry miningQuarry, object l0 => l0)
Works — the game method in this build is the one the hook was written for.

Parameters

miningQuarry
MiningQuarry
l0 => l0
object

Return value

objectThe returned value modifies the result, the game continues.

Example

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

private object OnQuarryConsumeFuel(MiningQuarry miningQuarry, object l0 => l0)
{
    Puts("OnQuarryConsumeFuel");

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

    // to affect the game:
    // return default(Item); // 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 MiningQuarry.FuelCheck()

Passes: MiningQuarry miningQuarry, object l0 => l0

WorksReturnBehavior: UseArgumentStringArgumentBehavior: UseArgumentString (this, l0 => l0)Assembly-CSharp.dll

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

public bool FuelCheck()
{
	if (pendingWork > 0f)
	{
		return true;
	}
	Item item = fuelStoragePrefab.instance.GetComponent<StorageContainer>().inventory.FindItemByItemName("diesel_barrel");
	Interface.CallHook("OnQuarryConsumeFuel", this, l0 => l0);
	if (item != null && item.amount >= 1)
	{
		pendingWork += workPerFuel;
		Analytics.Azure.OnQuarryItem(Analytics.Azure.ResourceMode.Consumed, item.info.shortname, 1, this);
		item.UseItem();
		return true;
	}
	return false;
// …

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.