Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair Tab: Adding better information blockers for Null/Void Signature System and Chameleon Shield #2381

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.";
Windchild292 marked this conversation as resolved.
Show resolved Hide resolved
} 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