Package mekhq.campaign.unit
Class TrooperSlots
java.lang.Object
mekhq.campaign.unit.TrooperSlots
Which person wears which suit of a battle armor unit. Each suit is a trooper slot, numbered as MegaMek numbers the
trooper locations, and holds at most one person. A person keeps their suit until they leave the unit, can no longer
fight, or the suit can no longer be worn; anyone without a suit takes the best free one.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindWearersOfLostSuits(megamek.common.battleArmor.BattleArmor battleEntity) Finds the people whose suit was lost in a battle: they wore a suit that came back with no living trooper in it.getOccupant(int slot) static booleanisTrooperSlotsNode(String nodeName) voidreadFromXML(Node trooperSlotsNode) Reads the suit assignments written bywriteToXML(java.io.PrintWriter, int).voidTakes the person out of their suit, if they wear one.Puts the crew in the suits.voidwriteToXML(PrintWriter printWriter, int indent) Writes the suit assignments, if there are any.
-
Constructor Details
-
TrooperSlots
public TrooperSlots()
-
-
Method Details
-
getOccupant
- Parameters:
slot- the trooper slot- Returns:
- the id of the person wearing that suit, or
nullif nobody does
-
findSlot
- Parameters:
personId- the person- Returns:
- the trooper slot the person wears, or
nullif they wear none
-
release
Takes the person out of their suit, if they wear one.- Parameters:
personId- the person
-
seat
Puts the crew in the suits. A person keeps the suit they already wear while it can still be worn; anyone else takes the first free suit inusableSlots. People not increwIdslose their suit.- Parameters:
crewIds- the people able to wear a suit, in the order they choose oneusableSlots- the suits that can be worn, best first- Returns:
- the suits now worn, in the order of
usableSlots
-
findWearersOfLostSuits
Finds the people whose suit was lost in a battle: they wore a suit that came back with no living trooper in it.- Parameters:
battleEntity- the squad as it came back from the battle- Returns:
- the ids of the people in the lost suits
-
writeToXML
Writes the suit assignments, if there are any.- Parameters:
printWriter- where to writeindent- the indent of the opening tag
-
isTrooperSlotsNode
- Parameters:
nodeName- the name of a child node of a saved unit- Returns:
trueif the node holds the suit assignments
-
readFromXML
Reads the suit assignments written bywriteToXML(java.io.PrintWriter, int). An entry that cannot be read is skipped and logged; the person is then seated again the next time the crew is placed.- Parameters:
trooperSlotsNode- thetrooperSlotsnode
-