public setFuelPreset ( ContainerDefinition container, ContainerFuelPreset preset, bool updateSymmetry ) : void | ||
container | ContainerDefinition | |
preset | ContainerFuelPreset | |
updateSymmetry | bool | |
return | void |
public void setFuelPreset(ContainerDefinition container, ContainerFuelPreset preset, bool updateSymmetry) { container.setFuelPreset(preset); if (updateSymmetry) { foreach (Part p in part.symmetryCounterparts) { SSTUVolumeContainer mod = p.GetComponent <SSTUVolumeContainer>(); ContainerDefinition def2 = mod.getContainer(container.name); ContainerFuelPreset preset2 = def2.internalGetFuelPreset(preset.name); mod.setFuelPreset(def2, preset2, false); } } }
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); } }