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

Fix targeting computers being spreadable #5222

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions megamek/src/megamek/common/MiscType.java
Original file line number Diff line number Diff line change
Expand Up @@ -5502,7 +5502,6 @@ public static MiscType createISTargComp() {
misc.flags = misc.flags.or(F_TARGCOMP).or(F_MECH_EQUIPMENT).or(F_TANK_EQUIPMENT).or(F_SUPPORT_TANK_EQUIPMENT)
.or(F_FIGHTER_EQUIPMENT).or(F_HEAVY_EQUIPMENT);
// see note above
misc.spreadable = true;
String[] modes = { "Normal", "Aimed shot" };
misc.setModes(modes);
misc.rulesRefs = "238, TM";
Expand Down Expand Up @@ -5530,7 +5529,6 @@ public static MiscType createCLTargComp() {
misc.flags = misc.flags.or(F_TARGCOMP).or(F_MECH_EQUIPMENT).or(F_TANK_EQUIPMENT).or(F_SUPPORT_TANK_EQUIPMENT)
.or(F_FIGHTER_EQUIPMENT).or(F_HEAVY_EQUIPMENT);
// see note above
misc.spreadable = true;
String[] modes = { "Normal", "Aimed shot" };
misc.setModes(modes);
misc.rulesRefs = "238, TM";
Expand Down
10 changes: 10 additions & 0 deletions megamek/src/megamek/common/loaders/MtfFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,16 @@ private void parseCrits(Mech mech, int loc) throws EntityLoadingException {
isTurreted);
m.setOmniPodMounted(isOmniPod);
hSharedEquip.put(etype, m);
} else if (etype.hasFlag(MiscType.F_TARGCOMP)) {
// Targeting computers are special, they need to be loaded like spreadable equipment, but they aren't spreadable
Mounted m = hSharedEquip.get(etype);
if (m == null) {
m = mech.addEquipment(etype, loc, rearMounted, BattleArmor.MOUNT_LOC_NONE, isArmored, isTurreted);
m.setOmniPodMounted(isOmniPod);
hSharedEquip.put(etype, m);
}
mech.addCritical(loc, new CriticalSlot(m));

} else if (((etype instanceof WeaponType) && ((WeaponType) etype).isSplitable()) || ((etype instanceof MiscType) && etype.hasFlag(MiscType.F_SPLITABLE))) {
// do we already have this one in this or an outer location?
Mounted m = null;
Expand Down
Loading