More fixes to per-stage mass and cost values
[VesselSimulator.git] / KerbalEngineer / VesselSimulator / ResourceContainer.cs
blob:a/KerbalEngineer/VesselSimulator/ResourceContainer.cs -> blob:b/KerbalEngineer/VesselSimulator/ResourceContainer.cs
--- a/KerbalEngineer/VesselSimulator/ResourceContainer.cs
+++ b/KerbalEngineer/VesselSimulator/ResourceContainer.cs
@@ -150,6 +150,12 @@
             return density == 0d ? 0d : this.resources[type] * density;
         }
 
+        public double GetResourceCost(int type)
+        {
+            double unitCost = GetResourceUnitCost(type);
+            return unitCost == 0d ? 0d : this.resources[type] * unitCost;
+        }
+
         public static ResourceFlowMode GetResourceFlowMode(int type)
         {
             return PartResourceLibrary.Instance.GetDefinition(type).resourceFlowMode;
@@ -157,7 +163,7 @@
 
         public static ResourceTransferMode GetResourceTransferMode(int type)
         {
-            return PartResourceLibrary.Instance.GetDefinition(type).resourceTransferMode;;
+            return PartResourceLibrary.Instance.GetDefinition(type).resourceTransferMode;
         }
 
         public static float GetResourceDensity(int type)
@@ -169,5 +175,10 @@
         {
             return PartResourceLibrary.Instance.GetDefinition(type).name;
         }
+
+        public static double GetResourceUnitCost(int type)
+        {
+            return PartResourceLibrary.Instance.GetDefinition(type).unitCost;
+        }
     }
 }