public LabEquipmentSlot(EquipmentRacks t, LabEquipment e = null)
 {
     type = t;
     if (e != null && type == e.getType())
     {
         equ = e;
     }
 }
 public bool hasEquipmentFreeExperimentSlot(EquipmentRacks rack)
 {
     switch (rack)
     {
         case EquipmentRacks.KEMINI:
             return keminiSlot.experimentSlotFree();
         default:
             return false;
     }
 }
        public bool hasEquipmentInstalled(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.KEMINI:
                    return keminiSlot.isEquipmentInstalled();

                default:
                    return false;
            }
        }
        public LabEquipment(string abb, string name, EquipmentRacks type, float mass, float productPerHour, string product, float reactantPerProduct, string reactant)
        {
            this.abb = abb;
            this.name = name;
            this.type = type;
            this.mass = mass;

            this.product = product;
            this.productPerHour = productPerHour;

            this.reactant = reactant;
            this.reactantPerProduct = reactantPerProduct;
        }
 private GameDatabase.TextureInfo getTexture(EquipmentRacks p)
 {
     KeyValuePair<string,string> textureName;
     if (textureNameReg.TryGetValue(p, out textureName))
     {
         GameDatabase.TextureInfo newTex = GameDatabase.Instance.GetTextureInfoIn(textureName.Key, textureName.Value);
         if (newTex != null)
         {
             return newTex;
         }
     }
     NE_Helper.logError("Could not load texture for Exp: " + p);
     return null;
 }
 internal GameDatabase.TextureInfo getTextureForEquipment(EquipmentRacks type)
 {
     GameDatabase.TextureInfo tex;
     if (textureReg.TryGetValue(type, out tex))
     {
         return tex;
     }
     else
     {
         NE_Helper.log("Loading Texture for experiment: " + type);
         GameDatabase.TextureInfo newTex = getTexture(type);
         if (newTex != null)
         {
             textureReg.Add(type, newTex);
             return newTex;
         }
         else
         {
             NE_Helper.logError("Texture for: " + type + " not found try to return default texture");
             newTex = getTexture(EquipmentRacks.NONE);
             return newTex;
         }
     }
 }
        public bool isEquipmentRunning(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.MSG:
                    return keminiSlot.isEquipmentRunning();

                default:
                    return false;
            }
        }
        public bool hasEquipmentFreeExperimentSlot(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.CIR:
                    return cirSlot.experimentSlotFree();

                case EquipmentRacks.FIR:
                    return firSlot.experimentSlotFree();

                case EquipmentRacks.PRINTER:
                    return printerSlot.experimentSlotFree();

                default:
                    return false;
            }
        }
 internal bool hasEquipmentFreeExperimentSlot(EquipmentRacks neededEquipment)
 {
     return exposureSlot.experimentSlotFree();
 }
        public bool isEquipmentRunning(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.CIR:
                    return cirSlot.isEquipmentRunning();

                case EquipmentRacks.FIR:
                    return firSlot.isEquipmentRunning();

                case EquipmentRacks.PRINTER:
                    return printerSlot.isEquipmentRunning();

                default:
                    return false;
            }
        }
        public bool hasEquipmentInstalled(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.CIR:
                    return cirSlot.isEquipmentInstalled();

                case EquipmentRacks.FIR:
                    return firSlot.isEquipmentInstalled();

                case EquipmentRacks.PRINTER:
                    return printerSlot.isEquipmentInstalled();

                default:
                    return false;
            }
        }
        public bool hasEquipmentFreeExperimentSlot(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.MSG:
                    return msgSlot.experimentSlotFree();
                case EquipmentRacks.USU:
                    return usuSlot.experimentSlotFree();

                default:
                    return false;
            }
        }
 private void setEquipmentActive(EquipmentRacks rack)
 {
     switch (rack)
     {
         case EquipmentRacks.MSG:
             if (msg != null)
             {
                 msg.SetActive(msgSlot.isEquipmentInstalled());
             }
             else
             {
                 initERacksActive();
                 if (msg != null) msg.SetActive(msgSlot.isEquipmentInstalled());
             }
             break;
         case EquipmentRacks.USU:
             if (usu != null)
             {
                 usu.SetActive(usuSlot.isEquipmentInstalled());
             }
             else
             {
                 initERacksActive();
                 if (usu != null) usu.SetActive(usuSlot.isEquipmentInstalled());
             }
             break;
     }
 }
        public bool isEquipmentRunning(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.MSG:
                    return msgSlot.isEquipmentRunning();
                case EquipmentRacks.USU:
                    return usuSlot.isEquipmentRunning();

                default:
                    return false;
            }
        }
        public bool hasEquipmentInstalled(EquipmentRacks rack)
        {
            switch (rack)
            {
                case EquipmentRacks.MSG:
                    return msgSlot.isEquipmentInstalled();
                case EquipmentRacks.USU:
                    return usuSlot.isEquipmentInstalled();

                default:
                    return false;
            }
        }
        private EquipmentRackContainer getRackModul(EquipmentRacks equipmentRack)
        {
            List<EquipmentRackContainer> moduls = new List<EquipmentRackContainer>(GameObject.FindObjectsOfType(typeof(EquipmentRackContainer)) as EquipmentRackContainer[]);

            foreach (EquipmentRackContainer modul in moduls)
            {
                if (modul.vessel == this.vessel && modul.getRackType() == equipmentRack)
                {
                    return modul;
                }
            }

            return null;
        }
 private void setEquipmentActive(EquipmentRacks rack)
 {
     switch (rack)
     {
         case EquipmentRacks.FIR:
             if (fir != null)
             {
                 fir.SetActive(firSlot.isEquipmentInstalled());
             }
             else
             {
                 initERacksActive();
                 if(fir != null)fir.SetActive(firSlot.isEquipmentInstalled());
             }
             break;
         case EquipmentRacks.CIR:
             if (cir != null)
             {
                 cir.SetActive(cirSlot.isEquipmentInstalled());
             }
             else
             {
                 initERacksActive();
                 if (cir != null) cir.SetActive(cirSlot.isEquipmentInstalled());
             }
             break;
         case EquipmentRacks.PRINTER:
             if (printer != null)
             {
                 printer.SetActive(printerSlot.isEquipmentInstalled());
             }
             else
             {
                 initERacksActive();
                 if (printer != null) printer.SetActive(printerSlot.isEquipmentInstalled());
             }
             break;
     }
 }
 protected MPLExperimentData(string id, string type, string name, string abb, EquipmentRacks eq, float mass)
     : base(id, type, name, abb, eq, mass)
 {
 }
 private static LabEquipment getLabEquipment(Part part, EquipmentRacks type)
 {
     LabEquipmentModule lem = part.GetComponent<LabEquipmentModule>();
     return new LabEquipment(lem.abbreviation, lem.eqName, type, part.mass, lem.productPerHour, lem.product, lem.reactantPerProduct, lem.reactant);
 }