RustTip

CanBradleyApcTarget

OxideCarbonVehicle

Called to determine whether to bradley apc target.

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

object CanBradleyApcTarget(BradleyAPC bradleyAPC, BaseEntity ent)
Works — the game method in this build is the one the hook was written for.

Parameters

bradleyAPC
BradleyAPC
ent
BaseEntity

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 CanBradleyApcTarget(BradleyAPC bradleyAPC, BaseEntity ent)
{
    Puts("CanBradleyApcTarget");

    // 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 BradleyAPC.VisibilityTest(BaseEntity)

Passes: BradleyAPC bradleyAPC, BaseEntity ent

WorksReturnBehavior: ExitWhenValidTypeArgumentBehavior: AllAssembly-CSharp.dll

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

// …
		{
			flag = !Physics.SphereCast(new Ray(position, Vector3Ex.Direction(basePlayer.eyes.position, position)), 0.05f, Vector3.Distance(basePlayer.eyes.position, position), 10551297);
		}
	}
	else
	{
		flag = IsVisible(ent.CenterPoint());
	}
	object returnvar = Interface.CallHook("CanBradleyApcTarget", this, ent);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	return flag;
}

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.