public FuelTypeData(FuelType type) { fuelType = type; name = type.name; tankageMassFraction = type.tankageMassFactor; tankageVolumeLoss = type.tankageVolumeLoss; costPerDryTon = type.costPerDryTon; }
public FuelTypeData(ConfigNode node) { name = node.GetStringValue("name"); fuelType = FuelTypes.INSTANCE.getFuelType(name); if (fuelType == null) { throw new NullReferenceException("Fuel type was null for fuel name: " + name); } tankageVolumeLoss = node.GetFloatValue("tankageVolumeLoss", fuelType.tankageVolumeLoss); tankageMassFraction = node.GetFloatValue("tankageMassFraction", fuelType.tankageMassFactor); costPerDryTon = node.GetFloatValue("costPerDryTon", fuelType.costPerDryTon); }
private void loadDefs() { if (loadedDefs) { return; } fuelTypes.Clear(); resourceVolumes.Clear(); ConfigNode[] configs = GameDatabase.Instance.GetConfigNodes("SSTU_RESOURCEVOLUME"); foreach (ConfigNode node in configs) { resourceVolumes.Add(node.GetStringValue("name"), node.GetFloatValue("volume")); } configs = GameDatabase.Instance.GetConfigNodes("SSTU_FUELTYPE"); FuelType fuelType; foreach (ConfigNode node in configs) { fuelType = new FuelType(node); fuelTypes.Add(fuelType.name, fuelType); } loadedDefs = true; }