RustTip

OnEntityBuilt

OxideCarbonStructure

Called when entity built occurs.

void OnEntityBuilt(Planner planner, GameObject local2)
Works — the game method in this build is the one the hook was written for.

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

WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l2)Assembly-CSharp.dll

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

// …
	if (!string.IsNullOrEmpty(Construction.lastPlacementError.translated))
	{
		ownerPlayer.ShowToast(GameTip.Styles.Error, Construction.lastPlacementError, false);
	}
	ConstructionErrors.Log(ownerPlayer, Construction.lastPlacementErrorDebug);
}
if (gameObject != null)
{
	Interface.CallHook("OnEntityBuilt", this, gameObject);
	Deployable deployable = GetDeployable();
	BaseEntity baseEntity = gameObject.ToBaseEntity();
	if (baseEntity != null && deployable != null && ShouldParent(target.entity, deployable))
	{
		if (target.socket is Socket_Specific_Female socket_Specific_Female)
		{
			if (socket_Specific_Female.parentToBone)
			{
// …

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.