public ResourceData(KITResourceVesselModule resourceManager, ICheatOptions cheatOptions) { ResourceManager = resourceManager; _myCheatOptions = cheatOptions; AvailableKITModules = new List <IKITModule>(128); VariableSupplierModules = new SortedDictionary <ResourceName, List <IKITVariableSupplier> >(); TappedOutMods = new HashSet <IKITVariableSupplier>(128); FixedUpdateCalledMods = new List <IKITModule>(128); ModsCurrentlyRunning = new List <IKITModule>(32); AvailableResources = new Dictionary <ResourceName, double>(); MaxResources = new Dictionary <ResourceName, double>(); FixedDeltaTimeValue = 0; OverheatMultiplier = 1; ResourceProductionStats = new ResourceProduction[(int)(ResourceName.WasteHeat + 1)]; ModProduction = new Dictionary <ResourceName, Dictionary <IKITModule, PerPartResourceInformation> >(); ModConsumption = new Dictionary <ResourceName, Dictionary <IKITModule, PerPartResourceInformation> >(); for (var i = ResourceName.ElectricCharge; i <= ResourceName.WasteHeat; i++) { ModProduction[i] = new Dictionary <IKITModule, PerPartResourceInformation>(); ModConsumption[i] = new Dictionary <IKITModule, PerPartResourceInformation>(); } _electricChargeKeyValue = new ResourceKeyValue(ResourceName.ElectricCharge, 0); }
private double CalculateAvailableResourceCapacity(ResourceKeyValue resource) { var availableCapacity = CurrentCapacity(resource.Resource); if (availableCapacity == 0) { return(0); } var value = availableCapacity / resource.Amount; return((value <= double.Epsilon) ? 0 : (value >= 1) ? 1 : value); }
private double CalculateAvailableSpaceCapacity(ResourceKeyValue resource) { var spareCapacity = SpareCapacity(resource.Resource); if (spareCapacity == 0) { return(0); } var value = spareCapacity / resource.Amount; return((value <= double.Epsilon) ? 0 : (value >= 1) ? 1 : value); }