// Function from file: circuitprinter.dm
        public override void RefreshParts(  )
        {
            double T = 0;
            Obj_Item_Weapon_ReagentContainers_Glass G  = null;
            Obj_Item_Weapon_StockParts_MatterBin    M  = null;
            Obj_Item_Weapon_StockParts_Manipulator  M2 = null;

            T = 0;

            foreach (dynamic _a in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_ReagentContainers_Glass)))
            {
                G = _a;

                this.reagents.maximum_volume += G.volume;
                G.reagents.trans_to(this, G.reagents.total_volume);
            }

            foreach (dynamic _b in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_StockParts_MatterBin)))
            {
                M = _b;

                T += Convert.ToDouble(M.rating);
            }
            this.max_material_amount = T * 75000;
            T = 0;

            foreach (dynamic _c in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_StockParts_Manipulator)))
            {
                M2 = _c;

                T += Convert.ToDouble(M2.rating);
            }
            this.efficiency_coeff = Math.Pow(2, T - 1);
            return;
        }
        // Function from file: chem_grenade.dm
        public override void mix_reagents(  )
        {
            Obj_Item_SlimeExtract S = null;
            Obj_Item_Weapon_ReagentContainers_Glass G = null;


            foreach (dynamic _b in Lang13.Enumerate(this.beakers, typeof(Obj_Item_SlimeExtract)))
            {
                S = _b;


                if (S.Uses != 0)
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.beakers, typeof(Obj_Item_Weapon_ReagentContainers_Glass)))
                    {
                        G = _a;

                        G.reagents.trans_to(S, G.reagents.total_volume);
                    }

                    if (S != null && S.reagents != null && Lang13.Bool(S.reagents.total_volume))
                    {
                        S.reagents.trans_to(this, S.reagents.total_volume);
                    }
                    return;
                }
            }
            base.mix_reagents();
            return;
        }
        // Function from file: chem_grenade.dm
        public virtual void mix_reagents(  )
        {
            dynamic total_temp = null;
            Obj_Item_Weapon_ReagentContainers_Glass G = null;


            foreach (dynamic _a in Lang13.Enumerate(this.beakers, typeof(Obj_Item_Weapon_ReagentContainers_Glass)))
            {
                G = _a;

                G.reagents.trans_to(this, G.reagents.total_volume);
                total_temp += G.reagents.chem_temp;
            }
            this.reagents.chem_temp = total_temp;
            return;
        }
        // Function from file: circuitprinter.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            Obj_Item_Weapon_ReagentContainers_Glass G = null;
            Obj_Item_Stack_Sheet_Glass           G2   = null;
            Obj_Item_Stack_Sheet_Mineral_Gold    G3   = null;
            Obj_Item_Stack_Sheet_Mineral_Diamond G4   = null;
            dynamic stack  = null;
            int     amount = 0;


            if (this.shocked)
            {
                this.shock(user, 50);
            }

            if (this.default_deconstruction_screwdriver(user, "circuit_imprinter_t", "circuit_imprinter", A))
            {
                if (Lang13.Bool(this.linked_console))
                {
                    this.linked_console.linked_imprinter = null;
                    this.linked_console = null;
                }
                return(null);
            }

            if (this.exchange_parts(user, A))
            {
                return(null);
            }

            if (Lang13.Bool(this.panel_open))
            {
                if (A is Obj_Item_Weapon_Crowbar)
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_ReagentContainers_Glass)))
                    {
                        G = _a;

                        this.reagents.trans_to(G, G.reagents.maximum_volume);
                    }

                    if (this.g_amount >= 2000)
                    {
                        G2        = new Obj_Item_Stack_Sheet_Glass(this.loc);
                        G2.amount = Num13.Floor(this.g_amount / 2000);
                    }

                    if (this.gold_amount >= 2000)
                    {
                        G3        = new Obj_Item_Stack_Sheet_Mineral_Gold(this.loc);
                        G3.amount = Num13.Floor(this.gold_amount / 2000);
                    }

                    if (this.diamond_amount >= 2000)
                    {
                        G4        = new Obj_Item_Stack_Sheet_Mineral_Diamond(this.loc);
                        G4.amount = Num13.Floor(this.diamond_amount / 2000);
                    }
                    this.default_deconstruction_crowbar(A);
                    return(null);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You can't load the " + this.name + " while it's opened!</span>");
                    return(null);
                }
            }

            if (this.disabled)
            {
                return(null);
            }

            if (!Lang13.Bool(this.linked_console))
            {
                user.WriteMsg("<span class='warning'>The " + this.name + " must be linked to an R&D console first!</span>");
                return(1);
            }

            if (Lang13.Bool(((Ent_Static)A).is_open_container()))
            {
                return(null);
            }

            if (!(A is Obj_Item_Stack_Sheet_Glass) && !(A is Obj_Item_Stack_Sheet_Mineral_Gold) && !(A is Obj_Item_Stack_Sheet_Mineral_Diamond))
            {
                user.WriteMsg("<span class='warning'>You cannot insert this item into the " + this.name + "!</span>");
                return(null);
            }

            if (this.stat != 0)
            {
                return(null);
            }

            if (this.busy)
            {
                user.WriteMsg("<span class='warning'>The " + this.name + " is busy! Please wait for completion of previous operation.</span>");
                return(null);
            }
            stack = A;

            if (this.TotalMaterials() + stack.perunit > this.max_material_amount)
            {
                user.WriteMsg("<span class='warning'>The " + this.name + " is full! Please remove glass from the protolathe in order to insert more.</span>");
                return(null);
            }
            amount = Num13.Floor(Convert.ToDouble(Interface13.Input("How many sheets do you want to add?", null, null, null, null, InputType.Num)));

            if (amount <= 0 || Convert.ToDouble(stack.amount) <= 0)
            {
                return(null);
            }

            if (amount > Convert.ToDouble(stack.amount))
            {
                amount = Num13.MinInt(Convert.ToInt32(stack.amount), Num13.Floor((this.max_material_amount - this.TotalMaterials()) / stack.perunit));
            }
            this.busy = true;
            this.f_use_power(Num13.MaxInt(1000, ((int)(amount * 2000 / 10))));
            user.WriteMsg("<span class='notice'>You add " + amount + " sheets to the " + this.name + ".</span>");

            if (stack is Obj_Item_Stack_Sheet_Glass)
            {
                this.g_amount += amount * 2000;
            }
            else if (stack is Obj_Item_Stack_Sheet_Mineral_Gold)
            {
                this.gold_amount += amount * 2000;
            }
            else if (stack is Obj_Item_Stack_Sheet_Mineral_Diamond)
            {
                this.diamond_amount += amount * 2000;
            }
            stack.use(amount);
            this.busy = false;
            this.updateUsrDialog();
            return(null);
        }
        // Function from file: protolathe.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            Obj_Item_Weapon_ReagentContainers_Glass G = null;
            dynamic stack           = null;
            double? amount          = null;
            double? amount_inserted = null;
            dynamic stack_name      = null;


            if (this.shocked)
            {
                this.shock(user, 50);
            }

            if (this.default_deconstruction_screwdriver(user, "protolathe_t", "protolathe", A))
            {
                if (Lang13.Bool(this.linked_console))
                {
                    this.linked_console.linked_lathe = null;
                    this.linked_console = null;
                }
                return(null);
            }

            if (this.exchange_parts(user, A))
            {
                return(null);
            }

            if (Lang13.Bool(this.panel_open))
            {
                if (A is Obj_Item_Weapon_Crowbar)
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.component_parts, typeof(Obj_Item_Weapon_ReagentContainers_Glass)))
                    {
                        G = _a;

                        this.reagents.trans_to(G, G.reagents.maximum_volume);
                    }
                    this.materials.retrieve_all();
                    this.default_deconstruction_crowbar(A);
                    return(1);
                }
                else
                {
                    user.WriteMsg("<span class='warning'>You can't load the " + this.name + " while it's opened!</span>");
                    return(1);
                }
            }

            if (this.disabled)
            {
                return(null);
            }

            if (!Lang13.Bool(this.linked_console))
            {
                user.WriteMsg("<span class='warning'>The " + this.name + " must be linked to an R&D console first!</span>");
                return(1);
            }

            if (this.busy)
            {
                user.WriteMsg("<span class='warning'>The " + this.name + " is busy! Please wait for completion of previous operation.</span>");
                return(1);
            }

            if (Lang13.Bool(((Ent_Static)A).is_open_container()))
            {
                return(null);
            }

            if (this.stat != 0)
            {
                return(1);
            }

            if (!(A is Obj_Item_Stack_Sheet))
            {
                return(1);
            }

            if (!this.materials.has_space(this.materials.get_item_material_amount(A)))
            {
                user.WriteMsg("<span class='warning'>The " + this.name + "'s material bin is full! Please remove material before adding more.</span>");
                return(1);
            }
            stack  = A;
            amount = Num13.Floor(Convert.ToDouble(Interface13.Input("How many sheets do you want to add?", null, null, null, null, InputType.Num)));

            if (!(Map13.GetDistance(this, stack) <= 1) || !((Ent_Static)user).Adjacent(this))
            {
                return(null);
            }
            amount_inserted = this.materials.insert_stack(A, amount);

            if (!Lang13.Bool(amount_inserted))
            {
                return(1);
            }
            else
            {
                stack_name = stack.name;
                this.busy  = true;
                this.f_use_power(Num13.MaxInt(1000, ((int)((amount_inserted ?? 0) * 2000 / 10))));
                user.WriteMsg("<span class='notice'>You add " + amount_inserted + " sheets to the " + this.name + ".</span>");
                this.overlays.Add("protolathe_" + stack_name);
                Task13.Sleep(10);
                this.overlays.Remove("protolathe_" + stack_name);
                this.busy = false;
            }
            this.updateUsrDialog();
            return(null);
        }