Exemplo n.º 1
0
 public void FindTank()
 {
     if (vessel != null)
     {
         var tankParts = vessel.parts.Where(p => p.Modules.Contains("USI_DynamicTank"));
         if (!tankParts.Any())
         {
             status = "Not connected";
             return;
         }
         foreach (var tankPart in tankParts)
         {
             var t = tankPart.Modules.OfType<USI_DynamicTank>().First();
             if (t == null)
             {
                 return;
             }
             if (_tank == null)
             {
                 _tank = t;
                 _stepSize = _tank.stepSize;
                 status = string.Format("{0} avail", _tank.availCapacity);
             }
             //Always go to the largest tank
             else if (t.availCapacity > _tank.availCapacity)
             {
                 _tank = t;
                 _stepSize = _tank.stepSize;
                 status = string.Format("{0} avail", _tank.availCapacity);
             }
         }
     }
 }
Exemplo n.º 2
0
 public void FindTank()
 {
     if (vessel != null)
     {
         var tankParts = vessel.parts.Where(p => p.Modules.Contains("USI_DynamicTank"));
         if (!tankParts.Any())
         {
             status = "Not connected";
             return;
         }
         foreach (var tankPart in tankParts)
         {
             var t = tankPart.Modules.OfType <USI_DynamicTank>().First();
             if (t == null)
             {
                 return;
             }
             if (_tank == null)
             {
                 _tank     = t;
                 _stepSize = _tank.stepSize;
                 status    = string.Format("{0} avail", _tank.availCapacity);
             }
             //Always go to the largest tank
             else if (t.availCapacity > _tank.availCapacity)
             {
                 _tank     = t;
                 _stepSize = _tank.stepSize;
                 status    = string.Format("{0} avail", _tank.availCapacity);
             }
         }
     }
 }
Exemplo n.º 3
0
 private void FindPotato()
 {
     _potato = part.FindModulesImplementing <ModuleAsteroid>().FirstOrDefault();
     _tank   = part.FindModulesImplementing <USI_DynamicTank>().FirstOrDefault();
     if (OriginalMass < ResourceUtilities.FLOAT_TOLERANCE)
     {
         OriginalMass = _potato.part.mass;
     }
 }
Exemplo n.º 4
0
 private void FindPotato()
 {
     _potato = part.FindModulesImplementing<ModuleAsteroid>().FirstOrDefault();
     _tank = part.FindModulesImplementing<USI_DynamicTank>().FirstOrDefault();
     if (OriginalMass < ResourceUtilities.FLOAT_TOLERANCE)
     {
         OriginalMass = _potato.part.mass;
     }
 }
Exemplo n.º 5
0
        private void FindPotato()
        {
            if (vessel != null)
            {
                var potatoes = vessel.Parts.Where(p => p.Modules.Contains("ModuleAsteroid"));
                if (potatoes.Any())
                {
                    if (_potato == null)
                    {
                        _potato = potatoes.FirstOrDefault();
                        if (_potato.Modules.Contains("USI_DynamicTank"))
                        {
                            _tank = _potato.Modules.OfType <USI_DynamicTank>().FirstOrDefault();
                        }
                        else
                        {
                            _potato = null;
                            return;
                        }
                        if (_potato.Modules.Contains("USI_PotatoInfo"))
                        {
                            _potatoInfo = _potato.Modules.OfType <USI_PotatoInfo>().FirstOrDefault();
                            if (!_potatoInfo.Explored)
                            {
                                float rock = _potato.mass / 0.00025f * _potatoInfo.maxPercentHollow;
                                _potatoInfo.maxRock  = (float)Math.Round(rock * 0.01, 0) * 100;
                                _potatoInfo.Explored = true;
                            }
                            _potatoInfo.potatoSize = _potato.mass + "t";
                        }
                        else
                        {
                            _potato = null;
                            return;
                        }

                        if (_potato.Resources.Contains("Rock"))
                        {
                            _rock = _potato.Resources["Rock"];
                        }
                        else
                        {
                            _potato = null;
                            return;
                        }
                    }
                    return;
                }
            }
            _potato = null;
        }
Exemplo n.º 6
0
 private void FindPotato()
 {
     if (vessel != null)
     {
         var potatoes = vessel.Parts.Where(p => p.Modules.Contains("ModuleAsteroid"));
         if (potatoes.Any())
         {
             if (_potato == null)
             {
                 _potato = potatoes.FirstOrDefault();
                 if (_potato.Modules.Contains("USI_DynamicTank"))
                 {
                     _tank = _potato.Modules.OfType <USI_DynamicTank>().FirstOrDefault();
                 }
                 if (_potato.Resources.Contains("Rock"))
                 {
                     _rock = _potato.Resources["Rock"];
                 }
             }
             return;
         }
     }
     _potato = null;
 }
Exemplo n.º 7
0
 private void FindPotato()
 {
     if (vessel != null)
     {
         var potatoes = vessel.Parts.Where(p => p.Modules.Contains("ModuleAsteroid"));
         if (potatoes.Any())
         {
             if (_potato == null)
             {
                 _potato = potatoes.FirstOrDefault();
                 if (_potato.Modules.Contains("USI_DynamicTank"))
                 {
                     _tank = _potato.Modules.OfType<USI_DynamicTank>().FirstOrDefault();
                 }
                 if (_potato.Resources.Contains("Rock"))
                 {
                     _rock = _potato.Resources["Rock"];
                 }
             }
             return;
         }
     }
     _potato = null;
 }