Skip to content

CanBeTargeted

Usage

  • Return a non-null value to override default behavior

Example Autogenerated

csharp
private void CanBeTargeted( BaseCombatEntity obj, AutoTurret instance )
{
    Puts( "CanBeTargeted works!" );
}
csharp
private void CanBeTargeted( BasePlayer component, FlameTurret instance )
{
    Puts( "CanBeTargeted works!" );
}
csharp
private void CanBeTargeted( BasePlayer component, GunTrap instance )
{
    Puts( "CanBeTargeted works!" );
}
csharp
private void CanBeTargeted( BaseCombatEntity potentialtarget, HelicopterTurret instance )
{
    Puts( "CanBeTargeted works!" );
}

Location

  • AutoTurret::ObjectVisible(BaseCombatEntity obj)
  • FlameTurret::CheckTrigger()
  • GunTrap::CheckTrigger()
  • HelicopterTurret::InFiringArc(BaseCombatEntity potentialtarget)
csharp
public bool ObjectVisible(BaseCombatEntity obj)
{
	object returnvar = Interface.CallHook("CanBeTargeted", obj, this);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	List<RaycastHit> list = Pool.Get<List<RaycastHit>>();
//---
csharp
//---
			while (enumerator.MoveNext())
			{
				BasePlayer component = enumerator.Current.GetComponent<BasePlayer>();
				if (!component.IsSleeping() && component.IsAlive())
				{
					object returnvar = Interface.CallHook("CanBeTargeted", component, this);
					if (returnvar is bool)
					{
						return (bool)returnvar;
					}
					if (component.transform.position.y <= this.GetEyePosition().y + 0.5f && !component.IsBuildingAuthed())
//---
csharp
//---
		while (enumerator.MoveNext())
		{
			BasePlayer component = enumerator.Current.GetComponent<BasePlayer>();
			if (!component.IsSleeping() && component.IsAlive())
			{
				object returnvar = Interface.CallHook("CanBeTargeted", component, this);
				if (returnvar is bool)
				{
					return (bool)returnvar;
				}
				if (cachedTc == null || !cachedTc.IsAuthed(component))
//---
csharp
public bool InFiringArc(BaseCombatEntity potentialtarget)
{
	object returnvar = Interface.CallHook("CanBeTargeted", potentialtarget, this);
	if (returnvar is bool)
	{
		return (bool)returnvar;
	}
	return this.AngleToTarget(potentialtarget) < 80f;
//---

Released under the MIT License.