* @param player player pushing
* @param rpEntity entity pushed
*/
private void tryPush(final Player player, final RPEntity rpEntity) {
if (canPush(player, rpEntity)) {
final Direction dir = player.getDirectionToward(rpEntity);
final int x = rpEntity.getX() + dir.getdx();
final int y = rpEntity.getY() + dir.getdy();
final StendhalRPZone zone = player.getZone();
if (!zone.collides(rpEntity, x, y)) {
move(player, rpEntity, x, y);
// Stop players running toward to make trapping harder. Don't
// stop anyone just following a path (again to make annoying
// others harder)
if (dir.oppositeDirection() == rpEntity.getDirection()
&& !rpEntity.hasPath()) {
rpEntity.stop();
}
}
}