runelite-api/src/main/java/net/runelite/api/coords/WorldArea.java
/**
	 * Determine if this WorldArea has line of sight to another WorldArea.
	 * Note that the reverse isn't necessarily true, meaning this can return true
	 * while the other WorldArea does not have line of sight to this WorldArea.
	 *
	 * @param client The client to compare in
	 * @param other The other WorldArea to compare with
	 * @return Returns true if this WorldArea has line of sight to the other
	 */
Determine if this WorldArea has line of sight to another WorldArea.
Note that the reverse isn't necessarily true, meaning this can return true
while the other WorldArea does not have line of sight to this WorldArea.

@param client The client to compare in
@param other The other WorldArea to compare with
@return Returns true if this WorldArea has line of sight to the other
Determine if this WorldArea has line of sight to another WorldArea . Note that the reverse isn ' t necessarily true meaning this can return true while the other WorldArea does not have line of sight to this WorldArea . @param client The client to compare in @param other The other WorldArea to compare with @return Returns true if this WorldArea has line of sight to the other
public boolean hasLineOfSightTo(Client client, WorldArea other)
	{
		if (plane != other.getPlane())
		{
			return false;
		}
		LocalPoint sourceLp = LocalPoint.fromWorld(client, x, y);
		LocalPoint targetLp = LocalPoint.fromWorld(client, other.getX(), other.getY());
		if (sourceLp == null || targetLp == null)
		{
			return false;
		}
		int thisX = sourceLp.getRegionX();
		int thisY = sourceLp.getRegionY();
		int otherX = targetLp.getRegionX();
		int otherY = targetLp.getRegionY();
		int cmpThisX, cmpThisY, cmpOtherX, cmpOtherY;
		if (otherX <= thisX)
		{
			cmpThisX = thisX;
		}
		else if (otherX >= thisX + width - 1)
		{
			cmpThisX = thisX + width - 1;
		}
		else
		{
			cmpThisX = otherX;
		}
		if (otherY <= thisY)
		{
			cmpThisY = thisY;
		}
		else if (otherY >= thisY + height - 1)
		{
			cmpThisY = thisY + height - 1;
		}
		else
		{
			cmpThisY = otherY;
		}
		if (thisX <= otherX)
		{
			cmpOtherX = otherX;
		}
		else if (thisX >= otherX + other.getWidth() - 1)
		{
			cmpOtherX = otherX + other.getWidth() - 1;
		}
		else
		{
			cmpOtherX = thisX;
		}
		if (thisY <= otherY)
		{
			cmpOtherY = otherY;
		}
		else if (thisY >= otherY + other.getHeight() - 1)
		{
			cmpOtherY = otherY + other.getHeight() - 1;
		}
		else
		{
			cmpOtherY = thisY;
		}
		Tile[][][] tiles = client.getRegion().getTiles();
		Tile sourceTile = tiles[plane][cmpThisX][cmpThisY];
		Tile targetTile = tiles[other.getPlane()][cmpOtherX][cmpOtherY];
		if (sourceTile == null || targetTile == null)
		{
			return false;
		}
		return sourceTile.hasLineOfSightTo(targetTile);
	}
public boolean hasLineOfSightTo ( Client client , WorldArea other ) { if ( plane != other . getPlane ( ) ) { return false ; } LocalPoint sourceLp = LocalPoint . fromWorld ( client , x , y ) ; LocalPoint targetLp = LocalPoint . fromWorld ( client , other . getX ( ) , other . getY ( ) ) ; if ( sourceLp == null || targetLp == null ) { return false ; } int thisX = sourceLp . getRegionX ( ) ; int thisY = sourceLp . getRegionY ( ) ; int otherX = targetLp . getRegionX ( ) ; int otherY = targetLp . getRegionY ( ) ; int cmpThisX , cmpThisY , cmpOtherX , cmpOtherY ; if ( otherX <= thisX ) { cmpThisX = thisX ; } else if ( otherX >= thisX + width - 1 ) { cmpThisX = thisX + width - 1 ; } else { cmpThisX = otherX ; } if ( otherY <= thisY ) { cmpThisY = thisY ; } else if ( otherY >= thisY + height - 1 ) { cmpThisY = thisY + height - 1 ; } else { cmpThisY = otherY ; } if ( thisX <= otherX ) { cmpOtherX = otherX ; } else if ( thisX >= otherX + other . getWidth ( ) - 1 ) { cmpOtherX = otherX + other . getWidth ( ) - 1 ; } else { cmpOtherX = thisX ; } if ( thisY <= otherY ) { cmpOtherY = otherY ; } else if ( thisY >= otherY + other . getHeight ( ) - 1 ) { cmpOtherY = otherY + other . getHeight ( ) - 1 ; } else { cmpOtherY = thisY ; } Tile [ ] [ ] [ ] tiles = client . getRegion ( ) . getTiles ( ) ; Tile sourceTile = tiles [ plane ] [ cmpThisX ] [ cmpThisY ] ; Tile targetTile = tiles [ other . getPlane ( ) ] [ cmpOtherX ] [ cmpOtherY ] ; if ( sourceTile == null || targetTile == null ) { return false ; } return sourceTile . hasLineOfSightTo ( targetTile ) ; }
Determine if this WorldArea has line of sight to another WorldArea.
Determine if this WorldArea has line of sight to another WorldArea .
// Determine which position to compare with for this NPC // Determine which position to compare for the other actor