Ejemplo n.º 1
0
        // Function from file: shielding.dm
        public bool link_control(Obj_Machinery_Power_AmControlUnit AMC = null)
        {
            if (!(AMC is Obj_Machinery_Power_AmControlUnit))
            {
                return(false);
            }

            if (this.control_unit != null && this.control_unit != AMC)
            {
                return(false);
            }
            this.control_unit = AMC;
            this.control_unit.add_shielding(this, true);
            return(true);
        }
Ejemplo n.º 2
0
        // Function from file: shielding.dm
        public void controllerscan(bool?priorscan = null)
        {
            priorscan = priorscan ?? false;

            Obj_Machinery_AmShielding AMS  = null;
            Obj_Machinery_AmShielding AMS2 = null;
            dynamic direction = null;
            Obj_Machinery_Power_AmControlUnit AMC = null;


            if (!(this.loc is Tile))
            {
                GlobalFuncs.qdel(this);
                return;
            }

            foreach (dynamic _a in Lang13.Enumerate(this.loc.contents, typeof(Obj_Machinery_AmShielding)))
            {
                AMS = _a;


                if (AMS == this)
                {
                    continue;
                }
                GlobalFuncs.qdel(this);
                return;
            }

            foreach (dynamic _b in Lang13.Enumerate(GlobalFuncs.cardinalrange(this), typeof(Obj_Machinery_AmShielding)))
            {
                AMS2 = _b;


                if (AMS2 != null && AMS2.control_unit != null && this.link_control(AMS2.control_unit))
                {
                    break;
                }
            }

            if (!(this.control_unit != null))
            {
                foreach (dynamic _c in Lang13.Enumerate(GlobalVars.cardinal))
                {
                    direction = _c;
                }

                foreach (dynamic _d in Lang13.Enumerate(GlobalFuncs.cardinalrange(this), typeof(Obj_Machinery_Power_AmControlUnit)))
                {
                    AMC = _d;


                    if (AMC.add_shielding(this))
                    {
                        break;
                    }
                }
            }

            if (!(this.control_unit != null))
            {
                if (!(priorscan == true))
                {
                    Task13.Schedule(20, (Task13.Closure)(() => {
                        this.controllerscan(true);
                        return;
                    }));
                    return;
                }
                GlobalFuncs.qdel(this);
            }
            return;
        }