/// <summary> /// Updates the list of our vessels and other peoples vessel. /// We do this in another routine to improve performance /// </summary> private void UpdateOwnedAndOtherPeopleVesselList() { if (Enabled && VesselImmortalSystemReady) { OwnedVesselIds.Clear(); OwnedVesselIds.AddRange(LockSystem.LockQuery.GetAllControlLocks(SettingsSystem.CurrentSettings.PlayerName) .Select(l => l.VesselId) .Union(LockSystem.LockQuery.GetAllUpdateLocks(SettingsSystem.CurrentSettings.PlayerName) .Select(l => l.VesselId)) .Where(v => !SystemsContainer.Get <VesselRemoveSystem>().VesselWillBeKilled(v))); OwnedVessels.Clear(); OwnedVessels.AddRange(OwnedVesselIds .Select(FlightGlobals.FindVessel) .Where(v => v != null)); OtherPeopleVessels.Clear(); OtherPeopleVessels.AddRange(LockSystem.LockQuery.GetAllControlLocks() .Union(LockSystem.LockQuery.GetAllUpdateLocks()) .Select(l => l.VesselId) .Except(OwnedVesselIds) .Where(v => !SystemsContainer.Get <VesselRemoveSystem>().VesselWillBeKilled(v)) .Select(FlightGlobals.FindVessel) .Where(v => v != null)); } }
protected override void OnDisabled() { base.OnDisabled(); OwnedVessels.Clear(); OtherPeopleVessels.Clear(); //In case we disable this system, set all the vessels back as mortal... foreach (var vessel in FlightGlobals.Vessels) { SetVesselImmortalState(vessel, false); } }