OnPlayerCorpseSpawned
OxideCarbonPlayerCalled when a player corpse is spawned.
void OnPlayerCorpseSpawned(BasePlayer basePlayer, PlayerCorpse local3)Method changed — check — the game method differs from the one the hook is recorded for in Oxide. The hook is still called, but its place may have shifted — worth checking after an update.
Parameters
- basePlayer
- BasePlayer
- local3
- PlayerCorpse
Return value
voidThe return value is ignored — the hook only notifies.
Example
private void OnPlayerCorpseSpawned(BasePlayer basePlayer, PlayerCorpse local3)
{
Puts("OnPlayerCorpseSpawned");
}Works in both Oxide and Carbon: Carbon loads Oxide plugins as is.
Injection point
Rust.opj (Oxide)
BaseCorpse BasePlayer.CreateCorpse(BasePlayer.PlayerFlags, Vector3, Quaternion, List<TriggerBase>, bool)
Passes: BasePlayer basePlayer, PlayerCorpse local3
Method changed — checkReturnBehavior: ContinueArgumentBehavior: UseArgumentString (this, l3)Assembly-CSharp.dll
Where it is called (this branch's game code)
// …
if (lifeStory != null)
{
num += Mathf.Clamp(Mathf.FloorToInt(lifeStory.secondsAlive / 180f), 0, 20);
}
component2.containedItems.Add(new ItemAmount(ItemManager.FindItemDefinition("fat.animal"), num));
return playerCorpse;
}
}
Interface.CallHook("OnPlayerCorpseSpawned", this, playerCorpse);
return null;
static float GetFloatBasedOnUserID(ulong steamid, ulong seed)
{
Random.State state = Random.state;
Random.InitState((int)(seed + steamid));
float result = Random.Range(0f, 1f);
Random.state = state;
return result;
// …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.