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 float value to override default behavior

Example Autogenerated

csharp
private float? IOnNpcTarget( BaseNpc instance, BaseEntity target )
{
    Puts( "IOnNpcTarget works!" );
    return null;
}
csharp
private bool? IOnNpcTarget( Rust.Ai.Gen2.SenseComponent instance, BaseEntity entity )
{
    Puts( "IOnNpcTarget works!" );
    return null;
}

Location

  • BaseNpc::GetWantsToAttack(BaseEntity target)
  • Rust.Ai.Gen2.SenseComponent::CanTarget(BaseEntity entity)
csharp
public float GetWantsToAttack(BaseEntity target)
{
	object obj = Interface.CallHook("IOnNpcTarget", this, target);
	if (obj is float)
	{
		return (float)obj;
	}
	return WantsToAttack(target);
//---
csharp
//---
		if (SimpleAIMemory.PlayerIgnoreList.Contains(item))
		{
			return false;
		}
	}
	object obj = Interface.CallHook("IOnNpcTarget", this, entity);
	if (obj is bool)
	{
		return (bool)obj;
	}
	return true;
//---

Released under the MIT License.