Enum Class SupportCapability

java.lang.Object
java.lang.Enum<SupportCapability>
mekhq.campaign.universe.commandGeneration.SupportCapability
All Implemented Interfaces:
Serializable, Comparable<SupportCapability>, Constable

public enum SupportCapability extends Enum<SupportCapability>
The support vehicles a command is granted for each capability it switches on, together with everything the rest of support generation needs to know about them: which campaign option grants them, which unit is fielded, how many, which Table of Organisation and Equipment formation holds them, which support section crews them, and whether they add to the mechanic demand.

This is the single list every part of support generation reads. The mechanic count, the company generator, the step that organises staff into support teams, and the campaign-option dialogs all ask this enum rather than repeating the option checks themselves. Keeping one copy is what stops them drifting apart, which is what left a command with no recovery vehicles at all (issue #10059).

Since:
0.51.01
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Mobile canteens feeding the command once fatigue is tracked.
    Flatbed trucks for the StratCon supply convoy, generated with their own crews.
    MASH trucks, crewed by the medical section, scaled to treat the command's combatants.
    Recovery vehicles, crewed by the maintenance section, granted under CamOps salvage rules.
    Rifle infantry guarding prisoners.
  • Method Summary

    Modifier and Type
    Method
    Description
    The role that crews these units, which decides whether they are crewed from the temporary crew pool: ground vehicle crew for the support vehicles, and soldiers for the security detail.
    The support section whose staff crew these vehicles, or null when the vehicles come with their own crews, as the convoy, the canteens and the security detail do.
    The formation these vehicles are filed under in the Table of Organisation and Equipment.
    boolean
    isEnabled(Campaign campaign)
    Whether the campaign has switched this capability on.
    boolean
    Whether these vehicles join a support section rather than being generated with their own crew.
    boolean
    Whether these vehicles need mechanics, so the personnel stage can count them before they exist.
    The resource bundle holding this capability's campaign-option dialog text.
    The key prefix this capability's dialog text uses inside its bundle, so the shared dialog reads the description, and the two button labels, that were written for it.
    int
    targetCount(Campaign campaign, Faction faction)
    How many of the unit a command of this size should field, before subtracting whatever it already owns.
    unitName(Campaign campaign)
    The unit this capability fields, which for the security detail depends on the size of the force and whether the command is Clan.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • SALVAGE

      public static final SupportCapability SALVAGE
      Recovery vehicles, crewed by the maintenance section, granted under CamOps salvage rules.
    • MEDICAL

      public static final SupportCapability MEDICAL
      MASH trucks, crewed by the medical section, scaled to treat the command's combatants.
    • LOGISTICS

      public static final SupportCapability LOGISTICS
      Flatbed trucks for the StratCon supply convoy, generated with their own crews.
    • COMMISSARY

      public static final SupportCapability COMMISSARY
      Mobile canteens feeding the command once fatigue is tracked.
    • SECURITY

      public static final SupportCapability SECURITY
      Rifle infantry guarding prisoners. Infantry carry no mechanic demand.
  • Method Details

    • values

      public static SupportCapability[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SupportCapability valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isEnabled

      public boolean isEnabled(Campaign campaign)
      Whether the campaign has switched this capability on. This is the same check that decides whether the capability's campaign-option dialog offers its free vehicles.
      Parameters:
      campaign - the campaign to inspect
      Returns:
      true when the capability's campaign option is enabled
    • unitName

      @Nullable public String unitName(Campaign campaign)
      The unit this capability fields, which for the security detail depends on the size of the force and whether the command is Clan.
      Parameters:
      campaign - the campaign the vehicles are generated into
      Returns:
      the unit name as the unit cache holds it
    • targetCount

      public int targetCount(Campaign campaign, Faction faction)
      How many of the unit a command of this size should field, before subtracting whatever it already owns.
      Parameters:
      campaign - the campaign the vehicles are generated into
      faction - the faction of the command being supported, which is the campaign's own faction mid-campaign and the generated command's faction during command generation
      Returns:
      the target count
    • formationType

      public SupportTOEFormationTypes formationType()
      The formation these vehicles are filed under in the Table of Organisation and Equipment.
      Returns:
      the support formation type
    • crewSection

      @Nullable public SupportPersonnelToTOE.SupportSection crewSection()
      The support section whose staff crew these vehicles, or null when the vehicles come with their own crews, as the convoy, the canteens and the security detail do.
      Returns:
      the crewing section, or null
    • crewRole

      public PersonnelRole crewRole()
      The role that crews these units, which decides whether they are crewed from the temporary crew pool: ground vehicle crew for the support vehicles, and soldiers for the security detail.
      Returns:
      the crew role
    • needsMechanics

      public boolean needsMechanics()
      Whether these vehicles need mechanics, so the personnel stage can count them before they exist. Infantry do not.
      Returns:
      true when the vehicles add to the mechanic demand
    • joinsSection

      public boolean joinsSection(Campaign campaign)
      Whether these vehicles join a support section rather than being generated with their own crew. A capability joins its section only when it has one and the campaign uses support teams. This is the single rule that decides where every support vehicle goes.
      Parameters:
      campaign - the campaign the vehicles are generated into
      Returns:
      true when the vehicles are built inside their support section
    • resourceBundle

      public String resourceBundle()
      The resource bundle holding this capability's campaign-option dialog text.
      Returns:
      the bundle name
    • resourceKeyPrefix

      public String resourceKeyPrefix()
      The key prefix this capability's dialog text uses inside its bundle, so the shared dialog reads the description, and the two button labels, that were written for it.
      Returns:
      the resource key prefix