use of megamek.common.MiscType in project megameklab by MegaMek.
the class BayWeaponCriticalTree method canTakeEquipment.
/**
* Determines whether the equipment can be added to the bay. For a weapon this is determined
* by bay type and AV limit. For ammo this is determined by the presence of a weapon in that location
* that can use the ammo. For weapon enhancements this is determined by the presence of a weapon
* that can use the enhancement that doesn't already have one.
*
* @param bay
* @param eq
* @return
*/
private boolean canTakeEquipment(Mounted bay, Mounted eq) {
if (eq.getType() instanceof WeaponType) {
if (((WeaponType) eq.getType()).getBayType() != bay.getType()) {
return false;
}
// find current av
double av = 0;
for (Integer wNum : bay.getBayWeapons()) {
final Mounted w = eSource.getEntity().getEquipment(wNum);
// That's 1d6 for rifle and 2d6 for canon.
if (w.getType().hasFlag(WeaponType.F_PLASMA)) {
if (((WeaponType) w.getType()).getDamage() == WeaponType.DAMAGE_VARIABLE) {
av += 7;
} else {
av += 13.5;
}
} else {
av += ((WeaponType) w.getType()).getShortAV();
}
// Capacitors in bays are always considered charged.
if ((w.getLinkedBy() != null) && (w.getLinkedBy().getType().hasFlag(MiscType.F_PPC_CAPACITOR))) {
av += 5;
}
}
if (((WeaponType) eq.getType()).isCapital()) {
return av + ((WeaponType) eq.getType()).getShortAV() <= 70;
} else {
return av + ((WeaponType) eq.getType()).getShortAV() <= 700;
}
} else if (eq.getType() instanceof AmmoType) {
for (int eqNum : bay.getBayWeapons()) {
final WeaponType weapon = (WeaponType) eSource.getEntity().getEquipment(eqNum).getType();
if ((weapon.getAmmoType() == ((AmmoType) eq.getType()).getAmmoType()) && (weapon.getRackSize() == ((AmmoType) eq.getType()).getRackSize())) {
return true;
}
}
} else if ((eq.getType() instanceof MiscType) && ((eq.getType().hasFlag(MiscType.F_ARTEMIS) || eq.getType().hasFlag(MiscType.F_ARTEMIS_V)) || eq.getType().hasFlag(MiscType.F_ARTEMIS_PROTO))) {
for (int eqNum : bay.getBayWeapons()) {
final Mounted weapon = eSource.getEntity().getEquipment(eqNum);
final WeaponType wtype = (WeaponType) weapon.getType();
if ((weapon.getLinkedBy() == null) && ((wtype.getAmmoType() == AmmoType.T_LRM) || (wtype.getAmmoType() == AmmoType.T_SRM) || (wtype.getAmmoType() == AmmoType.T_MML) || (wtype.getAmmoType() == AmmoType.T_NLRM))) {
return true;
}
}
} else if ((eq.getType() instanceof MiscType) && eq.getType().hasFlag(MiscType.F_APOLLO)) {
for (int eqNum : bay.getBayWeapons()) {
final Mounted weapon = eSource.getEntity().getEquipment(eqNum);
final WeaponType wtype = (WeaponType) weapon.getType();
if ((weapon.getLinkedBy() == null) && (wtype.getAmmoType() == AmmoType.T_MRM)) {
return true;
}
}
} else if ((eq.getType() instanceof MiscType) && eq.getType().hasFlag(MiscType.F_PPC_CAPACITOR) && (bay.getType() instanceof PPCBayWeapon)) {
for (int eqNum : bay.getBayWeapons()) {
if (eSource.getEntity().getEquipment(eqNum).getLinkedBy() == null) {
return true;
}
}
}
return false;
}
use of megamek.common.MiscType in project megameklab by MegaMek.
the class BayWeaponCriticalTree method addToBay.
/**
* Adds an equipment mount to a bay. Changes the equipment mount's location and updates the bay's
* weapon or ammo list if necessary.
*
* @param bay
* @param eq
*/
public void addToBay(@Nullable Mounted bay, Mounted eq) {
// Check that we have a bay
if ((null == bay) || !canTakeEquipment(bay, eq)) {
if (eq.getType() instanceof WeaponType) {
EquipmentType bayType = ((WeaponType) eq.getType()).getBayType();
addToNewBay(bayType, eq);
} else {
addToLocation(eq);
}
return;
} else if (eq.getType() instanceof MiscType) {
if (eq.getType().hasFlag(MiscType.F_ARTEMIS) || eq.getType().hasFlag(MiscType.F_ARTEMIS_PROTO) || eq.getType().hasFlag(MiscType.F_ARTEMIS_V)) {
for (Integer eqNum : bay.getBayWeapons()) {
final Mounted weapon = eSource.getEntity().getEquipment(eqNum);
final WeaponType wtype = (WeaponType) weapon.getType();
if ((weapon.getLinkedBy() == null) && ((wtype.getAmmoType() == AmmoType.T_LRM) || (wtype.getAmmoType() == AmmoType.T_SRM) || (wtype.getAmmoType() == AmmoType.T_MML) || (wtype.getAmmoType() == AmmoType.T_NLRM))) {
moveToArc(eq);
eq.setLinked(weapon);
break;
}
}
} else if (eq.getType().hasFlag(MiscType.F_APOLLO) || eq.getType().hasFlag(MiscType.F_PPC_CAPACITOR)) {
for (Integer eqNum : bay.getBayWeapons()) {
final Mounted weapon = eSource.getEntity().getEquipment(eqNum);
if (weapon.getLinkedBy() == null) {
moveToArc(eq);
eq.setLinked(weapon);
break;
}
}
}
} else {
// there.
if (eq.getType() instanceof AmmoType) {
Optional<Mounted> addMount = bay.getBayAmmo().stream().map(n -> eSource.getEntity().getEquipment(n)).filter(m -> m.getType() == eq.getType()).findFirst();
if (addMount.isPresent()) {
addMount.get().setShotsLeft(addMount.get().getBaseShotsLeft() + eq.getBaseShotsLeft());
UnitUtil.removeMounted(eSource.getEntity(), eq);
refresh.refreshEquipment();
refresh.refreshBuild();
refresh.refreshPreview();
refresh.refreshStatus();
refresh.refreshSummary();
return;
}
}
EquipmentNode bayNode = null;
for (Enumeration<?> e = ((TreeNode) model.getRoot()).children(); e.hasMoreElements(); ) {
final EquipmentNode node = (EquipmentNode) e.nextElement();
if (node.getMounted() == bay) {
bayNode = node;
break;
}
}
if (null != bayNode) {
moveToArc(eq);
EquipmentNode eqNode = new EquipmentNode(eq);
model.insertNodeInto(eqNode, bayNode, bayNode.getChildCount());
eqNode.setParent(bayNode);
if (eq.getType() instanceof WeaponType) {
bay.addWeaponToBay(eSource.getEntity().getEquipmentNum(eq));
if (eq.getLinkedBy() != null) {
moveToArc(eq.getLinkedBy());
}
} else if (eq.getType() instanceof AmmoType) {
bay.addAmmoToBay(eSource.getEntity().getEquipmentNum(eq));
}
} else {
// $NON-NLS-1$
MegaMekLab.getLogger().log(// $NON-NLS-1$
BayWeaponCriticalTree.class, // $NON-NLS-1$
"addToBay(Mounted,Mounted)", LogLevel.DEBUG, // $NON-NLS-1$
bay.getName() + "[" + eSource.getEntity().getEquipmentNum(bay) + "] not found in " + // $NON-NLS-1$
getLocationName());
}
}
refresh.refreshEquipment();
refresh.refreshBuild();
refresh.refreshPreview();
refresh.refreshStatus();
refresh.refreshSummary();
}
use of megamek.common.MiscType in project megameklab by MegaMek.
the class PrintMech method writeEquipment.
@Override
protected void writeEquipment(SVGRectElement svgRect) {
Map<Integer, Map<RecordSheetEquipmentLine, Integer>> eqMap = new TreeMap<>();
Map<String, Integer> ammo = new TreeMap<>();
for (Mounted m : mech.getEquipment()) {
if ((m.getType() instanceof AmmoType) && (((AmmoType) m.getType()).getAmmoType() != AmmoType.T_COOLANT_POD)) {
if (m.getLocation() != Entity.LOC_NONE) {
String shortName = m.getType().getShortName().replace("Ammo", "");
shortName = shortName.replace("(Clan)", "");
String munition = ((AmmoType) m.getType()).getSubMunitionName().replace("(Clan) ", "");
shortName = shortName.replace(munition, "");
ammo.merge(shortName.trim(), m.getBaseShotsLeft(), Integer::sum);
}
continue;
}
if ((m.getType() instanceof AmmoType) || (m.getLocation() == Entity.LOC_NONE) || !UnitUtil.isPrintableEquipment(m.getType(), true)) {
continue;
}
if (mech.hasETypeFlag(Entity.ETYPE_QUADVEE) && (m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_TRACKS)) {
continue;
}
eqMap.putIfAbsent(m.getLocation(), new HashMap<>());
RecordSheetEquipmentLine line = new RecordSheetEquipmentLine(m);
eqMap.get(m.getLocation()).merge(line, 1, Integer::sum);
}
Rectangle2D bbox = getRectBBox(svgRect);
Element canvas = (Element) ((Node) svgRect).getParentNode();
int viewWidth = (int) bbox.getWidth();
int viewHeight = (int) bbox.getHeight();
int viewX = (int) bbox.getX();
int viewY = (int) bbox.getY();
int qtyX = (int) Math.round(viewX + viewWidth * 0.037);
int nameX = (int) Math.round(viewX + viewWidth * 0.08);
int locX = (int) Math.round(viewX + viewWidth * 0.41);
int heatX = (int) Math.round(viewX + viewWidth * 0.48);
int dmgX = (int) Math.round(viewX + viewWidth * 0.53);
int minX = (int) Math.round(viewX + viewWidth * 0.75);
int shortX = (int) Math.round(viewX + viewWidth * 0.82);
int medX = (int) Math.round(viewX + viewWidth * 0.89);
int longX = (int) Math.round(viewX + viewWidth * 0.96);
int indent = (int) Math.round(viewWidth * 0.02);
int currY = viewY + 10;
float fontSize = FONT_SIZE_MEDIUM;
float lineHeight = getFontHeight(fontSize) * 0.8f;
addTextElement(canvas, qtyX, currY, "Qty", fontSize, "middle", "bold");
addTextElement(canvas, nameX + indent, currY, "Type", fontSize, "start", "bold");
addTextElement(canvas, locX, currY, "Loc", fontSize, "middle", "bold");
addTextElement(canvas, heatX, currY, "Ht", fontSize, "middle", "bold");
addTextElement(canvas, dmgX, currY, "Dmg", fontSize, "start", "bold");
addTextElement(canvas, minX, currY, "Min", fontSize, "middle", "bold");
addTextElement(canvas, shortX, currY, "Sht", fontSize, "middle", "bold");
addTextElement(canvas, medX, currY, "Med", fontSize, "middle", "bold");
addTextElement(canvas, longX, currY, "Lng", fontSize, "middle", "bold");
currY += lineHeight * 1.2;
int lines = 0;
for (Integer loc : eqMap.keySet()) {
for (RecordSheetEquipmentLine line : eqMap.get(loc).keySet()) {
int rows = line.nRows();
if ((rows == 1) && (getTextLength(line.getNameField(0, mech.isMixedTech()), fontSize) > locX - nameX)) {
rows++;
}
lines += rows;
}
}
if (lines > 12) {
lineHeight = getFontHeight(fontSize) * 0.8f;
}
if (lines > 16) {
fontSize = FONT_SIZE_SMALL;
}
if (lines > 20) {
fontSize = FONT_SIZE_VSMALL;
}
for (Integer loc : eqMap.keySet()) {
for (RecordSheetEquipmentLine line : eqMap.get(loc).keySet()) {
for (int row = 0; row < line.nRows(); row++) {
if (row == 0) {
addTextElement(canvas, qtyX, currY, Integer.toString(eqMap.get(loc).get(line)), fontSize, "middle", "normal");
lines = addMultilineTextElement(canvas, nameX, currY, locX - nameX - indent, lineHeight, line.getNameField(row, mech.isMixedTech()), fontSize, "start", "normal");
} else {
lines = addMultilineTextElement(canvas, nameX + indent, currY, locX - nameX - indent, lineHeight, line.getNameField(row, mech.isMixedTech()), fontSize, "start", "normal");
}
addTextElement(canvas, locX, currY, line.getLocationField(row), fontSize, "middle", "normal");
addTextElement(canvas, heatX, currY, line.getHeatField(row), fontSize, "middle", "normal");
lines = Math.max(lines, addMultilineTextElement(canvas, dmgX, currY, minX - dmgX, lineHeight, line.getDamageField(row), fontSize, "start", "normal"));
addTextElement(canvas, minX, currY, line.getMinField(row), fontSize, "middle", "normal");
addTextElement(canvas, shortX, currY, line.getShortField(row), fontSize, "middle", "normal");
addTextElement(canvas, medX, currY, line.getMediumField(row), fontSize, "middle", "normal");
addTextElement(canvas, longX, currY, line.getLongField(row), fontSize, "middle", "normal");
currY += lineHeight * lines;
}
}
}
StringJoiner quirksList = new StringJoiner(", ");
Quirks quirks = mech.getQuirks();
for (Enumeration<IOptionGroup> optionGroups = quirks.getGroups(); optionGroups.hasMoreElements(); ) {
IOptionGroup optiongroup = optionGroups.nextElement();
if (quirks.count(optiongroup.getKey()) > 0) {
for (Enumeration<IOption> options = optiongroup.getOptions(); options.hasMoreElements(); ) {
IOption option = options.nextElement();
if (option != null && option.booleanValue()) {
quirksList.add(option.getDisplayableNameWithValue());
}
}
}
}
if ((ammo.size() > 0) || (quirksList.length() > 0)) {
Element svgGroup = getSVGDocument().createElementNS(svgNS, SVGConstants.SVG_G_TAG);
canvas.appendChild(svgGroup);
lines = 0;
if (ammo.size() > 0) {
lines = addMultilineTextElement(svgGroup, viewX + viewWidth * 0.025, 0, viewWidth * 0.95, lineHeight, "Ammo: " + ammo.entrySet().stream().map(e -> String.format("(%s) %d", e.getKey(), e.getValue())).collect(Collectors.joining(", ")), fontSize, "start", "normal");
}
if (quirksList.length() > 0) {
lines += addMultilineTextElement(svgGroup, viewX + viewWidth * 0.025, lines * lineHeight, viewWidth * 0.95, lineHeight, "Quirks: " + quirksList.toString(), fontSize, "start", "normal");
}
svgGroup.setAttributeNS(null, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, String.format("translate(0,%f)", viewY + viewHeight - lines * lineHeight));
}
}
use of megamek.common.MiscType in project megameklab by MegaMek.
the class PrintMech method writeLocationCriticals.
private void writeLocationCriticals(int loc, SVGRectElement svgRect) {
Rectangle2D bbox = getRectBBox(svgRect);
Element canvas = (Element) ((Node) svgRect).getParentNode();
int viewWidth = (int) bbox.getWidth();
int viewHeight = (int) bbox.getHeight();
int viewX = (int) bbox.getX();
int viewY = (int) bbox.getY();
double rollX = viewX;
double critX = viewX + viewWidth * 0.11;
double gap = 0;
if (mech.getNumberOfCriticals(loc) > 6) {
gap = viewHeight * 0.05;
}
double lineHeight = (viewHeight - gap) / mech.getNumberOfCriticals(loc);
double currY = viewY;
float fontSize = (float) lineHeight * 0.85f;
Mounted startingMount = null;
double startingMountY = 0;
double endingMountY = 0;
double connWidth = viewWidth * 0.02;
double x = viewX + viewWidth * 0.075;
x += addTextElement(canvas, x, viewY - 1, mech.getLocationName(loc), fontSize * 1.25f, "start", "bold");
if (mech.isClan() && UnitUtil.hasAmmo(mech, loc) && !mech.hasCASEII(loc)) {
addTextElement(canvas, x + fontSize / 2, viewY - 1, "(CASE)", fontSize, "start", "normal");
}
for (int slot = 0; slot < mech.getNumberOfCriticals(loc); slot++) {
currY += lineHeight;
if (slot == 6) {
currY += gap;
}
addTextElement(canvas, rollX, currY, ((slot % 6) + 1) + ".", fontSize, "start", "bold");
CriticalSlot crit = mech.getCritical(loc, slot);
String style = "bold";
String fill = "#000000";
if ((null == crit) || ((crit.getType() == CriticalSlot.TYPE_EQUIPMENT) && (!crit.getMount().getType().isHittable()))) {
style = "standard";
fill = "#3f3f3f";
addTextElement(canvas, critX, currY, formatCritName(crit), fontSize, "start", style, fill);
} else if (crit.isArmored()) {
Element pip = createPip(critX, currY - fontSize * 0.8, fontSize * 0.4, 0.7);
canvas.appendChild(pip);
addTextElement(canvas, critX + fontSize, currY, formatCritName(crit), fontSize, "start", style, fill);
} else if ((crit.getType() == CriticalSlot.TYPE_EQUIPMENT) && (crit.getMount().getType() instanceof MiscType) && (crit.getMount().getType().hasFlag(MiscType.F_MODULAR_ARMOR))) {
String critName = formatCritName(crit);
addTextElement(canvas, critX, currY, critName, fontSize, "start", style, fill);
x = critX + getTextLength(critName, fontSize);
double remainingW = viewX + viewWidth - x;
double spacing = remainingW / 6.0;
double radius = spacing * 0.25;
double y = currY - lineHeight + spacing;
double y2 = currY - spacing;
x += spacing;
for (int i = 0; i < 10; i++) {
if (i == 5) {
x -= spacing * 5.5;
y = y2;
}
Element pip = createPip(x, y, radius, 0.5);
canvas.appendChild(pip);
x += spacing;
}
} else {
addTextElement(canvas, critX, currY, formatCritName(crit), fontSize, "start", style, fill);
}
Mounted m = null;
if ((null != crit) && (crit.getType() == CriticalSlot.TYPE_EQUIPMENT) && (crit.getMount().getType().isHittable()) && (crit.getMount().getType().getCriticals(mech) > (mech.isSuperHeavy() ? 2 : 1))) {
m = crit.getMount();
}
if ((startingMount != null) && (startingMount != m)) {
connectSlots(canvas, critX - 1, startingMountY, connWidth, endingMountY - startingMountY);
}
if (m != startingMount) {
startingMount = m;
if (null != m) {
startingMountY = currY - lineHeight * 0.6;
}
} else {
endingMountY = currY;
}
}
if ((null != startingMount) && (mech.getNumberOfCriticals(startingMount.getType(), loc) > 1)) {
connectSlots(canvas, critX - 1, startingMountY, connWidth, endingMountY - startingMountY);
}
}
use of megamek.common.MiscType in project megameklab by MegaMek.
the class CriticalTransferHandler method addEquipmentMech.
/**
* @param mech
* @param eq
* @return
*/
private boolean addEquipmentMech(Mech mech, Mounted eq, int slotNumber) throws LocationFullException {
int totalCrits = UnitUtil.getCritsUsed(getUnit(), eq.getType());
// How much space we have in the selected location
int primaryLocSpace = UnitUtil.getContiguousNumberOfCrits(getUnit(), location, slotNumber);
if ((eq.getType().isSpreadable() || eq.isSplitable()) && (totalCrits > 1)) {
int critsUsed = 0;
int primaryLocation = location;
int nextLocation = getUnit().getTransferLocation(location);
// Determine if we should spread equipment over multiple locations
if ((eq.getType().getCriticals(getUnit()) > primaryLocSpace) && !((eq.getType() instanceof MiscType) && eq.getType().hasFlag(MiscType.F_TARGCOMP)) && !(getUnit() instanceof LandAirMech)) {
if (location == Mech.LOC_RT) {
String[] locations = { "Center Torso", "Right Leg", "Right Arm" };
JComboBox<String> combo = new JComboBox<String>(locations);
JOptionPane jop = new JOptionPane(combo, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
JDialog dlg = jop.createDialog("Select secondary location.");
combo.grabFocus();
combo.getEditor().selectAll();
dlg.setVisible(true);
int value = ((Integer) jop.getValue()).intValue();
if (value == JOptionPane.CANCEL_OPTION) {
return false;
}
if (combo.getSelectedIndex() == 1) {
nextLocation = Mech.LOC_RLEG;
} else if (combo.getSelectedIndex() == 2) {
nextLocation = Mech.LOC_RARM;
}
} else if (location == Mech.LOC_LT) {
String[] locations = { "Center Torso", "Left Leg", "Left Arm" };
JComboBox<String> combo = new JComboBox<String>(locations);
JOptionPane jop = new JOptionPane(combo, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
JDialog dlg = jop.createDialog("Select secondary location.");
combo.grabFocus();
combo.getEditor().selectAll();
dlg.setVisible(true);
int value = ((Integer) jop.getValue()).intValue();
if (value == JOptionPane.CANCEL_OPTION) {
return false;
}
if (combo.getSelectedIndex() == 1) {
nextLocation = Mech.LOC_LLEG;
} else if (combo.getSelectedIndex() == 2) {
nextLocation = Mech.LOC_LARM;
}
} else if (location == Mech.LOC_CT) {
String[] locations = { "Left Torso", "Right Torso" };
JComboBox<String> combo = new JComboBox<String>(locations);
JOptionPane jop = new JOptionPane(combo, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION);
JDialog dlg = jop.createDialog(null, "Select secondary location.");
combo.grabFocus();
combo.getEditor().selectAll();
dlg.setVisible(true);
int value = ((Integer) jop.getValue()).intValue();
if (value == JOptionPane.CANCEL_OPTION) {
return false;
}
if (combo.getSelectedIndex() == 1) {
nextLocation = Mech.LOC_RT;
} else {
nextLocation = Mech.LOC_LT;
}
}
}
// Determine how much usable space we have in both locations
int secondarySpace = UnitUtil.getHighestContinuousNumberOfCrits(getUnit(), nextLocation);
// Check for available space
if ((primaryLocSpace < totalCrits) && ((nextLocation == Entity.LOC_DESTROYED) || ((primaryLocSpace + secondarySpace) < totalCrits))) {
throw new LocationFullException(eq.getName() + " does not fit there in " + getUnit().getLocationAbbr(location) + " on " + getUnit().getDisplayName());
}
int currLoc = location;
for (; critsUsed < totalCrits; critsUsed++) {
mech.addEquipment(eq, currLoc, false, slotNumber);
slotNumber = (slotNumber + 1) % mech.getNumberOfCriticals(currLoc);
primaryLocSpace--;
if (primaryLocSpace == 0) {
slotNumber = 0;
currLoc = nextLocation;
totalCrits -= critsUsed;
critsUsed = 0;
}
}
int secondary = Entity.LOC_NONE;
if ((primaryLocSpace <= 0) && (slotNumber > 0)) {
secondary = nextLocation;
}
changeMountStatus(eq, primaryLocation, secondary, false);
} else if (primaryLocSpace >= totalCrits) {
if ((eq.getType() instanceof WeaponType) && eq.getType().hasFlag(WeaponType.F_VGL)) {
String[] facings;
if (location == Mech.LOC_LT) {
facings = new String[4];
facings[0] = "Front";
facings[1] = "Front-Left";
facings[2] = "Rear-Left";
facings[3] = "Rear";
} else if (location == Mech.LOC_RT) {
facings = new String[4];
facings[0] = "Front";
facings[1] = "Front-Right";
facings[2] = "Rear-Right";
facings[3] = "Rear";
} else if (location == Mech.LOC_CT) {
facings = new String[2];
facings[0] = "Front";
facings[1] = "Rear";
} else {
JOptionPane.showMessageDialog(null, "VGL must be placed in torso location!", "Invalid location", JOptionPane.WARNING_MESSAGE);
return false;
}
String facing = (String) JOptionPane.showInputDialog(null, "Please choose the facing of the VGL", "Choose Facing", JOptionPane.QUESTION_MESSAGE, null, facings, facings[0]);
if (facing == null) {
return false;
}
mech.addEquipment(eq, location, false, slotNumber);
if (facing.equals("Front-Left")) {
eq.setFacing(5);
} else if (facing.equals("Front-Right")) {
eq.setFacing(1);
} else if (facing.equals("Rear-Right")) {
eq.setFacing(2);
} else if (facing.equals("Rear-Left")) {
eq.setFacing(4);
} else if (facing.equals("Rear")) {
eq.setFacing(3);
UnitUtil.changeMountStatus(getUnit(), eq, location, -1, true);
}
} else {
mech.addEquipment(eq, location, false, slotNumber);
}
changeMountStatus(eq, location, false);
} else {
throw new LocationFullException(eq.getName() + " does not fit there in " + getUnit().getLocationAbbr(location) + " on " + getUnit().getDisplayName());
}
return true;
}
Aggregations