Skip to content
Open
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
16 changes: 16 additions & 0 deletions megameklab/resources/megameklab/resources/Views.properties
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ MekChassisView.cbEnhancement.tooltip=Mutually incompatible types of myomer enhan
MekChassisView.cbEnhancement.null=None
MekChassisView.chkFullHeadEject.text=Full Head Ejection
MekChassisView.chkFullHeadEject.tooltip=System protects ejected pilot in hostile environment.
MekChassisView.chkDNICockpitMod.text=DNI Cockpit Modification
MekChassisView.chkDNICockpitMod.tooltip=<html>Direct Neural Interface cockpit modification (IO:AE p.62).<br/>Required for pilots with DNI implant. IS only, 250,000 C-bills.</html>
MekChassisView.chkEICockpit.text=Enhanced Imaging Interface
MekChassisView.chkEICockpit.tooltip=<html>Enhanced Imaging (EI) Interface (IO:AE p.69).<br/>Allows use of EI implant abilities. Clan only, 1,500,000 C-bills.</html>
MekChassisView.chkDamageInterruptCircuit.text=Damage Interrupt Circuit
MekChassisView.chkDamageInterruptCircuit.tooltip=<html>Damage Interrupt Circuit (IO:AE p.62).<br/>Reduces internal explosion pilot damage from 2 to 1. IS only, 150 C-bills per seat.</html>
MekChassisView.btnResetChassis.text=Reset Chassis
MekChassisView.btnResetChassis.tooltip=Remove all pod-mounted equipment to strip unit down to base omni chassis.
ProtomekChassisView.cbMotiveType.text=Configuration:
Expand Down Expand Up @@ -135,6 +141,8 @@ CVChassisView.spnPodTroop.text=Pod Troop Space:
CVChassisView.spnPodTroop.tooltip=Pod space devoted to infantry transport.
CVChassisView.btnResetChassis.text=Reset Chassis
CVChassisView.btnResetChassis.tooltip=Remove all pod-mounted equipment and troop space to strip unit down to base omni chassis.
CVChassisView.chkDNICockpitMod.text=DNI Cockpit Modification
CVChassisView.chkDNICockpitMod.tooltip=<html>Direct Neural Interface cockpit modification (IO:AE p.62).<br/>Required for pilots with DNI implant. IS only.</html>
CVTransportView.lblFixed.text=Fixed
CVTransportView.lblPod.text=Pod
CVTransportView.lblTroopSpace.text=Troop Space
Expand All @@ -157,6 +165,8 @@ FighterChassisView.cbCockpit.text=Cockpit:
FighterChassisView.cbCockpit.tooltip=Cockpit type determines cost and weight of cockpit.
FighterChassisView.btnResetChassis.text=Reset Chassis
FighterChassisView.btnResetChassis.tooltip=Remove all pod-mounted equipment and troop space to strip unit down to base omni chassis.
FighterChassisView.chkDNICockpitMod.text=DNI Cockpit Modification
FighterChassisView.chkDNICockpitMod.tooltip=<html>Direct Neural Interface cockpit modification (IO:AE p.62).<br/>Required for pilots with DNI implant. IS only.</html>
DropshipChassisView.spnTonnage.text=Tonnage:
DropshipChassisView.spnTonnage.tooltip=<html>Small Craft range 100-200 tons in 5 ton increments.<br/>Aerodyne Dropships range 200-35,000 tons in 100-ton increments.<br/>Spheroid Dropships range 200-100,000 tons in 100-ton increments.</html>
DropshipChassisView.chkFunction.text=Military
Expand Down Expand Up @@ -389,6 +399,10 @@ BAEnhancementView.chkMechJumpBooster.text=Mechanical Jump Booster
BAEnhancementView.chkMechJumpBooster.tooltip=Provides one jump MP apart from any other movement mode, may be used underwater.
BAEnhancementView.chkMyomerBooster.text=Myomer Booster
BAEnhancementView.chkMyomerBooster.tooltip=Increases ground MP. Clan tech base only.
BAEnhancementView.chkDNICockpitMod.text=DNI Cockpit Modification
BAEnhancementView.chkDNICockpitMod.tooltip=<html>Direct Neural Interface cockpit modification (IO:AE p.62).<br/>Required for pilots with DNI implant. IS only.</html>
BAEnhancementView.chkEIInterface.text=Enhanced Imaging Interface
BAEnhancementView.chkEIInterface.tooltip=<html>Enhanced Imaging (EI) Interface (IO:AE p.69).<br/>Allows use of EI implant abilities. Clan only, Experimental.</html>
DropshipCriticalView.aerodyneArcs.values=Nose,Left Wing,Right Wing,Aft,Hull
DropshipCriticalView.spheroidArcs.values=Nose,Forward Left,Forward Right,Aft,Hull,Aft Left,Aft Right,-,-
DropshipCriticalView.capitalArcs.values=Nose,Forward Left,Forward Right,Aft,Aft Left,Aft Right,Hull,Left Broadside,Right Broadside
Expand Down Expand Up @@ -469,6 +483,8 @@ SVChassisView.spnFireConWt.text=Fire Control:
SVChassisView.spnFireConWt.tooltip=The weight of the fire control systems must be set as part of the base chassis design, possibly limiting the number of pod-mounted weapons.
SVChassisView.btnResetChassis.text=Reset Chassis
SVChassisView.btnResetChassis.tooltip=Remove all pod-mounted equipment to strip unit down to base omni chassis.
SVChassisView.chkDNICockpitMod.text=DNI Cockpit Modification
SVChassisView.chkDNICockpitMod.tooltip=<html>Direct Neural Interface cockpit modification (IO:AE p.62).<br/>Required for pilots with DNI implant. IS only.</html>
SVCrewView.lblMinimumCrew.text=Minimum Crew
SVCrewView.txtReqBaseCrew.text=Base Crew:
SVCrewView.txtReqBaseCrew.tooltip=Minimum base crew is determined by vehicle type and weight class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
import megamek.common.battleArmor.BattleArmor;
import megamek.common.equipment.EquipmentType;
import megamek.common.equipment.EquipmentTypeLookup;
import megamek.common.interfaces.ITechManager;
import megamek.common.equipment.MiscType;
import megamek.common.interfaces.ITechManager;
import megameklab.ui.generalUnit.BuildView;
import megameklab.ui.listeners.BABuildListener;

Expand All @@ -70,15 +70,22 @@ public void removeListener(BABuildListener l) {
private final JCheckBox chkJumpBooster = new JCheckBox();
private final JCheckBox chkMechanicalJumpBooster = new JCheckBox();
private final JCheckBox chkMyomerBooster = new JCheckBox();
private final JCheckBox chkDNICockpitMod = new JCheckBox();
private final JCheckBox chkEIInterface = new JCheckBox();

private boolean ignoreEvents = false;

private final EquipmentType partialWing = EquipmentType.get(EquipmentTypeLookup.BA_PARTIAL_WING);
private final EquipmentType jumpBooster = EquipmentType.get(EquipmentTypeLookup.BA_JUMP_BOOSTER);
private final EquipmentType mechJumpBooster = EquipmentType.get(EquipmentTypeLookup.BA_MECHANICAL_JUMP_BOOSTER);
private final EquipmentType myomerBooster = EquipmentType.get(EquipmentTypeLookup.BA_MYOMER_BOOSTER);
private final EquipmentType dniCockpitMod = EquipmentType.get("DNICockpitModification");
private final EquipmentType eiInterface = EquipmentType.get("EIInterface");

private ITechManager techManager;

public BAEnhancementView(ITechManager techManager) {
this.techManager = techManager;
initUI();
}

Expand Down Expand Up @@ -114,6 +121,19 @@ private void initUI() {
chkMyomerBooster.setToolTipText(resourceMap.getString("BAEnhancementView.chkMyomerBooster.tooltip"));
add(chkMyomerBooster, gbc);
chkMyomerBooster.addActionListener(this);

gbc.gridx = 0;
gbc.gridy++;
chkDNICockpitMod.setText(resourceMap.getString("BAEnhancementView.chkDNICockpitMod.text"));
chkDNICockpitMod.setToolTipText(resourceMap.getString("BAEnhancementView.chkDNICockpitMod.tooltip"));
add(chkDNICockpitMod, gbc);
chkDNICockpitMod.addActionListener(this);

gbc.gridx++;
chkEIInterface.setText(resourceMap.getString("BAEnhancementView.chkEIInterface.text"));
chkEIInterface.setToolTipText(resourceMap.getString("BAEnhancementView.chkEIInterface.tooltip"));
add(chkEIInterface, gbc);
chkEIInterface.addActionListener(this);
}

public void setFromEntity(BattleArmor ba) {
Expand All @@ -122,6 +142,17 @@ public void setFromEntity(BattleArmor ba) {
chkJumpBooster.setSelected(ba.hasWorkingMisc(MiscType.F_JUMP_BOOSTER));
chkMechanicalJumpBooster.setSelected(ba.hasWorkingMisc(MiscType.F_MECHANICAL_JUMP_BOOSTER));
chkMyomerBooster.setSelected(ba.hasWorkingMisc(MiscType.F_MASC));

// DNI Cockpit Mod - IS only
boolean dniLegal = (dniCockpitMod != null) && techManager.isLegal(dniCockpitMod);
chkDNICockpitMod.setVisible(dniLegal);
chkDNICockpitMod.setSelected(dniLegal && ba.hasWorkingMisc(MiscType.F_DNI_COCKPIT_MOD));

// EI Interface - Clan only
boolean eiLegal = (eiInterface != null) && techManager.isLegal(eiInterface);
chkEIInterface.setVisible(eiLegal);
chkEIInterface.setSelected(eiLegal && ba.hasWorkingMisc(MiscType.F_EI_INTERFACE));

ignoreEvents = false;
}

Expand All @@ -138,6 +169,10 @@ public void actionPerformed(ActionEvent e) {
listeners.forEach(l -> l.enhancementChanged(mechJumpBooster, chkMechanicalJumpBooster.isSelected()));
} else if (e.getSource() == chkMyomerBooster) {
listeners.forEach(l -> l.enhancementChanged(myomerBooster, chkMyomerBooster.isSelected()));
} else if (e.getSource() == chkDNICockpitMod) {
listeners.forEach(l -> l.enhancementChanged(dniCockpitMod, chkDNICockpitMod.isSelected()));
} else if (e.getSource() == chkEIInterface) {
listeners.forEach(l -> l.enhancementChanged(eiInterface, chkEIInterface.isSelected()));
}
}
}
37 changes: 37 additions & 0 deletions megameklab/src/megameklab/ui/combatVehicle/CVChassisView.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import javax.swing.event.ChangeListener;

import megamek.common.equipment.Engine;
import megamek.common.equipment.EquipmentType;
import megamek.common.units.Entity;
import megamek.common.units.EntityMovementMode;
import megamek.common.interfaces.ITechManager;
Expand Down Expand Up @@ -124,6 +125,7 @@ public void removeListener(CVBuildListener l) {
private final JSpinner spnChassisTurretWt = new JSpinner(spnTurretWtModel);
private final JSpinner spnChassisTurret2Wt = new JSpinner(spnTurret2WtModel);
private final JSpinner spnExtraSeats = new JSpinner(new SpinnerNumberModel(0, 0, null, 1));
private final JCheckBox chkDNICockpitMod = new JCheckBox();

private final List<JComponent> omniComponents = new ArrayList<>();

Expand Down Expand Up @@ -266,6 +268,14 @@ private void initUI() {
add(btnResetChassis, gbc);
btnResetChassis.addActionListener(this);
omniComponents.add(btnResetChassis);
gbc.gridy++;

chkDNICockpitMod.setText(resourceMap.getString("CVChassisView.chkDNICockpitMod.text"));
gbc.gridx = 0;
gbc.gridwidth = 4;
chkDNICockpitMod.setToolTipText(resourceMap.getString("CVChassisView.chkDNICockpitMod.tooltip"));
add(chkDNICockpitMod, gbc);
chkDNICockpitMod.addActionListener(this);
}

public void setFromEntity(Tank tank) {
Expand Down Expand Up @@ -297,6 +307,10 @@ public void setFromEntity(Tank tank) {
omniComponents.forEach(c -> c.setEnabled(chkOmni.isSelected()));
spnChassisTurretWt.setEnabled(chkOmni.isSelected() && (cbTurrets.getSelectedIndex() > 0));
spnChassisTurret2Wt.setEnabled(chkOmni.isSelected() && (cbTurrets.getSelectedIndex() > 1));

chkDNICockpitMod.removeActionListener(this);
chkDNICockpitMod.setSelected(tank.hasDNICockpitMod());
chkDNICockpitMod.addActionListener(this);
}

/**
Expand All @@ -314,12 +328,25 @@ public void refresh() {
chkOmni.addActionListener(this);
refreshEngine();
refreshTurrets();
refreshDNICockpitMod();

omniComponents.forEach(c -> c.setEnabled(chkOmni.isSelected()));
spnChassisTurretWt.setEnabled(chkOmni.isSelected() && (cbTurrets.getSelectedIndex() > 0));
spnChassisTurret2Wt.setEnabled(chkOmni.isSelected() && (cbTurrets.getSelectedIndex() > 1));
}

private void refreshDNICockpitMod() {
chkDNICockpitMod.removeActionListener(this);
EquipmentType dniEquipment = EquipmentType.get("DNICockpitModification");
boolean isLegal = (dniEquipment != null) && techManager.isLegal(dniEquipment);
chkDNICockpitMod.setVisible(isLegal);
if (!isLegal && chkDNICockpitMod.isSelected()) {
chkDNICockpitMod.setSelected(false);
listeners.forEach(l -> l.dniCockpitModChanged(false));
}
chkDNICockpitMod.addActionListener(this);
}

private void refreshTonnage() {
spnTonnage.removeChangeListener(this);
int max = (int) TestTank.maxTonnage(getMovementMode(), isSuperheavy());
Expand Down Expand Up @@ -489,6 +516,14 @@ public int getTurretConfiguration() {
return Objects.requireNonNullElse((Integer) cbTurrets.getSelectedItem(), TURRET_NONE);
}

public boolean hasDNICockpitMod() {
return chkDNICockpitMod.isSelected() && chkDNICockpitMod.isEnabled();
}

public void setDNICockpitMod(boolean hasMod) {
chkDNICockpitMod.setSelected(hasMod);
}

@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() == spnTonnage) {
Expand Down Expand Up @@ -520,6 +555,8 @@ public void actionPerformed(ActionEvent e) {
listeners.forEach(l -> l.turretChanged(getTurretConfiguration()));
} else if (e.getActionCommand().equals(CMD_RESET_CHASSIS)) {
listeners.forEach(CVBuildListener::resetChassis);
} else if (e.getSource() == chkDNICockpitMod) {
listeners.forEach(l -> l.dniCockpitModChanged(chkDNICockpitMod.isSelected()));
}
}
}
24 changes: 24 additions & 0 deletions megameklab/src/megameklab/ui/combatVehicle/CVStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import megamek.common.equipment.ArmorType;
import megamek.common.equipment.Engine;
import megamek.common.equipment.EquipmentType;
import megamek.common.equipment.MiscMounted;
import megamek.common.equipment.MiscType;
import megamek.common.equipment.Mounted;
import megamek.common.equipment.Transporter;
Expand Down Expand Up @@ -899,4 +900,27 @@ public void roleChanged(UnitRole role) {
refresh.refreshSummary();
refresh.refreshPreview();
}

@Override
public void dniCockpitModChanged(boolean hasMod) {
if (hasMod && !getTank().hasDNICockpitMod()) {
MiscType dniMod = (MiscType) EquipmentType.get("DNICockpitModification");
if (dniMod != null) {
try {
getTank().addEquipment(dniMod, Entity.LOC_NONE);
} catch (Exception ignored) {
}
}
} else if (!hasMod && getTank().hasDNICockpitMod()) {
for (MiscMounted mounted : getTank().getMisc()) {
if (mounted.getType().hasFlag(MiscType.F_DNI_COCKPIT_MOD)) {
getTank().removeMisc(mounted.getType().getInternalName());
break;
}
}
}
refresh.refreshBuild();
refresh.refreshStatus();
refresh.refreshPreview();
}
}
38 changes: 37 additions & 1 deletion megameklab/src/megameklab/ui/fighterAero/ASChassisView.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import javax.swing.event.ChangeListener;

import megamek.common.equipment.Engine;
import megamek.common.equipment.EquipmentType;
import megamek.common.interfaces.ITechManager;
import megamek.common.units.Aero;
import megamek.common.units.Entity;
Expand Down Expand Up @@ -93,6 +94,7 @@ public void removeListener(AeroBuildListener l) {
final private TechComboBox<Engine> cbEngine = new TechComboBox<>(e -> e.getEngineName().replaceAll("^\\d+ ", ""));
final private CustomComboBox<Integer> cbCockpit = new CustomComboBox<>(Aero::getCockpitTypeString);
final private JButton btnResetChassis = new JButton();
final private JCheckBox chkDNICockpitMod = new JCheckBox();

private final ITechManager techManager;
private boolean primitive = false;
Expand Down Expand Up @@ -184,8 +186,16 @@ public void initUI() {
add(cbCockpit, gbc);
cbCockpit.addActionListener(this);

gbc.gridx = 1;
chkDNICockpitMod.setText(resourceMap.getString("FighterChassisView.chkDNICockpitMod.text"));
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridwidth = 4;
chkDNICockpitMod.setToolTipText(resourceMap.getString("FighterChassisView.chkDNICockpitMod.tooltip"));
add(chkDNICockpitMod, gbc);
chkDNICockpitMod.addActionListener(this);

gbc.gridx = 1;
gbc.gridy = 6;
gbc.gridwidth = 3;
btnResetChassis.setToolTipText(resourceMap.getString("FighterChassisView.btnResetChassis.tooltip"));
add(btnResetChassis, gbc);
Expand Down Expand Up @@ -215,9 +225,20 @@ public void setFromEntity(Aero aero) {
cbFighterType.addActionListener(this);
setEngine(aero.getEngine());
setCockpitType(aero.getCockpitType());
chkDNICockpitMod.removeActionListener(this);
chkDNICockpitMod.setSelected(aero.hasDNICockpitMod());
chkDNICockpitMod.addActionListener(this);
btnResetChassis.setEnabled(aero.isOmni());
}

public boolean hasDNICockpitMod() {
return chkDNICockpitMod.isSelected() && chkDNICockpitMod.isEnabled();
}

public void setDNICockpitMod(boolean hasMod) {
chkDNICockpitMod.setSelected(hasMod);
}

public void setAsCustomization() {
spnTonnage.setEnabled(false);
}
Expand All @@ -235,12 +256,25 @@ public void refresh() {
refreshFighterType();
refreshEngine();
refreshCockpit();
refreshDNICockpitMod();

chkOmni.setEnabled(!isPrimitive()
&& techManager.isLegal(Entity.getOmniAdvancement()));

}

private void refreshDNICockpitMod() {
chkDNICockpitMod.removeActionListener(this);
EquipmentType dniEquipment = EquipmentType.get("DNICockpitModification");
boolean isLegal = (dniEquipment != null) && techManager.isLegal(dniEquipment);
chkDNICockpitMod.setVisible(isLegal);
if (!isLegal && chkDNICockpitMod.isSelected()) {
chkDNICockpitMod.setSelected(false);
listeners.forEach(l -> l.dniCockpitModChanged(false));
}
chkDNICockpitMod.addActionListener(this);
}

private void refreshTonnage() {
int prev = spnTonnageModel.getNumber().intValue();
int min = primitive ? 10 : 5;
Expand Down Expand Up @@ -468,6 +502,8 @@ public void actionPerformed(ActionEvent e) {
listeners.forEach(l -> l.cockpitChanged(getCockpitType()));
} else if (e.getSource() == btnResetChassis) {
listeners.forEach(AeroBuildListener::resetChassis);
} else if (e.getSource() == chkDNICockpitMod) {
listeners.forEach(l -> l.dniCockpitModChanged(chkDNICockpitMod.isSelected()));
}
}
}
25 changes: 25 additions & 0 deletions megameklab/src/megameklab/ui/fighterAero/ASStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
import megamek.common.equipment.ArmorType;
import megamek.common.equipment.Engine;
import megamek.common.equipment.EquipmentType;
import megamek.common.equipment.MiscMounted;
import megamek.common.equipment.MiscType;
import megamek.common.equipment.Mounted;
import megamek.common.equipment.Transporter;
import megamek.common.exceptions.LocationFullException;
Expand Down Expand Up @@ -787,4 +789,27 @@ public void roleChanged(UnitRole role) {
refresh.refreshSummary();
refresh.refreshPreview();
}

@Override
public void dniCockpitModChanged(boolean hasMod) {
if (hasMod && !getAero().hasDNICockpitMod()) {
MiscType dniMod = (MiscType) EquipmentType.get("DNICockpitModification");
if (dniMod != null) {
try {
getAero().addEquipment(dniMod, Entity.LOC_NONE);
} catch (Exception ignored) {
}
}
} else if (!hasMod && getAero().hasDNICockpitMod()) {
for (MiscMounted mounted : getAero().getMisc()) {
if (mounted.getType().hasFlag(MiscType.F_DNI_COCKPIT_MOD)) {
getAero().removeMisc(mounted.getType().getInternalName());
break;
}
}
}
refresh.refreshBuild();
refresh.refreshStatus();
refresh.refreshPreview();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,11 @@ public interface AeroBuildListener extends BuildListener {
*/
void cargoSpaceChanged(BayData bayType, double fixed, double pod);

/**
* Notify of a change in DNI Cockpit Modification status.
*
* @param hasMod Whether the fighter has the DNI Cockpit Modification
*/
void dniCockpitModChanged(boolean hasMod);

}
Loading