public RelayNetwork() { all = new List <RelayNode>(); comSats = new List <RelayNode>(); commandStations = new List <RelayNode>(); foreach (Vessel v in FlightGlobals.Vessels) { if (RTUtils.IsComsat(v)) { all.Add(new RelayNode(v)); } } foreach (RelayNode node in all) { if (node.HasCommand) { commandStations.Add(node); } else { comSats.Add(node); } } all.Add(new RelayNode()); commandStations.Add(new RelayNode()); foreach (KeyValuePair <Vessel, RemoteCore> pair in RTGlobals.coreList) { try { pair.Value.Rnode = new RelayNode(pair.Key); } catch { } } }
public void recalculate() { HashSet <Vessel> toDelete = new HashSet <Vessel>(); foreach (KeyValuePair <Vessel, RemoteCore> pair in this) { if (!(pair.Key.loaded && RTUtils.IsComsat(pair.Key))) { try { pair.Key.OnFlyByWire -= pair.Value.drive; } catch { } toDelete.Add(pair.Key); } } foreach (Vessel v in toDelete) { this.Remove(v); } toDelete.Clear(); }