mounted.changeAmmoType((AmmoType) newLoad); mounted.setShotsLeft(shotsVal); mounted.changeAmmoType((AmmoType) newLoad); mounted.setShotsLeft(shotsVal); mounted.getLinked().changeAmmoType( (AmmoType) munType); } else {
public void applyChoice() { int n = m_choice.getSelectedIndex(); // If there's no selection, there's nothing we can do if (n == -1){ return; } AmmoType at = m_vTypes.get(n); m_mounted.changeAmmoType(at); m_mounted.setShotsLeft((Integer)m_num_shots.getSelectedItem()); if (chDump.isSelected()) { m_mounted.setShotsLeft(0); } if (clientgui.getClient().getGame().getOptions().booleanOption( OptionsConstants.ADVCOMBAT_TACOPS_HOTLOAD)) { if (chHotLoad.isSelected() != m_mounted.isHotLoaded()) { m_mounted.setHotLoad(chHotLoad.isSelected()); // Set the mode too, so vehicles can switch back int numModes = m_mounted.getType().getModesCount(); for (int m = 0; m < numModes; m++) { if (m_mounted.getType().getMode(m).getName() .equals("HotLoad")) { m_mounted.setMode(m); } } } } }
mounted.changeAmmoType(row.munitions.get(i));
AmmoType newAmmoType = getValidAmmoType(s.getGame(), ammo, sa.type); if(null != newAmmoType) { ammo.changeAmmoType(newAmmoType); } else { System.out.println(String.format("Illegal ammo type '%s' for unit %s, slot %s", //$NON-NLS-1$
@Override public void updateConditionFromPart() { if(null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { mounted.setHit(false); mounted.setDestroyed(false); mounted.setRepairable(true); mounted.changeAmmoType((AmmoType) type); unit.repairSystem(CriticalSlot.TYPE_EQUIPMENT, equipmentNum); mounted.setShotsLeft(getFullShots() - shotsNeeded); mounted.setAmmoCapacity(capacity); } } }
@Override public void loadBin() { int shots = Math.min(getAmountAvailable(), shotsNeeded); int shotsPerTrooper = shots / getNumTroopers(); shots = shotsPerTrooper * getNumTroopers(); if(null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if(null != mounted) { if(mounted.getType().equals(type) && ((AmmoType)mounted.getType()).getMunitionType() == getMunitionType()) { //just a simple reload mounted.setShotsLeft(mounted.getBaseShotsLeft() + shotsPerTrooper); } else { //loading a new type of ammo unload(); mounted.changeAmmoType((AmmoType)type); mounted.setShotsLeft(shotsPerTrooper); } } } changeAmountAvailable(-1 * shots, (AmmoType)type); shotsNeeded -= shots; }
public void loadBin() { int shots = Math.min(getAmountAvailable(), getShotsNeeded()); if (null != unit) { Mounted mounted = unit.getEntity().getEquipment(equipmentNum); if (null != mounted) { EquipmentType mType = mounted.getType(); if (mType instanceof AmmoType) { if (!ammoTypeChanged()) { //just a simple reload mounted.setShotsLeft(mounted.getBaseShotsLeft() + shots); } else { //loading a new type of ammo unload(); mounted.changeAmmoType((AmmoType)type); mounted.setShotsLeft(shots); } changeAmountAvailable(-1 * shots, (AmmoType)type); shotsNeeded -= shots; } else { MekHQ.getLogger().log(AmmoBin.class, "loadBin", LogLevel.WARNING, mType.getName() + " is not valid equipment for " + getName() + " to restock ammo on unit " + unit.getName()); } } } }