Package mekhq.campaign.universe
Class RATManager
java.lang.Object
mekhq.campaign.universe.AbstractUnitGenerator
mekhq.campaign.universe.RATManager
- All Implemented Interfaces:
IUnitGenerator
Provides a front end to RandomUnitGenerator that allows the user to generate
units
based on criteria such as faction, unit type, and weight class. May be
restricted to
a certain subset of all available RATs.
-
Field Summary
Fields inherited from interface mekhq.campaign.universe.IUnitGenerator
ALL_BATTLE_ARMOR_MODES, ALL_INFANTRY_MODES, BATTLE_ARMOR_MIN_WEIGHT, FOOT_PLATOON_INFANTRY_WEIGHT, MIXED_TANK_VTOL, NO_WEIGHT_LIMIT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<megamek.common.MekSummary>
generate
(int count, String faction, int unitType, int weightClass, int year, int quality, Collection<megamek.common.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, Predicate<megamek.common.MekSummary> filter) Generates a list of units using additional parameters specific to the generation method.List<megamek.common.MekSummary>
generate
(int count, String faction, int unitType, int weightClass, int year, int quality, Predicate<megamek.common.MekSummary> filter) Generates a list of units with an additional test function.List<megamek.common.MekSummary>
generate
(int count, UnitGeneratorParameters parameters) Generates a list of mek summaries from a RAT determined by the given faction, quality and other parameters.megamek.common.MekSummary
generate
(String faction, int unitType, int weightClass, int year, int quality, Collection<megamek.common.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, Predicate<megamek.common.MekSummary> filter) Generate a unit using additional parameters specific to the generation method.megamek.common.MekSummary
generate
(String faction, int unitType, int weightClass, int year, int quality, Predicate<megamek.common.MekSummary> filter) Generate a single unit.megamek.common.MekSummary
generate
(UnitGeneratorParameters parameters) Generates a single unit, for the given faction, using the given set of parameters.boolean
isSupportedUnitType
(int unitType) static void
Scans ratdata directory for list of available RATs that can be used by CampaignOptions to provide a list.void
Remove RAT collection from list of selected RATsvoid
setIgnoreRatEra
(boolean ignore) void
setSelectedRATs
(String[] selected) Replaces selected RAT collections with new listvoid
setSelectedRATs
(List<String> selected) Replaces selected RAT collections with new listvoid
Methods inherited from class mekhq.campaign.universe.AbstractUnitGenerator
generateTurrets
-
Constructor Details
-
RATManager
public RATManager()
-
-
Method Details
-
updateRATConfig
-
setSelectedRATs
Replaces selected RAT collections with new list- Parameters:
selected
- List of RAT collection names
-
setSelectedRATs
Replaces selected RAT collections with new list- Parameters:
selected
- Array of RAT collection names
-
removeRAT
Remove RAT collection from list of selected RATs- Parameters:
collection
- Name of RAT collection to remove
-
setIgnoreRatEra
public void setIgnoreRatEra(boolean ignore) -
getAllRATCollections
- Returns:
- A map of all collections available with a list of eras included
-
populateCollectionNames
public static void populateCollectionNames()Scans ratdata directory for list of available RATs that can be used by CampaignOptions to provide a list. -
isSupportedUnitType
public boolean isSupportedUnitType(int unitType) - Parameters:
unitType
- UnitType constant- Returns:
- true if the generator supports the unit type
-
generate
@Nullable public megamek.common.MekSummary generate(String faction, int unitType, int weightClass, int year, int quality, @Nullable Predicate<megamek.common.MekSummary> filter) Description copied from interface:IUnitGenerator
Generate a single unit.- Parameters:
faction
- Faction shortnameunitType
- UnitType constantweightClass
- EntityWeightClass constant, or -1 for unspecifiedyear
- The year of the campaign datequality
- Index of equipment rating, with zero being the lowest quality.filter
- All generated units return true when the filter function is applied.- Returns:
- A unit that matches the criteria
-
generate
@Nullable public megamek.common.MekSummary generate(String faction, int unitType, int weightClass, int year, int quality, Collection<megamek.common.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, @Nullable Predicate<megamek.common.MekSummary> filter) Description copied from interface:IUnitGenerator
Generate a unit using additional parameters specific to the generation method.- Parameters:
faction
- Faction shortnameunitType
- UnitType constantweightClass
- EntityWeightClass constant, or -1 for unspecifiedyear
- The year of the campaign datequality
- Index of equipment rating, with zero being the lowest quality.movementModes
- A collection of various movement modesmissionRoles
- A collection of various mission rolesfilter
- All generated units return true when the filter function is applied.- Returns:
- A unit that matches the criteria
-
generate
public List<megamek.common.MekSummary> generate(int count, String faction, int unitType, int weightClass, int year, int quality, @Nullable Predicate<megamek.common.MekSummary> filter) Description copied from interface:IUnitGenerator
Generates a list of units with an additional test function.- Parameters:
count
- The number of units to generatefaction
- Faction shortnameunitType
- UnitType constantweightClass
- EntityWeightClass constant, or -1 for unspecifiedyear
- The year of the campaign datequality
- Index of equipment rating, with zero being the lowest quality.filter
- All generated units return true when the filter function is applied.- Returns:
- A list of units matching the criteria.
-
generate
public List<megamek.common.MekSummary> generate(int count, String faction, int unitType, int weightClass, int year, int quality, Collection<megamek.common.EntityMovementMode> movementModes, Collection<megamek.client.ratgenerator.MissionRole> missionRoles, @Nullable Predicate<megamek.common.MekSummary> filter) Description copied from interface:IUnitGenerator
Generates a list of units using additional parameters specific to the generation method.- Parameters:
count
- The number of units to generatefaction
- Faction shortnameunitType
- UnitType constantweightClass
- EntityWeightClass constant, or -1 for unspecifiedyear
- The year of the campaign datequality
- Index of equipment rating, with zero being the lowest quality.movementModes
- A collection of various movement modesmissionRoles
- A collection of various mission rolesfilter
- All generated units return true when the filter function is applied.- Returns:
- A list of units matching the criteria.
-
generate
Generates a single unit, for the given faction, using the given set of parameters. Note that some of the properties of the parameters may be ignored for generation mechanisms that aren't the RAT Generator- Parameters:
parameters
- data structure containing unit generation parameters- Returns:
- Generated units. Null if none generated.
-
generate
Generates a list of mek summaries from a RAT determined by the given faction, quality and other parameters. Note that for the purposes of this implementation, the only properties of "parameters" used are unit type, year, weight classes and movement modes. We also expect the rating to be a number 1-5, rather than A-F.- Parameters:
count
- How many units to generateparameters
- RATGenerator parameters (some are ignored)- Returns:
- List of generated units. Empty if none are generated.
-