Beispiel #1
0
        // Function from file: smes.dm
        public override void RefreshParts(  )
        {
            double  IO = 0;
            double  MC = 0;
            dynamic C  = null;
            Obj_Item_Weapon_StockParts_Capacitor CP = null;
            Obj_Item_Weapon_StockParts_Cell      PC = null;

            IO = 0;
            MC = 0;

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

                IO += Convert.ToDouble(CP.rating);
            }
            this.input_level_max  = Lang13.Initial(this, "input_level_max") * IO;
            this.output_level_max = Lang13.Initial(this, "output_level_max") * IO;

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

                MC += PC.maxcharge ?? 0;
                C  += PC.charge;
            }
            this.capacity = MC / 15000 * 1000000;

            if (!Lang13.Bool(Lang13.Initial(this, "charge")) && !(this.charge != 0))
            {
                this.charge = Convert.ToDouble(C / 15000 * 1000000);
            }
            return;
        }
        // Function from file: rechargestation.dm
        public override void RefreshParts(  )
        {
            Obj_Item_Weapon_StockParts_Capacitor   C  = null;
            Obj_Item_Weapon_StockParts_Manipulator M  = null;
            Obj_Item_Weapon_StockParts_Cell        C2 = null;

            this.recharge_speed = 0;
            this.repairs        = 0;

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

                this.recharge_speed += Convert.ToDouble(C.rating * 100);
            }

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

                this.repairs += Convert.ToDouble(M.rating - 1);
            }

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

                this.recharge_speed *= (C2.maxcharge ?? 0) / 10000;
            }
            return;
        }
Beispiel #3
0
        // Function from file: chem_dispenser.dm
        public override void RefreshParts(  )
        {
            double time        = 0;
            double temp_energy = 0;
            int    i           = 0;
            Obj_Item_Weapon_StockParts_MatterBin   M  = null;
            Obj_Item_Weapon_StockParts_Capacitor   C  = null;
            Obj_Item_Weapon_StockParts_Cell        P  = null;
            Obj_Item_Weapon_StockParts_Manipulator M2 = null;

            time        = 0;
            temp_energy = 0;

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

                temp_energy += Convert.ToDouble(M.rating);
            }
            temp_energy--;
            this.max_energy = temp_energy * 5;

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

                time += Convert.ToDouble(C.rating);
            }

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

                time += Num13.Round(P.maxcharge ?? 0, 10000) / 10000;
            }
            this.recharge_delay /= time / 2;

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

                i = 1;

                while (i <= Convert.ToDouble(M2.rating))
                {
                    this.dispensable_reagents |= this.dispensable_reagent_tiers[i];
                    i++;
                }
            }
            this.dispensable_reagents = GlobalFuncs.sortList(this.dispensable_reagents);
            return;
        }
Beispiel #4
0
        // Function from file: smes.dm
        public override void deconstruction(  )
        {
            Obj_Item_Weapon_StockParts_Cell cell = null;


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

                cell.charge = this.charge / this.capacity * (cell.maxcharge ?? 0);
            }
            return;
        }
Beispiel #5
0
        // Function from file: energy.dm
        public override bool attack(dynamic M = null, dynamic user = null, bool?def_zone = null)
        {
            Obj_Item_Weapon_StockParts_Cell C = null;


            if (Lang13.Bool(user.cell))
            {
                C = user.cell;

                if (this.active && !C.use(this.hitcost))
                {
                    this.attack_self(user);
                    user.WriteMsg("<span class='notice'>It's out of charge!</span>");
                    return(false);
                }
                base.attack((object)(M), (object)(user), def_zone);
            }
            return(false);
        }
Beispiel #6
0
        // Function from file: grown.dm
        public override void On_Consume(  )
        {
            bool batteries_recharged          = false;
            Obj_Item_Weapon_StockParts_Cell C = null;
            double?    newcharge = null;
            Ent_Static O         = null;


            if (!Lang13.Bool(this.reagents.total_volume))
            {
                batteries_recharged = false;

                foreach (dynamic _a in Lang13.Enumerate(Task13.User.GetAllContents(), typeof(Obj_Item_Weapon_StockParts_Cell)))
                {
                    C = _a;

                    newcharge = (this.potency ?? 0) * (C.maxcharge ?? 0) * 0.01;

                    if ((C.charge ?? 0) < (newcharge ?? 0))
                    {
                        C.charge = newcharge;

                        if (C.loc is Obj)
                        {
                            O = C.loc;
                            ((dynamic)O).update_icon();
                        }
                        batteries_recharged = true;
                    }
                }

                if (batteries_recharged)
                {
                    Task13.User.WriteMsg("<span class='notice'>Battery has recovered.</span>");
                }
            }
            base.On_Consume();
            return;
        }