Skip to content

Commit 69c2c9e

Browse files
authored
Merge pull request #6551 from IllianiCBT/unmothballDropShips
Fixed Inability to GM Activate Self-Crewed Units (such as DropShips)
2 parents c2c1cc3 + fb24151 commit 69c2c9e

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

MekHQ/src/mekhq/campaign/unit/Unit.java

+13-10
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
import megamek.Version;
5454
import megamek.client.ui.swing.tileset.EntityImage;
5555
import megamek.codeUtilities.MathUtility;
56-
import megamek.common.CrewType;
5756
import megamek.common.*;
57+
import megamek.common.CrewType;
5858
import megamek.common.annotations.Nullable;
5959
import megamek.common.equipment.AmmoMounted;
6060
import megamek.common.equipment.ArmorType;
@@ -86,7 +86,6 @@
8686
import mekhq.campaign.parts.equipment.*;
8787
import mekhq.campaign.personnel.Person;
8888
import mekhq.campaign.personnel.PersonnelOptions;
89-
import mekhq.campaign.personnel.skills.SkillType;
9089
import mekhq.campaign.personnel.enums.PersonnelRole;
9190
import mekhq.campaign.personnel.skills.SkillType;
9291
import mekhq.campaign.unit.enums.CrewAssignmentState;
@@ -444,7 +443,7 @@ private void addTransportedUnitType(AbstractTransportedUnitsSummary transportedU
444443
*/
445444
@Deprecated(since = "0.50.04", forRemoval = true)
446445
private void fixTransportedUnitReferences(AbstractTransportedUnitsSummary currentTransportedUnits,
447-
Set<Unit> newTransportedUnits) {
446+
Set<Unit> newTransportedUnits) {
448447
currentTransportedUnits.replaceTransportedUnits(newTransportedUnits);
449448
}
450449

@@ -576,7 +575,7 @@ public boolean hasTransportAssignment(CampaignTransportType campaignTransportTyp
576575
* @see CampaignTransportType
577576
*/
578577
public void setTransportAssignment(CampaignTransportType campaignTransportType,
579-
@Nullable ITransportAssignment assignment) {
578+
@Nullable ITransportAssignment assignment) {
580579
if (campaignTransportType.isShipTransport()) {
581580
if (assignment.getClass().isAssignableFrom(campaignTransportType.getTransportAssignmentType())) {
582581
setTransportShipAssignment((TransportShipAssignment) assignment);
@@ -2368,7 +2367,7 @@ public double getCurrentTacticalTransportCapacity(TransporterType transporterTyp
23682367
* @see CampaignTransportType
23692368
*/
23702369
public double getCurrentTransportCapacity(CampaignTransportType campaignTransportType,
2371-
TransporterType transporterType) {
2370+
TransporterType transporterType) {
23722371
return getTransportedUnitsSummary(campaignTransportType).getCurrentTransportCapacity(transporterType);
23732372
}
23742373

@@ -2494,7 +2493,7 @@ public Set<Unit> loadTacticalTransport(TransporterType transporterType, Set<Unit
24942493
*/
24952494
@Deprecated(since = "0.50.04", forRemoval = true)
24962495
public @Nullable Unit loadTacticalTransport(Unit transportedUnit, @Nullable Transporter transportedLocation,
2497-
TransporterType transporterType) {
2496+
TransporterType transporterType) {
24982497
return getTacticalTransportedUnitsSummary().loadTransport(transportedLocation,
24992498
transporterType,
25002499
transportedUnit);
@@ -2515,7 +2514,7 @@ public Set<Unit> loadTacticalTransport(TransporterType transporterType, Set<Unit
25152514
* @see TransporterType#TANK_TRAILER_HITCH
25162515
*/
25172516
public @Nullable Unit towTrailer(Unit transportedUnit, @Nullable Transporter transportedLocation,
2518-
TransporterType transporterType) {
2517+
TransporterType transporterType) {
25192518
return ((TowTransportedUnitsSummary) getTransportedUnitsSummary(CampaignTransportType.TOW_TRANSPORT)).towTrailer(
25202519
transportedUnit,
25212520
transportedLocation,
@@ -4703,7 +4702,9 @@ public void resetPilotAndEntity() {
47034702
if (getCampaign().getCampaignOptions().isUseTactics()) {
47044703
// Tactics command bonus. This should actually reflect the unit's commander
47054704
if (null != commander && commander.hasSkill(SkillType.S_TACTICS)) {
4706-
entity.getCrew().setCommandBonus(commander.getSkill(SkillType.S_TACTICS).getFinalSkillValue(commander.getOptions()));
4705+
entity.getCrew()
4706+
.setCommandBonus(commander.getSkill(SkillType.S_TACTICS)
4707+
.getFinalSkillValue(commander.getOptions()));
47074708
}
47084709
}
47094710

@@ -5134,7 +5135,8 @@ private void assignToCrewSlot(Person person, int slot, String gunType, String dr
51345135
if (person.hasSkill(driveType)) {
51355136
piloting = person.getSkill(driveType).getFinalSkillValue(options);
51365137
}
5137-
if (person.hasSkill(SkillType.S_ARTILLERY) && person.getSkill(SkillType.S_ARTILLERY).getFinalSkillValue(options) < artillery) {
5138+
if (person.hasSkill(SkillType.S_ARTILLERY) &&
5139+
person.getSkill(SkillType.S_ARTILLERY).getFinalSkillValue(options) < artillery) {
51385140
artillery = person.getSkill(SkillType.S_ARTILLERY).getFinalSkillValue(options);
51395141
}
51405142
entity.getCrew().setPiloting(Math.min(max(piloting, 0), 8), slot);
@@ -5896,10 +5898,11 @@ public void startActivating(@Nullable Person activationTech, boolean isGM) {
58965898
addVesselCrew(assignedEngineer);
58975899
} else if (activationTech != null && activationTech.isTechLargeVessel()) {
58985900
addVesselCrew(activationTech);
5899-
} else {
5901+
} else if (!isGM) {
59005902
// In this case there is nothing to be done, we cant activate this unit.
59015903
return;
59025904
}
5905+
59035906
resetEngineer();
59045907
} else {
59055908
tech = activationTech;

0 commit comments

Comments
 (0)