OnItemDeployed
OxideItemvoid OnItemDeployed(Deployer deployer, ItemModDeployable itemModDeployable, BaseEntity baseEntity)
void OnItemDeployed(Deployer deployer, BaseEntity baseEntity, BaseEntity baseEntity)Works — the game method in this build is the one the hook was written for.
Parameters
- deployer
- Deployer
- itemModDeployable
- ItemModDeployable
- baseEntity
- BaseEntity
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnItemDeployed(Deployer deployer, ItemModDeployable itemModDeployable, BaseEntity baseEntity)
{
Puts("OnItemDeployed");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point 1
Rust.opj (Oxide)
void Deployer.DoDeploy_Regular(Deployable, Ray)
Passes: Deployer deployer, ItemModDeployable itemModDeployable, BaseEntity baseEntity
WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l5, l6)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
Debug.LogWarning("Couldn't create prefab:" + modDeployable.entityPrefab.resourcePath);
return;
}
baseEntity.skinID = ownerItem.skin;
baseEntity.SendMessage("SetDeployedBy", ownerPlayer, SendMessageOptions.DontRequireReceiver);
baseEntity.OwnerID = ownerPlayer.userID;
baseEntity.Spawn();
modDeployable.OnDeployed(baseEntity, ownerPlayer);
Interface.CallHook("OnItemDeployed", this, modDeployable, baseEntity);
Analytics.Azure.OnEntityBuilt(baseEntity, ownerPlayer);
UseItemAmount(1);
}
}Injection point 2
Rust.opj (Oxide)
void Deployer.DoDeploy_Slot(Deployable, Ray, NetworkableId)
Passes: Deployer deployer, BaseEntity baseEntity, BaseEntity baseEntity
WorksReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l1, l4)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
{
WorldPosition = baseEntity2.transform.position,
UintIdentifier = baseEntity2.prefabID,
IntIdentifier = GetOwnerItemDefinition().itemid
}, 1f);
}
}
modDeployable.OnDeployed(baseEntity2, ownerPlayer);
Interface.CallHook("OnItemDeployed", this, baseEntity, baseEntity2);
Analytics.Azure.OnEntityBuilt(baseEntity2, ownerPlayer);
if (!ownerPlayer.IsInCreativeMode || !Creative.freeBuild)
{
UseItemAmount(1);
}
}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.