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

default autoeject to disabled for clan meks #6070

Merged
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
17 changes: 10 additions & 7 deletions megamek/src/megamek/common/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -1216,13 +1216,16 @@ public synchronized void addEntity(Entity entity, boolean genEvent) {
}

// And... lets get this straight now.
if ((entity instanceof Mek)
&& getOptions().booleanOption(OptionsConstants.RPG_CONDITIONAL_EJECTION)) {
((Mek) entity).setAutoEject(true);
((Mek) entity).setCondEjectAmmo(!entity.hasCase() && !entity.hasCASEII());
((Mek) entity).setCondEjectEngine(true);
((Mek) entity).setCondEjectCTDest(true);
((Mek) entity).setCondEjectHeadshot(true);
if (entity instanceof Mek mek) {
if (getOptions().booleanOption(OptionsConstants.RPG_CONDITIONAL_EJECTION)) {
mek.setAutoEject(true);
mek.setCondEjectAmmo(!entity.hasCase() && !entity.hasCASEII());
mek.setCondEjectEngine(true);
mek.setCondEjectCTDest(true);
mek.setCondEjectHeadshot(true);
} else {
mek.setAutoEject(!entity.hasCase() && !entity.hasCASEII());
}
}

if (genEvent) {
Expand Down
30 changes: 16 additions & 14 deletions megamek/src/megamek/common/MULParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1214,24 +1214,26 @@ private void setCrewAttributes(final @Nullable GameOptions options, final Entity
// Set the crew for this entity.
entity.setCrew(crew);

if (attributes.containsKey(ATTR_AUTOEJECT) && !attributes.get(ATTR_AUTOEJECT).isBlank()) {
((Mek) entity).setAutoEject(Boolean.parseBoolean(attributes.get(ATTR_AUTOEJECT)));
}
if (entity instanceof Mek mek) {
if (attributes.containsKey(ATTR_AUTOEJECT) && !attributes.get(ATTR_AUTOEJECT).isBlank()) {
mek.setAutoEject(Boolean.parseBoolean(attributes.get(ATTR_AUTOEJECT)));
}

if (attributes.containsKey(ATTR_CONDEJECTAMMO) && !attributes.get(ATTR_CONDEJECTAMMO).isBlank()) {
((Mek) entity).setCondEjectAmmo(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTAMMO)));
}
if (attributes.containsKey(ATTR_CONDEJECTAMMO) && !attributes.get(ATTR_CONDEJECTAMMO).isBlank()) {
mek.setCondEjectAmmo(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTAMMO)));
}

if (attributes.containsKey(ATTR_CONDEJECTENGINE) && !attributes.get(ATTR_CONDEJECTENGINE).isBlank()) {
((Mek) entity).setCondEjectEngine(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTENGINE)));
}
if (attributes.containsKey(ATTR_CONDEJECTENGINE) && !attributes.get(ATTR_CONDEJECTENGINE).isBlank()) {
mek.setCondEjectEngine(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTENGINE)));
}

if (attributes.containsKey(ATTR_CONDEJECTCTDEST) && !attributes.get(ATTR_CONDEJECTCTDEST).isBlank()) {
((Mek) entity).setCondEjectCTDest(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTCTDEST)));
}
if (attributes.containsKey(ATTR_CONDEJECTCTDEST) && !attributes.get(ATTR_CONDEJECTCTDEST).isBlank()) {
mek.setCondEjectCTDest(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTCTDEST)));
}

if (attributes.containsKey(ATTR_CONDEJECTHEADSHOT) && !attributes.get(ATTR_CONDEJECTHEADSHOT).isBlank()) {
((Mek) entity).setCondEjectHeadshot(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTHEADSHOT)));
if (attributes.containsKey(ATTR_CONDEJECTHEADSHOT) && !attributes.get(ATTR_CONDEJECTHEADSHOT).isBlank()) {
mek.setCondEjectHeadshot(Boolean.parseBoolean(attributes.get(ATTR_CONDEJECTHEADSHOT)));
}
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions megamek/src/megamek/common/MekFileParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,6 @@ else if (m.getType().hasFlag(MiscType.F_APOLLO)) {
}
}

if ((ent instanceof Mek) && (m.getType().hasFlag(MiscType.F_CASE) || m.getType().hasFlag(MiscType.F_CASEII)
|| m.getType().hasFlag(MiscType.F_CASEP)

)) {
((Mek) ent).setAutoEject(false);
}

if ((ent instanceof Mek)
&& m.getType().hasFlag(
MiscType.F_ACTUATOR_ENHANCEMENT_SYSTEM)) {
Expand Down