Skip to content

OnEntityDeath

Usage

  • No return behavior

Example Autogenerated

csharp
private void OnEntityDeath( BaseCombatEntity instance, HitInfo info )
{
    Puts( "OnEntityDeath works!" );
}
csharp
private void OnEntityDeath( ResourceEntity instance, HitInfo info )
{
    Puts( "OnEntityDeath works!" );
}

Location

  • BaseCombatEntity::Die(HitInfo info)
  • ResourceEntity::OnKilled(HitInfo info)
csharp
//---
		return;
	}
	base.LogEntry(RustLog.EntryType.Combat, 2, "died");
	this.health = 0f;
	this.lifestate = BaseCombatEntity.LifeState.Dead;
	Interface.CallHook("OnEntityDeath", this, info);
	if (info != null && info.InitiatorPlayer)
	{
		BasePlayer initiatorPlayer = info.InitiatorPlayer;
		if (initiatorPlayer != null && initiatorPlayer.GetActiveMission() != -1 && !initiatorPlayer.IsNpc)
		{
//---
csharp
public virtual void OnKilled(HitInfo info)
{
	this.isKilled = true;
	Interface.CallHook("OnEntityDeath", this, info);
	base.Kill(BaseNetworkable.DestroyMode.None);
}

Released under the MIT License.