RustTip

OnEntityBuilt

OxideCarbonStructure

Called when entity built occurs.

void OnEntityBuilt(Planner planner, GameObject local2)
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

planner
Planner
local2
GameObject

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnEntityBuilt(Planner planner, GameObject local2)
{
    Puts("OnEntityBuilt");
}

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

Injection point

Rust.opj (Oxide)
void Planner.DoBuild(Construction.Target, Construction)

Passes: Planner planner, GameObject local2

Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l2)Assembly-CSharp.dll

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

// …
	if (HandleCanBuild(result2, ownerPlayer))
	{
		return null;
	}
}
GameObject gameObject = DoPlacement(target, component);
if (gameObject == null)
{
	Interface.CallHook("OnEntityBuilt", this, gameObject);
	if (!string.IsNullOrEmpty(Construction.lastPlacementError.translated))
	{
		ownerPlayer.ShowToast(GameTip.Styles.Error, Construction.lastPlacementError, false);
	}
	ConstructionErrors.Log(ownerPlayer, Construction.lastPlacementErrorDebug);
}
if (gameObject != null)
{
// …

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.