Skip to content

Commit

Permalink
Adding better information blockers for multislot equipment
Browse files Browse the repository at this point in the history
  • Loading branch information
Windchild292 committed Jan 19, 2021
1 parent 6c88fdf commit 6761250
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
24 changes: 19 additions & 5 deletions MekHQ/src/mekhq/campaign/parts/MekLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.PrintWriter;
import java.util.StringJoiner;

import megamek.common.MiscType;
import mekhq.campaign.finances.Money;
import mekhq.campaign.parts.enums.PartRepairType;
import org.w3c.dom.Node;
Expand Down Expand Up @@ -641,11 +642,11 @@ public String checkFixable() {
}

//certain other specific crits need to be left out (uggh, must be a better way to do this!)
if (slot.getType() == CriticalSlot.TYPE_SYSTEM
&& (slot.getIndex() == Mech.ACTUATOR_HIP
|| slot.getIndex() == Mech.ACTUATOR_SHOULDER
|| slot.getIndex() == Mech.SYSTEM_LIFE_SUPPORT
|| slot.getIndex() == Mech.SYSTEM_SENSORS)) {
if ((slot.getType() == CriticalSlot.TYPE_SYSTEM)
&& ((slot.getIndex() == Mech.ACTUATOR_HIP)
|| (slot.getIndex() == Mech.ACTUATOR_SHOULDER)
|| (slot.getIndex() == Mech.SYSTEM_LIFE_SUPPORT)
|| (slot.getIndex() == Mech.SYSTEM_SENSORS))) {
continue;
}

Expand All @@ -667,6 +668,19 @@ public String checkFixable() {
}
}

if (slot.getType() == CriticalSlot.TYPE_EQUIPMENT) {
if ((slot.getMount() != null) && !slot.getMount().isDestroyed()) {
EquipmentType equipmentType = slot.getMount().getType();
if (equipmentType.hasFlag(MiscType.F_NULLSIG)) {
return "Null-Signature System must be salvaged or scrapped first.";
} else if (equipmentType.hasFlag(MiscType.F_VOIDSIG)) {
return "Void-Signature System must be salvaged or scrapped first.";
} else if (equipmentType.hasFlag(MiscType.F_CHAMELEON_SHIELD)) {
return "Chameleon shield must be salvaged or scrapped first.";
}
}
}

if (slot.isRepairable()) {
return "Repairable parts in " + unit.getEntity().getLocationName(loc) + " must be salvaged or scrapped first.";
}
Expand Down
17 changes: 15 additions & 2 deletions MekHQ/src/mekhq/campaign/parts/MissingMekLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import megamek.common.IArmorState;
import megamek.common.LandAirMech;
import megamek.common.Mech;
import megamek.common.MiscType;
import megamek.common.TechAdvancement;
import mekhq.MekHqXmlUtil;
import mekhq.campaign.Campaign;
Expand Down Expand Up @@ -244,8 +245,8 @@ public String checkFixable() {
//certain other specific crits need to be left out (uggh, must be a better way to do this!)
if (slot.getType() == CriticalSlot.TYPE_SYSTEM) {
// Skip Hip and Shoulder actuators
if ((slot.getIndex() == Mech.ACTUATOR_HIP
|| slot.getIndex() == Mech.ACTUATOR_SHOULDER)) {
if ((slot.getIndex() == Mech.ACTUATOR_HIP)
|| (slot.getIndex() == Mech.ACTUATOR_SHOULDER)) {
continue;
}
if (unit.getEntity() instanceof LandAirMech) {
Expand All @@ -265,7 +266,19 @@ public String checkFixable() {
}
}
}
} else if (slot.getType() == CriticalSlot.TYPE_EQUIPMENT) {
if ((slot.getMount() != null) && !slot.getMount().isDestroyed()) {
EquipmentType equipmentType = slot.getMount().getType();
if (equipmentType.hasFlag(MiscType.F_NULLSIG)) {
return "Null-Signature System must be salvaged or scrapped first. It can then be re-installed.";
} else if (equipmentType.hasFlag(MiscType.F_VOIDSIG)) {
return "Void-Signature System must be salvaged or scrapped first. It can then be re-installed.";
} else if (equipmentType.hasFlag(MiscType.F_CHAMELEON_SHIELD)) {
return "Chameleon shield must be salvaged or scrapped first. It can then be re-installed.";
}
}
}

if (slot.isRepairable()) {
return "Repairable parts in " + unit.getEntity().getLocationName(loc) + " must be salvaged or scrapped first. They can then be re-installed.";
}
Expand Down
4 changes: 2 additions & 2 deletions MekHQ/src/mekhq/campaign/parts/equipment/EquipmentPart.java
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public String checkFixable() {
if (unit.isLocationBreached(loc)) {
return unit.getEntity().getLocationName(loc) + " is breached.";
}

if (unit.isLocationDestroyed(loc)) {
return unit.getEntity().getLocationName(loc) + " is destroyed.";
}
Expand Down Expand Up @@ -701,7 +701,7 @@ private static void checkWeaponBay(Unit unit, EquipmentType type, int equipmentN
}

// if we are still here then we need to check the other weapons, if any of them
// are usable then we should do the same thing. Otherwise all weapons are destroyed
// are usable then we should do the same thing. Otherwise all weapons are destroyed
// and we should mark the bay as unusuable.
for (int wId : weaponBay.getBayWeapons()) {
final Mounted m = unit.getEntity().getEquipment(wId);
Expand Down

0 comments on commit 6761250

Please sign in to comment.