Skip to content

IOnNpcTarget

WARNING

This is an internal hook and will not be called in plugins. See Internal Hooks for more information.

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void IOnNpcTarget( BaseNpc instance, BaseEntity target )
{
    Puts( "IOnNpcTarget works!" );
}
csharp
private void IOnNpcTarget( SenseComponent instance, BaseEntity entity )
{
    Puts( "IOnNpcTarget works!" );
}

Location

  • BaseNpc::GetWantsToAttack(BaseEntity target)
  • Rust.Ai.Gen2.SenseComponent::CanTarget(BaseEntity entity)
csharp
public float GetWantsToAttack(BaseEntity target)
{
	object returnvar = Interface.CallHook("IOnNpcTarget", this, target);
	if (returnvar is float)
	{
		return (float)returnvar;
	}
	return this.WantsToAttack(target);
//---
csharp
//---
		if (basePlayer.InSafeZone())
		{
			return false;
		}
	}
	object returnvar = Interface.CallHook("IOnNpcTarget", this, entity);
	return !(returnvar is bool) || (bool)returnvar;
}

Released under the MIT License.