Skip to content

CanBeTargeted

Usage

  • Return a bool value to override default behavior

Example Autogenerated

csharp
private bool? CanBeTargeted( BaseCombatEntity obj, AutoTurret instance )
{
    Puts( "CanBeTargeted works!" );
    return null;
}
csharp
private bool? CanBeTargeted( BasePlayer basePlayer, FlameTurret instance )
{
    Puts( "CanBeTargeted works!" );
    return null;
}
csharp
private bool? CanBeTargeted( BasePlayer basePlayer, GunTrap instance )
{
    Puts( "CanBeTargeted works!" );
    return null;
}
csharp
private void CanBeTargeted(  )
{
    Puts( "CanBeTargeted works!" );
}
csharp
private void CanBeTargeted(  )
{
    Puts( "CanBeTargeted works!" );
}
csharp
private bool? CanBeTargeted( BaseCombatEntity potentialtarget, HelicopterTurret instance )
{
    Puts( "CanBeTargeted works!" );
    return null;
}

Location

  • AutoTurret::ObjectVisible(BaseCombatEntity obj)
  • FlameTurret::CheckTrigger()
  • GunTrap::CheckTrigger()
  • GunTrap::CheckTrigger()
  • GunTrap::CheckTrigger()
  • HelicopterTurret::InFiringArc(BaseCombatEntity potentialtarget)
csharp
public bool ObjectVisible(BaseCombatEntity obj)
{
	object obj2 = Interface.CallHook("CanBeTargeted", obj, this);
	if (obj2 is bool)
	{
		return (bool)obj2;
	}
	Vector3 position = eyePos.transform.position;
//---
csharp
//---
			BasePlayer basePlayer = item as BasePlayer;
			if (basePlayer == null || basePlayer.IsSleeping() || !basePlayer.IsAlive() || basePlayer.transform.position.y > GetEyePosition().y + 0.5f)
			{
				continue;
			}
			object obj2 = Interface.CallHook("CanBeTargeted", basePlayer, this);
			if (obj2 is bool)
			{
				if (obj != null)
				{
					Pool.FreeUnmanaged(ref obj);
//---
csharp
//---
			BasePlayer basePlayer = item as BasePlayer;
			if (basePlayer == null || basePlayer.IsSleeping() || !basePlayer.IsAlive())
			{
				continue;
			}
			object obj2 = Interface.CallHook("CanBeTargeted", basePlayer, this);
			if (obj2 is bool)
			{
				flag = (bool)obj2;
				break;
			}
//---
csharp
//---
			BasePlayer basePlayer = item as BasePlayer;
			if (basePlayer == null || basePlayer.IsSleeping() || !basePlayer.IsAlive())
			{
				continue;
			}
			object obj2 = Interface.CallHook("CanBeTargeted", basePlayer, this);
			if (obj2 is bool)
			{
				flag = (bool)obj2;
				break;
			}
//---
csharp
//---
			BasePlayer basePlayer = item as BasePlayer;
			if (basePlayer == null || basePlayer.IsSleeping() || !basePlayer.IsAlive())
			{
				continue;
			}
			object obj2 = Interface.CallHook("CanBeTargeted", basePlayer, this);
			if (obj2 is bool)
			{
				flag = (bool)obj2;
				break;
			}
//---
csharp
public bool InFiringArc(BaseCombatEntity potentialtarget)
{
	object obj = Interface.CallHook("CanBeTargeted", potentialtarget, this);
	if (obj is bool)
	{
		return (bool)obj;
	}
	return AngleToTarget(potentialtarget) < 80f;
//---

Released under the MIT License.