示例#1
0
 public void setStat(String code, String val) {
   if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0)
     CMLib.coffeeMaker().setGenItemStat(this, code, val);
   else
     switch (getCodeNum(code)) {
       case 0:
         setLidsNLocks(hasALid(), isOpen(), CMath.s_bool(val), false);
         break;
       case 1:
         setLidsNLocks(CMath.s_bool(val), isOpen(), hasALock(), false);
         break;
       case 2:
         setCapacity(CMath.s_parseIntExpression(val));
         break;
       case 3:
         setContainTypes(CMath.s_parseBitLongExpression(Container.CONTAIN_DESCS, val));
         break;
       case 4:
         {
           int x = CMath.s_parseListIntExpression(RawMaterial.CODES.NAMES(), val);
           x = ((x >= 0) && (x < RawMaterial.RESOURCE_MASK)) ? RawMaterial.CODES.GET(x) : x;
           setFuelType(x);
           break;
         }
       case 5:
         setPowerCapacity(CMath.s_parseLongExpression(val));
         break;
       default:
         CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
         break;
     }
 }
示例#2
0
 @Override
 public void setStat(String code, String val) {
   if (CMLib.coffeeMaker().getGenItemCodeNum(code) >= 0)
     CMLib.coffeeMaker().setGenItemStat(this, code, val);
   else
     switch (getCodeNum(code)) {
       case 0:
         setDoorsNLocks(
             hasADoor(),
             isOpen(),
             defaultsClosed(),
             CMath.s_bool(val),
             false,
             CMath.s_bool(val) && defaultsLocked());
         break;
       case 1:
         setDoorsNLocks(
             CMath.s_bool(val),
             isOpen(),
             CMath.s_bool(val) && defaultsClosed(),
             hasALock(),
             isLocked(),
             defaultsLocked());
         break;
       case 2:
         setCapacity(CMath.s_parseIntExpression(val));
         break;
       case 3:
         setContainTypes(CMath.s_parseBitLongExpression(Container.CONTAIN_DESCS, val));
         break;
       case 4:
         setOpenDelayTicks(CMath.s_parseIntExpression(val));
         break;
       case 5:
         setPowerCapacity(CMath.s_parseLongExpression(val));
         break;
       case 6:
         {
           final List<String> mats = CMParms.parseCommas(val, true);
           final int[] newMats = new int[mats.size()];
           for (int x = 0; x < mats.size(); x++) {
             final int rsccode = RawMaterial.CODES.FIND_CaseSensitive(mats.get(x).trim());
             if (rsccode > 0) newMats[x] = rsccode;
           }
           super.setConsumedFuelType(newMats);
           break;
         }
       case 7:
         setPowerCapacity(CMath.s_parseLongExpression(val));
         break;
       case 8:
         setGeneratedAmountPerTick(CMath.s_parseIntExpression(val));
         break;
       case 9:
         activate(CMath.s_bool(val));
         break;
       case 10:
         setManufacturerName(val);
         break;
       case 11:
         setInstalledFactor(CMath.s_float(val));
         break;
       case 12:
         setDoorsNLocks(
             hasADoor(), isOpen(), CMath.s_bool(val), hasALock(), isLocked(), defaultsLocked());
         break;
       case 13:
         setDoorsNLocks(
             hasADoor(), isOpen(), defaultsClosed(), hasALock(), isLocked(), CMath.s_bool(val));
         break;
       default:
         CMProps.setStatCodeExtensionValue(getStatCodes(), xtraValues, code, val);
         break;
     }
 }