Will be the base class for manipulating resources in a part, including cross-module manipulation.
示例#1
0
 public SSTUResourceList addResources(float volume, SSTUResourceList list)
 {
     int rawFuelUnits = (int)(volume * unitsPerCubicMeter);
     int units;
     foreach (SSTUFuelEntry entry in fuelEntries)
     {
         units = entry.ratio * rawFuelUnits;
         list.addResource(entry.resourceName, units);
     }
     return list;
 }
示例#2
0
        private void updateResources()
        {
            float scale  = Mathf.Pow(getEngineScale(), thrustScalePower);
            float volume = resourceVolume * scale * engineModels.model.numberOfEngines;

            if (!SSTUModInterop.onPartFuelVolumeUpdate(part, volume * 1000))
            {
                SSTUResourceList resources = new SSTUResourceList();
                fuelType.addResources(resources, volume);
                resources.setResourcesToPart(part);
            }
        }
        /// <summary>
        /// Update the resources for the part from the resources in the currently configured containers
        /// </summary>
        private void updateTankResources()
        {
            SSTUResourceList list = new SSTUResourceList();
            int len = containers.Length;

            for (int i = 0; i < len; i++)
            {
                containers[i].getResources(list);
            }
            list.setResourcesToPart(part);
            updateMassAndCost();
            updateKISVolume();
        }
示例#4
0
        /// <summary>
        /// Update the resources for the part from the resources in the currently configured containers
        /// </summary>
        private void updateTankResources()
        {
            SSTUResourceList list = new SSTUResourceList();
            int len = containers.Length;

            for (int i = 0; i < len; i++)
            {
                containers[i].getResources(list);
            }
            list.setResourcesToPart(part);
            updateMassAndCost();
            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onContainerUpdated(this);
        }
示例#5
0
        /// <summary>
        /// Update the resources for the part from the resources in the currently configured containers
        /// </summary>
        private void updateTankResources()
        {
            SSTUResourceList list = new SSTUResourceList();
            int len = containers.Length;

            for (int i = 0; i < len; i++)
            {
                containers[i].getResources(list);
            }
            list.setResourcesToPart(part, inflationMultiplier, HighLogic.LoadedSceneIsFlight);
            updateMassAndCost();
            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onContainerUpdated(this);
        }
示例#6
0
        public void getResources(SSTUResourceList list)
        {
            int   len = subContainerData.Length;
            float unitsMax;
            float unitsFill;

            for (int i = 0; i < len; i++)
            {
                if (subContainerData[i].unitRatio > 0)
                {
                    unitsMax  = subContainerData[i].resourceUnits;
                    unitsFill = unitsMax * subContainerData[i].fillPercentage;
                    list.addResource(subContainerData[i].name, unitsFill, unitsMax);
                }
            }
        }
示例#7
0
        public void addResources(SSTUResourceList list, float cubicMeters)
        {
            float resourceVolumeRatio;
            float resourcePercent;
            float resourceVolume;
            int   len = resourceRatios.Length;
            ContainerResourceRatio ratio;

            for (int i = 0; i < len; i++)
            {
                ratio = resourceRatios[i];
                resourceVolumeRatio = ratio.resourceRatio * ratio.resourceVolume;
                resourcePercent     = resourceVolumeRatio / totalVolumeRatio;
                resourceVolume      = cubicMeters * resourcePercent;
                list.addResourceByVolume(ratio.resourceName, resourceVolume);
            }
        }
示例#8
0
        /// <summary>
        /// Update the resources for the part from the resources in the currently configured containers
        /// </summary>
        private void updateTankResources()
        {
            SSTUResourceList list = new SSTUResourceList();
            int len = containers.Length;

            for (int i = 0; i < len; i++)
            {
                containers[i].getResources(list);
            }
            list.setResourcesToPart(part, inflationMultiplier, HighLogic.LoadedSceneIsFlight, blacklistedResources);
            updateMassAndCost();
            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onContainerUpdated(this);
            SSTUResourceBoiloff rb = part.GetComponent <SSTUResourceBoiloff>();

            if (rb != null)
            {
                rb.onPartResourcesChanged();
            }
        }
示例#9
0
 /// <summary>
 /// Updates the min/max quantities of resource in the part based on the current 'totalFuelVolume' field and currently set fuel type
 /// </summary>
 private void updatePartResources()
 {
     if (useRF)
     {
         return;
     }
     float reserveFuelVolume = totalFuelVolume * fuelReserveRatio;
     float fuelUsableVolume = totalFuelVolume - reserveFuelVolume;
     float currentDiameterScale = currentTankDiameter / defaultTankDiameter;
     float currentHeightScale = currentTankHeight / defaultTankHeight;
     float energyReserve = defaultElectricCharge * currentDiameterScale * currentHeightScale;
     SSTUResourceList resourceList = new SSTUResourceList();
     currentFuelTypeData.addResources(fuelUsableVolume, resourceList);
     reserveFuelTypeData.addResources(reserveFuelVolume, resourceList);
     resourceList.addResource("ElectricCharge", energyReserve);
     resourceList.setResourcesToPart(part, true);
 }
示例#10
0
 public SSTUResourceList getResourceList(float volume)
 {
     SSTUResourceList resourceList = new SSTUResourceList();
     return addResources(volume, resourceList);
 }
示例#11
0
 public SSTUResourceList addResources(float volume, SSTUResourceList list)
 {
     fuelType.addResources(volume, list);
     return list;
 }
 /// <summary>
 /// Update the resources for the part from the resources in the currently configured containers
 /// </summary>
 private void updateTankResources()
 {
     SSTUResourceList list = new SSTUResourceList();
     int len = containers.Length;
     for (int i = 0; i < len; i++)
     {
         containers[i].getResources(list);
     }
     list.setResourcesToPart(part);
     updateMassAndCost();
     updateKISVolume();
     SSTUStockInterop.fireEditorUpdate();
     SSTUModInterop.onContainerUpdated(this);
 }