void FixedUpdate() { if (HighLogic.LoadedSceneIsFlight) { if (!flightInitialized) { initFlight(); } if (CrossfeedType == FuelFlowtype.uniDirectional) { if (part.children.Count > 0) { if (observedPart == null) { observedPart = part.children[0]; } } else { observedPart = null; } if (observedPart != null && observedPart.Resources.Count > 0) { for (int i = 0; i < availableResourceIDs.Count; i++) { double amount, maxAmount; partSet.GetConnectedResourceTotals(availableResourceIDs[i], out amount, out maxAmount, true); if (amount == 0) { if (crossfeedToggleModule.crossfeedStatus) { Log.Info("Setting part crossfeed to false"); crossfeedToggleModule.ToggleEvent(); } } } } } } else { flightInitialized = false; } }
private double GetResourceOfCurrentStage(string resourceName) { PartResourceDefinition resourceDef = PartResourceLibrary.Instance.resourceDefinitions[resourceName]; double total = 0; double capacity = 0; if (resourceDef == null) { throw new KOSInvalidArgumentException("STAGE", resourceName, "The resource definition could not be found"); } CreatePartSet(); partSet.GetConnectedResourceTotals(resourceDef.id, out total, out capacity, true); return(total); }
public override ScalarValue GetAmount() { CreatePartSet(); partSet.GetConnectedResourceTotals(resourceId, out amount, out capacity, true); return(amount); }