Add a new function to the WorldArea api. Add npcstatus plugin. (#833)

* Add a new function to the WorldArea api. Add npcstatus plugin.

* Ganom adds his mentioned changes (thanks!), and a fix for
splash flinching is added.
This commit is contained in:
GeChallengeM
2019-07-01 07:08:59 +02:00
committed by Ganom
parent 250a16778c
commit 049ac9b22a
5 changed files with 466 additions and 0 deletions

View File

@@ -184,6 +184,25 @@ public class WorldArea
return isInMeleeDistance(new WorldArea(other, 1, 1));
}
/**
* Checks whether this area is within melee distance of another without blocking in-between.
*
* @param client the client to test in
* @param other the other area
* @return true if in melee distance without blocking, false otherwise
*/
public boolean canMelee(Client client, WorldArea other)
{
if (isInMeleeDistance(other))
{
Point p1 = this.getComparisonPoint(other);
Point p2 = other.getComparisonPoint(this);
WorldArea w1 = new WorldArea(p1.getX(), p1.getY() , 1, 1, this.getPlane());
return (w1.canTravelInDirection(client, p2.getX() - p1.getX(), p2.getY() - p1.getY()));
}
return false;
}
/**
* Checks whether this area intersects with another.
*