sup, FS.

is there a way i can get all ships within sertain distance from a beam, i.e. inside a rectangular area, parallel to a beam?

also how can i prevent getnearestally(ship_sample) from picking ship_sample's modules, and instead pick next nearest ally.

My reccomendation for the module issue would be to simply put an if-case inside the getnearestally(ship_sample) function, like so:

if (currentShip.getParent() == ship_sample) {

continue;

}

Where currentShip is the ship you are currently checking the distance for.

As for the beam... it's possible to get the formula for that area mathematically and then check all enemies in range to see if they fit the formula. But i suspect that is far from the easiest solution, and the formula itself would grow fairly complicated.

Another solution would be to iterate a large amount of circular areas along the beam (simply moving the center coordinate from beamStart to beamEnd with sufficiently small steps), though i doubt that would be particularly performance-friendly.