Class EquipmentKitIssuer

java.lang.Object
mekhq.campaign.personnel.quartermaster.AbstractKitIssuer
mekhq.campaign.personnel.quartermaster.EquipmentKitIssuer

public final class EquipmentKitIssuer extends AbstractKitIssuer
The warehouse side of issuing equipment kits, mirroring ArmorKitIssuer: drawing a kit out of a person's stores to issue it, returning one when a kit is removed, and issuing the configured defaults on recruitment, on a role change, on request, and when a default is changed.

The shared warehouse mechanics — counting stock, pricing, ordering, and the acquisition-difficulty benchmark — live in AbstractKitIssuer. This class adds the equipment-kit specifics: a person carries up to two equipment kits, one per KitSlot, separate from their armor kit. The primary slot takes the default kit of their primary role, the secondary slot that of their secondary role.

Since:
0.51.01
  • Method Details

    • issueFromStock

      public static boolean issueFromStock(Person person, megamek.common.equipment.EquipmentType kit, Campaign campaign)
      Draws one kit from the person's stores and puts it in their primary kit slot.
      See Also:
    • issueFromStock

      public static boolean issueFromStock(Person person, megamek.common.equipment.EquipmentType kit, KitSlot slot, Campaign campaign)
      Draws one kit from the person's stores and puts it in the given kit slot, returning whatever that slot held to stores. Does nothing and reports failure if the person has no stores or none of the kit is in stock. Issuing a kit the person already carries (in either slot) succeeds without drawing stock.
      Parameters:
      person - the person to kit
      kit - the kit to issue
      slot - the kit slot to fill
      campaign - the campaign the kit belongs to
      Returns:
      true if the person now carries the kit
      Since:
      0.51.01
    • removeKit

      public static boolean removeKit(Person person, megamek.common.equipment.EquipmentType kit, Campaign campaign)
      Removes a kit the person carries, from whichever slot holds it, and returns it to their stores. Does nothing if they do not carry it.
      Parameters:
      person - the person to strip the kit from
      kit - the kit to remove
      campaign - the campaign the returned kit belongs to
      Returns:
      true if the kit was carried and has been removed
    • removeKit

      public static boolean removeKit(Person person, KitSlot slot, Campaign campaign)
      Empties a kit slot, returning its kit to the person's stores.
      Parameters:
      person - the person to strip
      slot - the kit slot to empty
      campaign - the campaign the returned kit belongs to
      Returns:
      true if the slot held a kit
      Since:
      0.51.01
    • equipAllTechsWithBasicToolKit

      public static void equipAllTechsWithBasicToolKit(Campaign campaign)
      Issues a Basic Toolkit to every active technician who carries no tool kit at all — a one-off convenience granted when the "Techs Need a Tool Kit" requirement is first enabled, so the workforce is not immediately unable to make repairs. No stock is consumed and nothing is charged. The toolkit goes into a free kit slot; a technician with both slots full has their secondary kit returned to stores to make room.
      Parameters:
      campaign - the campaign whose technicians are equipped
      Since:
      0.51.01
    • equipDefaultToolKitOnRecruitment

      public static void equipDefaultToolKitOnRecruitment(Person person, Campaign campaign, boolean gmAdd)
      On joining the campaign, a new person is issued the default kit configured for each of their roles: their primary role's default into the primary kit slot, their secondary role's into the secondary slot. A kit in stores is issued at once. Otherwise a GM-added character is granted it directly, and a regular recruit has it ordered and remembered (when the campaign is set to procure recruits' kits) so it is issued when it arrives. Does nothing for a role whose default is "none", a kit the person already carries or awaits, or an unknown kit.
      Parameters:
      person - the freshly recruited person
      campaign - the campaign they joined
      gmAdd - true if the character is being added by the GM (kits are granted directly)
    • equipDefaultToolKitOnRoleChange

      public static void equipDefaultToolKitOnRoleChange(Person person, KitSlot changedSlot, Campaign campaign)
      After a person's role changes, issues the new role's default kit — but only into a free kit slot, never over a kit they already carry or await. The slot matching the changed role is preferred, falling back to the other slot. A kit in stores is issued at once; otherwise, when the campaign is set to procure recruits' kits, it is ordered and remembered.
      Parameters:
      person - the person whose role changed
      changedSlot - the slot whose role changed (KitSlot.PRIMARY for the primary role)
      campaign - the campaign
      Since:
      0.51.01
    • issueDefaultKits

      public static void issueDefaultKits(Collection<Person> people, Campaign campaign, AbstractKitIssuer.KitIssueTotals totals)
      Swaps each of the given people onto their roles' default kits: the primary role's default into the primary slot and the secondary role's into the secondary slot, returning whatever those slots held to stores. Kits come from stores; any shortfall is ordered (and paid for) and issued when it arrives. A role with no default leaves its slot unchanged.
      Parameters:
      people - the people to re-kit
      campaign - the campaign
      totals - accumulates how many kits were issued and ordered
      Since:
      0.51.01
    • switchDefaultKit

      public static void switchDefaultKit(Campaign campaign, EquipmentKitCatalog.KitProfession profession, String oldKitName, megamek.common.equipment.EquipmentType newKit, AbstractKitIssuer.KitIssueTotals totals)
      Moves everyone carrying a profession's old default kit onto its new default, after that campaign option has changed. Only the slot filled by that profession's role is switched. The new kit comes from stores, returning the old one; any shortfall is ordered (and paid for) and swapped in when it arrives.
      Parameters:
      campaign - the campaign
      profession - the profession whose default changed
      oldKitName - the previous default kit internal name
      newKit - the new default kit
      totals - accumulates how many kits were issued and ordered
      Since:
      0.51.01
    • defaultKitOption

      public static CampaignOption<String> defaultKitOption(EquipmentKitCatalog.KitProfession profession)
      Parameters:
      profession - a kit profession
      Returns:
      the campaign option holding that profession's default equipment kit
      Since:
      0.51.01
    • fulfillPendingToolKits

      public static void fulfillPendingToolKits(Campaign campaign)
      Issues any awaited equipment kits that have since arrived in stores. For each active person waiting on a kit for either slot, if their stores now hold it, the kit is drawn into that slot and the intent cleared. Run each day, after deliveries.
      Parameters:
      campaign - the campaign to sweep