OnEntityLoaded
OxideCarbonEntityCalled when an entity is loaded.
void OnEntityLoaded(BaseNetworkable baseNetworkable, BaseNetworkable.LoadInfo info)Works — the game method in this build is the one the hook was written for.
Parameters
- baseNetworkable
- BaseNetworkable
- info
- BaseNetworkable.LoadInfo
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnEntityLoaded(BaseNetworkable baseNetworkable, BaseNetworkable.LoadInfo info)
{
Puts("OnEntityLoaded");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void BaseNetworkable.Load(BaseNetworkable.LoadInfo)
Passes: BaseNetworkable baseNetworkable, BaseNetworkable.LoadInfo info
WorksReturnBehavior: ContinueArgumentBehavior: AllAssembly-CSharp.dll
Where it is called (this branch's game code)
public virtual void Load(LoadInfo info)
{
if (info.msg.baseNetworkable != null)
{
Interface.CallHook("OnEntityLoaded", this, info);
ProtoBuf.BaseNetworkable baseNetworkable = info.msg.baseNetworkable;
if (prefabID != baseNetworkable.prefabID && 0 == 0)
{
Debug.LogError("Prefab IDs don't match! " + prefabID + "/" + baseNetworkable.prefabID + " -> " + gameObject, gameObject);
}
}
}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.