public boolean isTurretEverJammed(int turret) { if (turret == getLocTurret()) { return m_bTurretEverJammed; } else if (turret == getLocTurret2()) { return m_bDualTurretEverJammed; } return false; }
@Override public boolean canChangeSecondaryFacing() { return !m_bHasNoTurret && !isTurretLocked(getLocTurret()); }
public boolean isTurretLocked(int turret) { if (turret == getLocTurret()) { return m_bTurretLocked || m_bTurretJammed; } else if (turret == getLocTurret2()) { return m_bDualTurretLocked || m_bDualTurretJammed; } return false; }
@Override public boolean isValidSecondaryFacing(int n) { return !isTurretLocked(getLocTurret()); }
public void lockTurret(int turret) { if (turret == getLocTurret()) { m_bTurretLocked = true; } else if (turret == getLocTurret2()) { m_bDualTurretLocked = true; } }
/** * Parse a turretlock tag for the given <code>Entity</code>. * * @param turretLockTag * @param entity */ private void parseTurretLock(Element turretLockTag, Entity entity){ String value = turretLockTag.getAttribute(DIRECTION); try { int turDir = Integer.parseInt(value); ((Tank) entity).setSecondaryFacing(turDir); ((Tank) entity).lockTurret(((Tank)entity).getLocTurret()); } catch (Exception e) { System.err.println(e); e.printStackTrace(); warning.append("Invalid turret lock direction value in " + "movement tag.\n"); } }
public void jamTurret(int turret) { if (turret == getLocTurret()) { m_bTurretEverJammed = true; m_bTurretJammed = true; } else if (turret == getLocTurret2()) { m_bDualTurretEverJammed = true; m_bDualTurretJammed = true; } }
/** * Returns true if this weapon fires into the secondary facing arc. If * false, assume it fires into the primary. */ @Override public boolean isSecondaryArcWeapon(int weaponId) { if (getEquipment(weaponId).getLocation() == getLocTurret()) { return true; } return false; }
public void unjamTurret(int turret) { if (turret == getLocTurret()) { m_bTurretJammed = false; } else if (turret == getLocTurret2()) { m_bDualTurretJammed = false; } }
/** * Determine if the unit can be repaired, or only harvested for spares. * * @return A <code>boolean</code> that is <code>true</code> if the unit can * be repaired (given enough time and parts); if this value is * <code>false</code>, the unit is only a source of spares. * @see Entity#isSalvage() */ @Override public boolean isRepairable() { // A tank is repairable if it is salvageable, // and none of its body internals are gone. boolean retval = isSalvage(); int loc = Tank.LOC_FRONT; while (retval && (loc < getLocTurret())) { int loc_is = this.getInternal(loc); loc++; retval = (loc_is != IArmorState.ARMOR_DOOMED) && (loc_is != IArmorState.ARMOR_DESTROYED); } return retval; }
public boolean isTurretJammed(int turret) { // this is rather a hack but the only idea I came up with. // for the first time this is checked. If this is a partially repaired // turret it will be jammed. // so just set it to jammed and change the partial repair value to // false. if (getPartialRepairs().booleanOption("veh_locked_turret")) { m_bTurretJammed = true; m_bDualTurretJammed = true; getPartialRepairs().getOption("veh_locked_turret").setValue(false); } if (turret == getLocTurret()) { return m_bTurretJammed; } else if (turret == getLocTurret2()) { return m_bDualTurretJammed; } return false; }
@Override public void setSecondaryFacing(int sec_facing) { if (!isTurretLocked(getLocTurret())) { super.setSecondaryFacing(sec_facing); if (!m_bHasNoTurret) { m_nTurretOffset = sec_facing - getFacing(); } } }
/** * apply the effects of an "engine hit" crit */ public void engineHit() { engineHit = true; immobilize(); lockTurret(getLocTurret()); lockTurret(getLocTurret2()); for (Mounted m : getWeaponList()) { WeaponType wtype = (WeaponType) m.getType(); if (wtype.hasFlag(WeaponType.F_ENERGY) // Chemical lasers still work even after an engine hit. && !(wtype instanceof CLChemicalLaserWeapon) // And presumably vehicle flamers should, too; we can always // remove this again if ruled otherwise. && !(wtype instanceof VehicleFlamerWeapon)) { m.setBreached(true); // not destroyed, just unpowered } } }
@Override public void setFacing(int facing) { super.setFacing(facing); if (isTurretLocked(getLocTurret())) { int nTurretFacing = (facing + m_nTurretOffset + 6) % 6; super.setSecondaryFacing(nTurretFacing); } }
/** * clear turret */ private void doClearTurret() { String title = Messages.getString("FiringDisplay.ClearTurret.title"); //$NON-NLS-1$ String body = Messages.getString("FiringDisplay.ClearTurret.message"); //$NON-NLS-1$ if (!clientgui.doYesNoDialog(title, body)) { return; } if ((((attacks.size() == 0) && (ce() instanceof Tank) && (((Tank) ce()) .isTurretJammed(((Tank) ce()).getLocTurret()))) || ((Tank) ce()) .isTurretJammed(((Tank) ce()).getLocTurret2()))) { UnjamTurretAction uta = new UnjamTurretAction(ce().getId()); attacks.add(uta); ready(); } }
.append("/"); if (!t.hasNoTurret()) { sb.append(renderArmor(t.getArmor(t.getLocTurret()))).append("\\"); } else { sb.append(" \\"); sb.append(renderArmor(t.getInternal(Tank.LOC_LEFT))).append("/"); if (t.hasNoTurret()) { sb.append(renderArmor(t.getInternal(t.getLocTurret()))) .append("\\"); } else {
if (!hasNoTurret() && ((getArmor(getLocTurret()) < 1) && (getOArmor(getLocTurret()) > 0))) { if (PreferenceManager.getClientPreferences().debugOutputOn()) { System.out.println(getDisplayName()
private JMenu createTorsoTwistMenu() { JMenu menu = new JMenu(); if (myEntity instanceof BipedMech) { menu.setText("Torso Twist"); if (coords.equals(myEntity.getPosition())) { menu.add(createTorsoTwistJMenuItem(1)); menu.add(createTorsoTwistJMenuItem(0)); } else { menu.add(createTorsoTwistJMenuItem(coords)); } } else if ((myEntity instanceof Tank) && (((Tank) myEntity).getInternal(((Tank) myEntity) .getLocTurret()) > -1)) { menu.setText("Turret Twist"); if (coords.equals(myEntity.getPosition())) { menu.add(createTorsoTwistJMenuItem(1)); menu.add(createTorsoTwistJMenuItem(0)); } else { menu.add(createTorsoTwistJMenuItem(coords)); } } if ((myEntity instanceof Tank) && !((Tank) myEntity).hasNoDualTurret()) { menu.add(createRotateDualTurretJMenuItem((Tank) myEntity)); } return menu; }
} else if(entity instanceof Tank) { Tank t = (Tank) entity; t.unjamTurret(t.getLocTurret()); t.unjamTurret(t.getLocTurret2()); t.resetJammedWeapons();
public double getTankWeightTurret() { double weight = 0; // For omni vees, the base chassis sets a turret weight if (tank.isOmni() && tank.getBaseChassisTurretWeight() >= 0) { weight = tank.getBaseChassisTurretWeight(); } else { // For non-omnis, count up the weight of eq in the turret for (Mounted m : tank.getEquipment()) { if ((m.getLocation() == tank.getLocTurret()) && !(m.getType() instanceof AmmoType)) { weight += m.getType().getTonnage(tank); } } // Turrets weight 10% of the weight of weapons in them weight = weight / 10.0f; } if (tank.isSupportVehicle()) { if (getEntity().getWeight() < 5) { return TestEntity.ceil(weight, Ceil.KILO); } else { return TestEntity.ceil(weight, Ceil.HALFTON); } } else { return TestEntity.ceilMaxHalf(weight, getWeightCeilingTurret()); } }