/** * Update sensors. Use the active sensor of the first fighter in the squadron that hasn't taken 3 sensor hits * BAPs don't count as active sensors in space, but they do make detection rolls easier */ public void updateSensors() { if (getActiveSensor() == null) { for (Integer fId : fighters) { Entity entity = game.getEntity(fId); Aero fighter = (Aero) entity; if (fighter.getSensorHits() > 2) { // Sensors destroyed. Check the next fighter continue; } if (fighter.getActiveSensor().isBAP()) { //BAP active. Check the next fighter continue; } if (fighter.getActiveSensor() != null) { for (Sensor sensor : fighter.getSensors()) { getSensors().add(sensor); } setNextSensor(getSensors().firstElement()); break; } } } }