OnEntitySpawned
OxideCarbonEntityCalled when an entity is spawned.
void OnEntitySpawned(BaseNetworkable baseNetworkable)Works — the game method in this build is the one the hook was written for.
Parameters
- baseNetworkable
- BaseNetworkable
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnEntitySpawned(BaseNetworkable baseNetworkable)
{
Puts("OnEntitySpawned");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
void BaseNetworkable.Spawn()
Passes: BaseNetworkable baseNetworkable
WorksReturnBehavior: ContinueArgumentBehavior: JustThisAssembly-CSharp.dll
Where it is called (this branch's game code)
// …
creationFrame = Time.frameCount;
PreInitShared();
InitShared();
ServerInit();
PostInitShared();
UpdateNetworkGroup();
ServerInitPostNetworkGroupAssign();
isSpawned = true;
Interface.CallHook("OnEntitySpawned", this);
SendNetworkUpdateImmediate();
Invoke(SendGlobalNetworkUpdate, 0f);
if (Rust.Application.isLoading && !Rust.Application.isLoadingSave)
{
gameObject.SendOnSendNetworkUpdate(this as BaseEntity);
}
}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.