Class SensorChoiceHandler
mmconf/customSensorChoice.xml.
This is the sensor counterpart of WeaponOrderHandler, and works the same
way: the choice is stored against the unit's chassis and model rather than against one unit, and it is applied by
MekFileParser to every unit of that design as it loads. Because that parser is shared code, a choice saved
in MegaMek is also picked up by MekHQ and MegaMekLab.
Example: a player sets a Marauder MAD-3R to Infrared in the lobby and ticks the box to remember it. Every MAD-3R loaded from then on, in a MegaMek game or a MekHQ campaign, starts on infrared instead of the radar it would otherwise default to.
A SensorFamily is stored rather than a raw Sensor type, so the choice still resolves when a
variant carries a different flavour of the same sensor, and a design that no longer carries anything from the
saved family simply falls back to its normal default.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic SensorFamilygetSensorChoice(String chassis, String model) Returns the sensor family saved for a chassis and model.static voidWrites the saved choices tommconf/customSensorChoice.xml.static voidsetSensorChoice(String chassis, String model, SensorFamily family) Saves a sensor family against a chassis and model.
-
Field Details
-
CUSTOM_SENSOR_CHOICE_FILENAME
- See Also:
-
-
Method Details
-
getSensorChoice
Returns the sensor family saved for a chassis and model.- Parameters:
chassis- the unit's chassismodel- the unit's model- Returns:
- the saved family, or
nullwhen nothing is saved for that design
-
setSensorChoice
Saves a sensor family against a chassis and model. Passnullto forget a design.The change is held in memory until
saveSensorChoiceFile()writes it out, which matches how the custom weapon order is handled.- Parameters:
chassis- the unit's chassismodel- the unit's modelfamily- the family to remember, ornullto forget this design
-
saveSensorChoiceFile
Writes the saved choices tommconf/customSensorChoice.xml. Does nothing when nothing has changed.- Throws:
IOException- if the file cannot be written
-