public override void CompleteTarget(object obj) { if (m_progressSoundEmitter.IsPlaying) { m_progressSoundEmitter.StopSound(true); } var player = obj as IMyPlayer; if (player == null) { return; } if (Sync.IsServer) { m_constructionBlock.SendCompleteTarget(player); } m_constructionBlock.ParticleManager.CompleteTarget(obj); foreach (IMyPlayer item in TargetList.Where(x => (IMyPlayer)x == player)) { Logging.Instance.WriteLine(string.Format("COMPLETING Medical Target: {0} - {1} (Player={2},Position={3})", m_constructionBlock.ConstructionBlock.EntityId, item.GetType().Name, item.DisplayName, item.GetPosition())); } TargetList.RemoveAll(x => ((IMyPlayer)x).IdentityId == player.IdentityId); PotentialTargetList.RemoveAll(x => ((IMyPlayer)x).IdentityId == player.IdentityId); m_targetTracker.Remove(player); }
public void CompleteTarget(long entityId) { m_constructionBlock.ParticleManager.CompleteTarget(entityId); foreach (var item in m_targetTracker.ToList()) { if (item.Key.EntityId == entityId) { m_targetTracker.Remove(item.Key); } } foreach (IMyEntity item in TargetList.Where(x => ((IMyEntity)x).EntityId == entityId)) { Logging.Instance.WriteLine(string.Format("COMPLETING Floating Object Target: {0} - {1} (EntityID={2},Position={3})", m_constructionBlock.ConstructionBlock.EntityId, item.GetType().Name, item.EntityId, item.GetPosition())); } TargetList.RemoveAll(x => ((IMyEntity)x).EntityId == entityId); PotentialTargetList.RemoveAll(x => ((IMyEntity)x).EntityId == entityId); }