onPartFuelVolumeUpdate() public static method

public static onPartFuelVolumeUpdate ( Part part, float liters ) : bool
part Part
liters float
return bool
        private void updateResourceVolume()
        {
            float volume = coreModule.getModuleVolume();

            if (useAdapterVolume)
            {
                volume += topModule.getModuleVolume();
                volume += bottomModule.getModuleVolume();
            }
            SSTUModInterop.onPartFuelVolumeUpdate(part, volume * 1000f);
        }
Esempio n. 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);
            }
        }
Esempio n. 3
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 updateContainerVolume()
        {
            SSTUVolumeContainer vc = part.GetComponent <SSTUVolumeContainer>();

            if (vc != null)
            {
                float   tankPercent = 100 - supportPercent;
                float   monoPercent = supportPercent;
                float[] pcts        = new float[2];
                pcts[0] = tankPercent * 0.01f;
                pcts[1] = monoPercent * 0.01f;
                vc.setContainerPercents(pcts, totalTankVolume * 1000f);
            }
            else
            {
                //real-fuels handling....
                SSTUModInterop.onPartFuelVolumeUpdate(part, totalTankVolume * 1000f);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Updates the associated VolumeContainer with any changes to part volume from this module
        /// </summary>
        private void updateContainerVolume()
        {
            float liters = calcTotalVolume();
            SSTUVolumeContainer container = part.GetComponent <SSTUVolumeContainer>();

            if (container == null)
            {
                SSTUModInterop.onPartFuelVolumeUpdate(part, liters);
                return;
            }
            int len = container.numberOfContainers;

            float[] percents = new float[len];
            float   total    = liters;
            float   val;

            for (int i = 0; i < len; i++)
            {
                val         = calcVolume(i);
                percents[i] = val / total;
            }
            container.setContainerPercents(percents, total);
        }
Esempio n. 5
0
 private void updateContainerVolume()
 {
     SSTUModInterop.onPartFuelVolumeUpdate(part, currentTankVolume * 1000f);
 }