OnPlayerCorpseSpawn
OxideCarbonPlayerCalled when a player corpse is spawned.
object OnPlayerCorpseSpawn(BasePlayer basePlayer)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
Return value
objectReturn non-null to stop the game method.
Example
object — you can affect the game: return a value to change or cancel the action.
private object OnPlayerCorpseSpawn(BasePlayer basePlayer)
{
Puts("OnPlayerCorpseSpawn");
// change nothing — the game continues as usual
return null;
// to affect the game:
// return false; // non-null cancels the game action
}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
Method changed — checkReturnBehavior: ExitWhenNonNullAssembly-CSharp.dll
Where it is called (this branch's game code)
public virtual BaseCorpse CreateCorpse(PlayerFlags flagsOnDeath, Vector3 posOnDeath, Quaternion rotOnDeath, List<TriggerBase> triggersOnDeath, bool forceServerSide = false)
{
if (Interface.CallHook("OnPlayerCorpseSpawn", this) != null)
{
return null;
}
using (TimeWarning.New("Create corpse"))
{
string strCorpsePrefab = ((!(ConVar.Physics.serversideragdolls | forceServerSide)) ? "assets/prefabs/player/player_corpse.prefab" : "assets/prefabs/player/player_corpse_new.prefab");
bool flag = false;
if (Global.cinematicGingerbreadCorpses)
// …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.