public static LabEquipment getLabEquipmentFromNode(ConfigNode node, Lab lab)
        {
            if (node.name != CONFIG_NODE_NAME)
            {
                NE_Helper.logError("getLabEquipmentFromNode: invalid Node: " + node.name);
                return(getNullObject());
            }

            string abb  = node.GetValue(ABB_VALUE);
            string name = node.GetValue(NAME_VALUE);
            float  mass = NE_Helper.GetValueAsFloat(node, MASS_VALUE);
            float  cost = NE_Helper.GetValueAsFloat(node, COST_VALUE);

            string product        = node.GetValue(PRODUCT_VALUE);
            float  productPerHour = NE_Helper.GetValueAsFloat(node, PRODUCT_PER_HOUR_VALUE);

            string reactant           = node.GetValue(REACTANT_VALUE);
            float  reactantPerProduct = NE_Helper.GetValueAsFloat(node, REACTANT_PER_PRODUCT_VALUE);

            EquipmentRacks type = EquipmentRacksFactory.getType(node.GetValue(TYPE_VALUE));

            LabEquipment eq = new LabEquipment(abb, name, type, mass, cost, productPerHour, product, reactantPerProduct, reactant);

            eq.lab = lab;
            ConfigNode expNode = node.GetNode(ExperimentData.CONFIG_NODE_NAME);

            if (expNode != null)
            {
                eq.loadExperiment(ExperimentData.getExperimentDataFromNode(expNode));
            }

            return(eq);
        }
Beispiel #2
0
        public LabEquipment install()
        {
            LabEquipment ret = leq;

            setEquipment(LabEquipment.getNullObject());
            return(ret);
        }
Beispiel #3
0
 public LabEquipmentSlot(EquipmentRacks t, LabEquipment e = null)
 {
     type = t;
     if (e != null && type == e.getType())
     {
         equ = e;
     }
 }
 public LabEquipmentSlot(EquipmentRacks t, LabEquipment e = null)
 {
     type = t;
     if (e != null && type == e.getType())
     {
         equ = e;
     }
 }
        public void installEquipmentRack(LabEquipment le)
        {
            switch (le.getType())
            {
            case EquipmentRacks.KEMINI:

                keminiSlot.install(le, this);
                break;
            }
        }
Beispiel #6
0
 public void install(LabEquipment eq, Lab lab)
 {
     if (eq != null && type == eq.getType())
     {
         equ = eq;
         eq.install(lab);
     }
     else
     {
         NE_Helper.logError("LabEquipmentSlot.install: Type doesn't macht");
     }
 }
        public void installEquipmentRack(LabEquipment le)
        {
            switch (le.getType())
            {
                case EquipmentRacks.KEMINI:

                    keminiSlot.install(le, this);
                    break;
            }

            part.mass += le.getMass();
        }
Beispiel #8
0
 private void setTexture(LabEquipment type)
 {
     GameDatabase.TextureInfo tex = texFac.getTextureForEquipment(type.getType());
     if (tex != null)
     {
         changeTexture(tex);
     }
     else
     {
         NE_Helper.logError("Change Equipment Container Texure: Texture Null");
     }
 }
Beispiel #9
0
 public void chooseEquipment()
 {
     if (leq.getType() == EquipmentRacks.NONE)
     {
         availableRacks = EquipmentRackRegistry.getAvailableRacks();
         showAddGui();
     }
     else
     {
         setEquipment(LabEquipment.getNullObject());
         Events["chooseEquipment"].guiName = Localizer.GetStringByTag("#ne_Add_Lab_Equipment");
     }
 }
Beispiel #10
0
 public void chooseEquipment()
 {
     if (leq.getType() == EquipmentRacks.NONE)
     {
         availableRacks = EquipmentRackRegistry.getAvailableRacks();
         showGui        = true;
     }
     else
     {
         setEquipment(LabEquipment.getNullObject());
         Events["chooseEquipment"].guiName = "Add Lab Equipment";
     }
 }
Beispiel #11
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode eqNode = node.GetNode(LabEquipment.CONFIG_NODE_NAME);

            if (eqNode != null)
            {
                setEquipment(LabEquipment.getLabEquipmentFromNode(eqNode, null));
            }
            else
            {
                setEquipment(LabEquipment.getNullObject());
            }
        }
Beispiel #12
0
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor)
     {
         return;
     }
     keminiSlot.onStart(this);
     if (!keminiSlot.isEquipmentInstalled())
     {
         LabEquipment keminiLab = new LabEquipment("KL", "Kemini Lab", EquipmentRacks.KEMINI, 0.0f, 1, Resources.LAB_TIME, 0.2f, Resources.ELECTRIC_CHARGE);
         keminiSlot.install(keminiLab, this);
     }
 }
Beispiel #13
0
 private void setEquipment(LabEquipment er)
 {
     leq    = er;
     status = leq.getName();
     if (leq.getType() == EquipmentRacks.NONE)
     {
         Events["chooseEquipment"].guiName = Localizer.GetStringByTag("#ne_Add_Lab_Equipment");
     }
     else
     {
         Events["chooseEquipment"].guiName = Localizer.GetStringByTag("#ne_Remove_Equipment");
     }
     RefreshMassAndCost();
     setTexture(leq);
 }
Beispiel #14
0
        public static LabEquipmentSlot getLabEquipmentSlotFromConfigNode(ConfigNode node, Lab lab)
        {
            if (node == null || node.name != CONFIG_NODE_NAME)
            {
                NE_Helper.logError("getLabEquipmentFromNode: invalid Node: " + node == null? "NULL" : node.name);
                return(new LabEquipmentSlot(EquipmentRacks.NONE));
            }
            EquipmentRacks type   = EquipmentRacksFactory.getType(node.GetValue(TYPE_VALUE));
            LabEquipment   le     = null;
            ConfigNode     leNode = node.GetNode(LabEquipment.CONFIG_NODE_NAME);

            if (leNode != null)
            {
                le = LabEquipment.getLabEquipmentFromNode(leNode, lab);
            }
            return(new LabEquipmentSlot(type, le));
        }
Beispiel #15
0
        private void setEquipment(LabEquipment er)
        {
            leq    = er;
            status = leq.getName();
            if (leq.getType() == EquipmentRacks.NONE)
            {
                Events["chooseEquipment"].guiName = "Add Lab Equipment";
                part.mass = EMPTY_MASS;
            }
            else
            {
                Events["chooseEquipment"].guiName = "Remove Equipment";
                part.mass += er.getMass();
            }

            setTexture(leq);
        }
Beispiel #16
0
        public void installEquipmentRack(LabEquipment le)
        {
            switch (le.getType())
            {
            case EquipmentRacks.MSG:
                msg.SetActive(true);
                msgSlot.install(le, this);
                cfe.SetActive(false);
                break;

            case EquipmentRacks.USU:
                usu.SetActive(true);
                usuSlot.install(le, this);
                break;
            }

            part.mass += le.getMass();
        }
Beispiel #17
0
        public void installEquipmentRack(LabEquipment le)
        {
            switch (le.getType())
            {
            case EquipmentRacks.FIR:
                fir.SetActive(true);
                firSlot.install(le, this);
                break;

            case EquipmentRacks.CIR:
                cir.SetActive(true);
                cirSlot.install(le, this);
                break;

            case EquipmentRacks.PRINTER:
                printer.SetActive(true);
                printerSlot.install(le, this);
                break;
            }
            part.mass += le.getMass();
        }
 internal void installed(LabEquipment rack)
 {
     state = ExperimentState.INSTALLED;
     store = rack;
     rack.getLab().part.mass += getMass();
 }
        public void installEquipmentRack(LabEquipment le)
        {
            switch (le.getType())
            {
                case EquipmentRacks.MSG:
                    msg.SetActive(true);
                    msgSlot.install(le, this);
                    cfe.SetActive(false);
                    break;
                case EquipmentRacks.USU:
                    usu.SetActive(true);
                    usuSlot.install(le, this);
                    break;
            }

            part.mass += le.getMass();
        }
 public void installEquipmentRack(LabEquipment le)
 {
     switch (le.getType())
     {
         case EquipmentRacks.FIR:
             fir.SetActive(true);
             firSlot.install(le, this);
             break;
         case EquipmentRacks.CIR:
             cir.SetActive(true);
             cirSlot.install(le, this);
             break;
         case EquipmentRacks.PRINTER:
             printer.SetActive(true);
             printerSlot.install(le, this);
             break;
     }
     part.mass += le.getMass();
 }
 public override void OnStart(PartModule.StartState state)
 {
     base.OnStart(state);
     if (state == StartState.Editor)
     {
         return;
     }
     keminiSlot.onStart(this);
     if (!keminiSlot.isEquipmentInstalled())
     {
         LabEquipment keminiLab = new LabEquipment("KL", "Kemini Lab", EquipmentRacks.KEMINI, 0.0f, 1, Resources.LAB_TIME, 0.2f, Resources.ELECTRIC_CHARGE);
         keminiSlot.install(keminiLab, this);
     }
 }
Beispiel #22
0
 private void onAddEquipment(LabEquipment e)
 {
     setEquipment(e);
 }
        private void setEquipment(LabEquipment er)
        {
            leq = er;
            status = leq.getName();
            if (leq.getType() == EquipmentRacks.NONE)
            {
                Events["chooseEquipment"].guiName = "Add Lab Equipment";
                part.mass = EMPTY_MASS;
            }
            else
            {
                Events["chooseEquipment"].guiName = "Remove Equipment";
                part.mass += er.getMass();
            }

            setTexture(leq);
        }
 internal void load(LabEquipment labEquipment)
 {
     store = labEquipment;
 }
 public void install(LabEquipment eq, Lab lab)
 {
     if (eq != null && type == eq.getType())
     {
         equ = eq;
         eq.install(lab);
     }
     else
     {
         NE_Helper.logError("LabEquipmentSlot.install: Type doesn't macht");
     }
 }
 private void setTexture(LabEquipment type)
 {
     GameDatabase.TextureInfo tex = texFac.getTextureForEquipment(type.getType());
     if (tex != null)
     {
         changeTexture(tex);
     }
     else
     {
         NE_Helper.logError("Change Equipment Container Texure: Texture Null");
     }
 }
        public static LabEquipment getLabEquipmentFromNode(ConfigNode node, Lab lab)
        {
            if (node.name != CONFIG_NODE_NAME)
            {
                NE_Helper.logError("getLabEquipmentFromNode: invalid Node: " + node.name);
                return getNullObject();
            }

            string abb = node.GetValue(ABB_VALUE);
            string name = node.GetValue(NAME_VALUE);
            float mass = float.Parse(node.GetValue(MASS_VALUE));

            string product = node.GetValue(PRODUCT_VALUE);
            float productPerHour = float.Parse(node.GetValue(PRODUCT_PER_HOUR_VALUE));

            string reactant = node.GetValue(REACTANT_VALUE);
            float reactantPerProduct = float.Parse(node.GetValue(REACTANT_PER_PRODUCT_VALUE));

            EquipmentRacks type = EquipmentRacksFactory.getType(node.GetValue(TYPE_VALUE));

            LabEquipment eq = new LabEquipment(abb, name, type, mass, productPerHour, product, reactantPerProduct, reactant);
            eq.lab = lab;
            ConfigNode expNode = node.GetNode(ExperimentData.CONFIG_NODE_NAME);
            if (expNode != null)
            {
                eq.loadExperiment(ExperimentData.getExperimentDataFromNode(expNode));
            }

            return eq;
        }