Example #1
0
  public float getTankWeightTurret() {
    float weight = 0f;

    // 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());
    }
  }
Example #2
0
 @Override
 public float getWeightPowerAmp() {
   if (!engine.isFusion() && (engine.getEngineType() != Engine.FISSION)) {
     int weight = 0;
     for (Mounted m : tank.getWeaponList()) {
       WeaponType wt = (WeaponType) m.getType();
       if (wt.hasFlag(WeaponType.F_ENERGY)
           && !(wt instanceof CLChemicalLaserWeapon)
           && !(wt instanceof VehicleFlamerWeapon)) {
         weight += wt.getTonnage(tank);
       }
       if ((m.getLinkedBy() != null)
           && (m.getLinkedBy().getType() instanceof MiscType)
           && m.getLinkedBy().getType().hasFlag(MiscType.F_PPC_CAPACITOR)) {
         weight += ((MiscType) m.getLinkedBy().getType()).getTonnage(tank);
       }
     }
     return TestEntity.ceil(weight / 10f, getWeightCeilingPowerAmp());
   }
   return 0;
 }