private void TransferSetup() { if (!HighLogic.LoadedSceneIsFlight) { return; } activeId = FlightGlobals.ActiveVessel.id; var PotentialVessels = LogisticsTools.GetNearbyVessels(150, true, FlightGlobals.ActiveVessel, true); NearVessels = new List <Vessel>(); foreach (var v in PotentialVessels) { if (HasResources(v)) { NearVessels.Add(v); } } if (NearVessels.Count == 0) { return; } _crewPresent = NearVessels.Any(v => v.GetCrewCount() > 0); _fromVessel = new TransferVessel(); _fromVessel.Setup(NearVessels[0], 0); var lastIdx = NearVessels.Count - 1; _toVessel = new TransferVessel(); _toVessel.Setup(NearVessels[lastIdx], lastIdx); _resList = RebuildResourceList(); }
private void TransferSetup() { if (!HighLogic.LoadedSceneIsFlight) { return; } _activeVesselIdOnLastTransferSetup = FlightGlobals.ActiveVessel.id; if ((_participatingVessels == null) || (_participatingVessels.Count == 0)) { _crewPresent = false; _fromVessel = null; _toVessel = null; _transferableResources = null; } else { _crewPresent = _participatingVessels.Any(v => v.GetCrewCount() > 0); _fromVessel = new TransferVessel(); _fromVessel.Setup(_participatingVessels[0], 0); var lastIdx = _participatingVessels.Count - 1; _toVessel = new TransferVessel(); _toVessel.Setup(_participatingVessels[lastIdx], lastIdx); _transferableResources = RebuildResourceList(); } }
private void SetNextVessel(TransferVessel v) { var idx = v.Idx + 1; if (idx == _participatingVessels.Count) { idx = 0; } v.Setup(_participatingVessels[idx], idx); if (_fromVessel.Idx == _toVessel.Idx && _participatingVessels.Count > 1) { SetNextVessel(v); } _transferableResources = RebuildResourceList(); }
private void SetNextVessel(TransferVessel v) { var idx = v.Idx + 1; if (idx == NearVessels.Count) { idx = 0; } v.Setup(NearVessels[idx], idx); if (_fromVessel.Idx == _toVessel.Idx && NearVessels.Count > 1) { SetNextVessel(v); } _resList = RebuildResourceList(); }
private void SetPrevVessel(TransferVessel v) { var idx = v.Idx - 1; if (idx < 0) { idx = NearVessels.Count - 1; } v.Setup(NearVessels[idx], idx); _resList = RebuildResourceList(); if (_fromVessel.Idx == _toVessel.Idx && NearVessels.Count > 1) { SetPrevVessel(v); } }
private void TransferSetup() { if (!HighLogic.LoadedSceneIsFlight) return; activeId = FlightGlobals.ActiveVessel.id; var PotentialVessels = LogisticsTools.GetNearbyVessels(150, true, FlightGlobals.ActiveVessel, true); NearVessels = new List<Vessel>(); foreach (var v in PotentialVessels) { if(HasResources(v)) NearVessels.Add(v); } if (NearVessels.Count == 0) return; _crewPresent = NearVessels.Any(v => v.GetCrewCount() > 0); _fromVessel = new TransferVessel(); _fromVessel.Setup(NearVessels[0], 0); var lastIdx = NearVessels.Count - 1; _toVessel = new TransferVessel(); _toVessel.Setup(NearVessels[lastIdx], lastIdx); _resList = RebuildResourceList(); }
private void SetPrevVessel(TransferVessel v) { var idx = v.Idx - 1; if (idx < 0) idx = NearVessels.Count - 1; v.Setup(NearVessels[idx],idx); _resList = RebuildResourceList(); if (_fromVessel.Idx == _toVessel.Idx && NearVessels.Count > 1) SetPrevVessel(v); }