RustTip

OnEntitySpawn

CarbonGlobal

Called when an entity is spawned.

void OnEntitySpawn(BaseNetworkable networkable)
Works — the game method in this build is the one the hook was written for.

Parameters

networkable
BaseNetworkable

Return value

voidThe return value is ignored — the hook only notifies.

Example

private void OnEntitySpawn(BaseNetworkable networkable)
{
    Puts("OnEntitySpawn");
}

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

Injection point

Carbon
void BaseNetworkable.Spawn()
WorksAssembly-CSharp

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

public virtual void Spawn()
Interface.CallHook("OnEntitySpawn", this);
{
	EntityProfiler.spawned++;
	if (EntityProfiler.mode >= 2)
	{
		EntityProfiler.OnSpawned(this);
	}
	SpawnShared();
	if (net == 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.