public static void updateResourceVolume(Part part) { SSTULog.debug("Part volume changed..."); SSTUVolumeContainer vc = part.GetComponent <SSTUVolumeContainer>(); if (vc != null) { vc.recalcVolume(); SSTUResourceBoiloff rb = part.GetComponent <SSTUResourceBoiloff>(); if (rb != null) { rb.onPartResourcesChanged(); } } else { IContainerVolumeContributor[] contributors = part.FindModulesImplementing <IContainerVolumeContributor>().ToArray(); ContainerContribution[] cts; int len = contributors.Length; float totalVolume = 0; for (int i = 0; i < len; i++) { cts = contributors[i].getContainerContributions(); int len2 = cts.Length; for (int k = 0; k < len2; k++) { totalVolume += cts[k].containerVolume; } } realFuelsVolumeUpdate(part, totalVolume); } }
private void updateResourceAmounts(float mult) { SSTUVolumeContainer vc = part.GetComponent <SSTUVolumeContainer>(); if (vc != null) { vc.inflationMultiplier = mult; vc.recalcVolume(); } else { SSTUModInterop.updateResourceVolume(part);//call out to RF to update volume; it will obviously lack the inflation multiplier data } }
public static void updateContainerFuelType(FuelTypeISP fuelType, Part part, int containerIndex) { if (containerIndex < 0) { return; } SSTUVolumeContainer vc = part.GetComponent <SSTUVolumeContainer>(); if (vc == null) { SSTULog.error("Could not update fuel type - no SSTUVolumeContainer found in part"); return; } if (containerIndex < vc.numberOfContainers) { vc.setFuelPreset(containerIndex, fuelType.fuelPreset, false); vc.recalcVolume(); } else { SSTULog.error("Could not update fuel type - not enough containers in SSTUVolumeContainer for index: " + containerIndex + " only found: " + vc.numberOfContainers); } }