Class EquipmentKitIssuer
java.lang.Object
mekhq.campaign.personnel.quartermaster.AbstractKitIssuer
mekhq.campaign.personnel.quartermaster.EquipmentKitIssuer
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
-
Nested Class Summary
Nested classes/interfaces inherited from class mekhq.campaign.personnel.quartermaster.AbstractKitIssuer
AbstractKitIssuer.KitIssueTotals -
Method Summary
Modifier and TypeMethodDescriptionstatic CampaignOption<String> defaultKitOption(EquipmentKitCatalog.KitProfession profession) static voidequipAllTechsWithBasicToolKit(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.static voidequipDefaultToolKitOnRecruitment(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.static voidequipDefaultToolKitOnRoleChange(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.static voidfulfillPendingToolKits(Campaign campaign) Issues any awaited equipment kits that have since arrived in stores.static voidissueDefaultKits(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.static booleanissueFromStock(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.static booleanissueFromStock(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.static booleanRemoves a kit the person carries, from whichever slot holds it, and returns it to their stores.static booleanEmpties a kit slot, returning its kit to the person's stores.static voidswitchDefaultKit(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.Methods inherited from class mekhq.campaign.personnel.quartermaster.AbstractKitIssuer
acquisitionTarget, isKitPart, localStock, localStock, localStock, order, orderShortfall, regularAcquirer, returnedKit, stockIn, template, unitPrice, warehouseFor
-
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 kitkit- the kit to issueslot- the kit slot to fillcampaign- the campaign the kit belongs to- Returns:
trueif 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 fromkit- the kit to removecampaign- the campaign the returned kit belongs to- Returns:
trueif the kit was carried and has been removed
-
removeKit
Empties a kit slot, returning its kit to the person's stores.- Parameters:
person- the person to stripslot- the kit slot to emptycampaign- the campaign the returned kit belongs to- Returns:
trueif the slot held a kit- Since:
- 0.51.01
-
equipAllTechsWithBasicToolKit
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 personcampaign- the campaign they joinedgmAdd-trueif 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 changedchangedSlot- the slot whose role changed (KitSlot.PRIMARYfor 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-kitcampaign- the campaigntotals- 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 campaignprofession- the profession whose default changedoldKitName- the previous default kit internal namenewKit- the new default kittotals- accumulates how many kits were issued and ordered- Since:
- 0.51.01
-
defaultKitOption
- Parameters:
profession- a kit profession- Returns:
- the campaign option holding that profession's default equipment kit
- Since:
- 0.51.01
-
fulfillPendingToolKits
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
-