//call this when a node no longer exists, so that this node knows that it's no longer a valid source public void RemoveSourceNode(FuelNode n) { if (fuelLineSources.Contains(n)) fuelLineSources.Remove(n); if (stackNodeSources.Contains(n)) stackNodeSources.Remove(n); if (surfaceMountParent == n) surfaceMountParent = null; }
// Find the set of nodes from which we can draw resources according to the STACK_PRIORITY_SEARCH flow scheme. // This gets called after all the FuelNodes have been constructed in order to set up the fuel flow graph. // Note that fuel flow through fuel lines and docked docking nodes is set up separately in // SetupFuelLineSources*() public void SetupRegularSources(Part part, Dictionary<Part, FuelNode> nodeLookup) { // When fuelCrossFeed is enabled we can draw fuel through stack and surface attachment if (part.fuelCrossFeed) { // Stack nodes: for (int i = 0; i < part.attachNodes.Count; i++) { AttachNode attachNode = part.attachNodes[i]; if (attachNode.attachedPart != null) { // For stack nodes, we can draw fuel unless this node is specifically // labeled as having crossfeed disabled (Kashua rule #4) FuelNode fuelnode; if (attachNode.id != "Strut" && attachNode.ResourceXFeed && !(part.NoCrossFeedNodeKey.Length > 0 && attachNode.id.Contains(part.NoCrossFeedNodeKey)) && nodeLookup.TryGetValue(attachNode.attachedPart, out fuelnode)) { stackNodeSources.Add(fuelnode); } } } // If we are surface-mounted to our parent we can draw fuel from it (Kashua rule #7) if (part.attachMode == AttachModes.SRF_ATTACH && part.parent != null) { surfaceMountParent = nodeLookup[part.parent]; } } }