Example #1
0
        // Function from file: transit_tube.dm
        public dynamic get_exit(int in_dir = 0)
        {
            dynamic near_dir   = null;
            int     in_dir_cw  = 0;
            int     in_dir_ccw = 0;
            dynamic direction  = null;

            near_dir   = 0;
            in_dir_cw  = Num13.Rotate(in_dir, -45);
            in_dir_ccw = Num13.Rotate(in_dir, 45);

            foreach (dynamic _a in Lang13.Enumerate(this.directions()))
            {
                direction = _a;


                if (direction == in_dir)
                {
                    return(direction);
                }
                else if (direction == in_dir_cw)
                {
                    near_dir = direction;
                }
                else if (direction == in_dir_ccw)
                {
                    near_dir = direction;
                }
            }
            return(near_dir);
        }
Example #2
0
        // Function from file: transit_tube.dm
        public ByTable select_automatic_dirs(ByTable connected = null)
        {
            int?    i  = null;
            int?    j  = null;
            int     d1 = 0;
            dynamic d2 = null;


            if (Lang13.Length(connected) < 1)
            {
                return(new ByTable());
            }
            i = null;
            i = 1;

            while ((i ?? 0) <= Lang13.Length(connected))
            {
                j = null;
                j = (i ?? 0) + 1;

                while ((j ?? 0) <= Lang13.Length(connected))
                {
                    d1 = Convert.ToInt32(connected[i]);
                    d2 = connected[j];

                    if (d1 == Num13.Rotate(d2, 135) || d1 == Num13.Rotate(d2, 180) || d1 == Num13.Rotate(d2, 225))
                    {
                        return(new ByTable(new object [] { d1, d2 }));
                    }
                    j++;
                }
                i++;
            }
            return(new ByTable(new object [] { connected[1], Num13.Rotate(connected[1], 180) }));
        }
        // Function from file: station.dm
        public bool launch_pod(  )
        {
            Obj_Structure_TransitTubePod pod = null;


            if (this.launch_cooldown >= Game13.time)
            {
                return(false);
            }

            foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Structure_TransitTubePod)))
            {
                pod = _a;


                if (this.directions().Contains(!pod.moving && Num13.Rotate(pod.dir, (this.reverse_launch == true ? 180 : 0)) != 0))
                {
                    this.pod_moving = true;
                    this.close_animation();
                    Task13.Sleep(8);

                    if (this.icon_state == "closed" && pod != null)
                    {
                        pod.follow_tube(this.reverse_launch);
                    }
                    this.pod_moving = false;
                    return(true);
                }
            }
            return(false);
        }
Example #4
0
        // Function from file: heat_exchanger.dm
        public override void atmosinit(ByTable node_connects = null)
        {
            int partner_connect = 0;
            Obj_Machinery_Atmospherics_Components_Unary_HeatExchanger target = null;


            if (!(this.partner != null))
            {
                partner_connect = Num13.Rotate(this.dir, 180);

                foreach (dynamic _a in Lang13.Enumerate(Map13.GetStep(this, partner_connect), typeof(Obj_Machinery_Atmospherics_Components_Unary_HeatExchanger)))
                {
                    target = _a;


                    if ((target.dir & Map13.GetDistance(this, target)) != 0)
                    {
                        this.partner         = target;
                        this.partner.partner = this;
                        break;
                    }
                }
            }
            base.atmosinit(node_connects);
            return;
        }
Example #5
0
        // Function from file: magic.dm
        public override void Range(  )
        {
            Tile    T1 = null;
            Tile    T2 = null;
            dynamic L  = null;

            T1 = Map13.GetStep(this, Num13.Rotate(this.dir, -45));
            T2 = Map13.GetStep(this, Num13.Rotate(this.dir, 45));
            L  = Lang13.FindIn(typeof(Mob_Living), T1);

            if (Lang13.Bool(L) && Convert.ToInt32(L.stat) != 2)
            {
                this.Bump(L);
                return;
            }
            L = Lang13.FindIn(typeof(Mob_Living), T2);

            if (Lang13.Bool(L) && Convert.ToInt32(L.stat) != 2)
            {
                this.Bump(L);
                return;
            }
            base.Range();
            return;
        }
Example #6
0
        // Function from file: spray.dm
        public override void spray(dynamic A = null)
        {
            int     direction   = 0;
            dynamic T           = null;
            Tile    T1          = null;
            Tile    T2          = null;
            ByTable the_targets = null;
            int?    i           = null;

            direction   = Map13.GetDistance(this, A);
            T           = GlobalFuncs.get_turf(A);
            T1          = Map13.GetStep(T, Num13.Rotate(direction, 90));
            T2          = Map13.GetStep(T, Num13.Rotate(direction, -90));
            the_targets = new ByTable(new object [] { T, T1, T2 });
            i           = null;
            i           = 1;

            while ((i ?? 0) <= 3)
            {
                if ((this.reagents.total_volume ?? 0) < 1)
                {
                    return;
                }
                base.spray((object)(the_targets[i]));
                i++;
            }
            return;
        }
Example #7
0
        public void flip(  )
        {
            if (Task13.User.stat != 0 || !Task13.User.canmove || Task13.User.restrained())
            {
                return;
            }

            if (Lang13.Bool(this.anchored))
            {
                Task13.User.WriteMsg("<span class='warning'>You must unfasten the pipe before flipping it!</span>");
                return;
            }
            this.dir = Num13.Rotate(this.dir, 180);

            dynamic _a = this.ptype;             // Was a switch-case, sorry for the mess.

            if (_a == 2)
            {
                this.ptype = 3;
            }
            else if (_a == 3)
            {
                this.ptype = 2;
            }
            else if (_a == 9)
            {
                this.ptype = 10;
            }
            else if (_a == 10)
            {
                this.ptype = 9;
            }
            this.update();
            return;
        }
        // Function from file: transit_tube_construction.dm
        public virtual void tube_turn(double angle = 0)
        {
            ByTable badtubes   = null;
            ByTable split_text = null;
            int?    i          = null;
            int     curdir     = 0;
            string  newdir     = null;

            badtubes   = new ByTable(new object [] { "W-E", "W-E-Pass", "S-N", "S-N-Pass", "SW-NE", "SE-NW" });
            split_text = GlobalFuncs.splittext(this.icon_state, "-");
            i          = null;
            i          = 1;

            while ((i ?? 0) <= split_text.len)
            {
                curdir = GlobalFuncs.text2dir_extended(split_text[i]);

                if (curdir != 0)
                {
                    split_text[i] = GlobalFuncs.dir2text_short(Num13.Rotate(curdir, angle));
                }
                i++;
            }
            newdir = GlobalFuncs.jointext(split_text, "-");

            if (badtubes.Find(newdir) != 0)
            {
                split_text.Swap(1, 2);
                newdir = GlobalFuncs.jointext(split_text, "-");
            }
            this.icon_state = newdir;
            return;
        }
        // Function from file: station.dm
        public override bool MouseDrop_T(Ent_Static dropping = null, Mob user = null)
        {
            Obj_Structure_TransitTubePod pod = null;
            Obj_Structure_TransitTubePod T   = null;


            if (!user.canmove || user.stat != 0 || user.restrained())
            {
                return(false);
            }

            if (!(dropping is Obj_Structure_CTransitTubePod) || Map13.GetDistance(user, this) > 1 || Map13.GetDistance(this, dropping) > 1)
            {
                return(false);
            }

            foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Structure_TransitTubePod)))
            {
                pod = _a;

                return(false);
            }
            T = new Obj_Structure_TransitTubePod(this);
            dropping.transfer_fingerprints_to(T);
            T.add_fingerprint(user);
            T.loc = this.loc;
            T.dir = Num13.Rotate(this.dir, -90);
            user.visible_message("" + user + " inserts the " + dropping + ".", "<span class='notice'>You insert the " + dropping + ".</span>");
            GlobalFuncs.qdel(dropping);
            return(false);
        }
Example #10
0
        // Function from file: space.dm
        public override dynamic Entered(Ent_Dynamic Obj = null, Ent_Static oldloc = null)
        {
            Ent_Dynamic L = null;
            Tile        T = null;

            base.Entered(Obj, oldloc);

            if (!(Obj != null) || this != Obj.loc)
            {
                return(null);
            }

            if (Lang13.Bool(this.destination_z))
            {
                Obj.x = this.destination_x;
                Obj.y = this.destination_y;
                Obj.z = this.destination_z ?? 0;

                if (Obj is Mob_Living)
                {
                    L = Obj;

                    if (Lang13.Bool(((dynamic)L).pulling))
                    {
                        T = Map13.GetStep(L.loc, Num13.Rotate(Obj.dir, 180));
                        ((dynamic)L).pulling.loc = T;
                    }
                }
                Task13.Sleep(0);
                Obj.newtonian_move(Obj.inertia_dir);
            }
            return(null);
        }
Example #11
0
        // Function from file: bananashoes.dm
        public override void step_action(  )
        {
            if (this.on)
            {
                if (this.footstep > 1)
                {
                    GlobalFuncs.playsound(this, "sound/items/bikehorn.ogg", 75, 1);
                    this.footstep = 0;
                }
                else
                {
                    this.footstep++;
                }
                new Obj_Item_Weapon_Grown_Bananapeel_Specialpeel(Map13.GetStep(this, Num13.Rotate(Task13.User.dir, 180)), 5);
                this.bananium.use_amount_type(100, "$bananium");

                if ((this.bananium.amount("$bananium") ?1:0) < 100)
                {
                    this.on = !this.on;
                    this.update_icon();
                    ((dynamic)this.loc).WriteMsg("<span class='warning'>You ran out of bananium!</span>");
                }
            }
            else
            {
                base.step_action();
            }
            return;
        }
Example #12
0
 // Function from file: construction.dm
 public int unflip(int direction = 0)
 {
     if (GlobalVars.diagonals.Contains(direction))
     {
         return(Num13.Rotate(direction, 45));
     }
     return(direction);
 }
 public void rotate(  )
 {
     if (Task13.User.incapacitated())
     {
         return;
     }
     this.dir = Num13.Rotate(this.dir, 90);
     return;
 }
        // Function from file: dog.dm
        public override bool regenerate_icons(  )
        {
            Image head_icon = null;
            Image back_icon = null;

            this.overlays.Cut();

            if (Lang13.Bool(this.inventory_head))
            {
                if (Convert.ToDouble(this.health) <= 0)
                {
                    head_icon           = new Image("icons/mob/corgi_head.dmi", null, this.inventory_head.icon_state, null, GlobalVars.EAST);
                    head_icon.pixel_y   = -8;
                    head_icon.transform = Num13.Rotate(head_icon.transform, 180);
                }
                else
                {
                    head_icon = new Image("icons/mob/corgi_head.dmi", null, this.inventory_head.icon_state);
                }
                this.overlays.Add(head_icon);
            }

            if (Lang13.Bool(this.inventory_back))
            {
                if (Convert.ToDouble(this.health) <= 0)
                {
                    back_icon           = new Image("icons/mob/corgi_back.dmi", null, this.inventory_back.icon_state, null, GlobalVars.EAST);
                    back_icon.pixel_y   = -11;
                    back_icon.transform = Num13.Rotate(back_icon.transform, 180);
                }
                else
                {
                    back_icon = new Image("icons/mob/corgi_back.dmi", null, this.inventory_back.icon_state);
                }
                this.overlays.Add(back_icon);
            }

            if (this.facehugger != null)
            {
                if (this is Mob_Living_SimpleAnimal_Pet_Dog_Corgi_Puppy)
                {
                    this.overlays.Add(new Image("icons/mob/mask.dmi", "facehugger_corgipuppy"));
                }
                else
                {
                    this.overlays.Add(new Image("icons/mob/mask.dmi", "facehugger_corgi"));
                }
            }

            if (Lang13.Bool(this.pcollar))
            {
                this.overlays.Add(this.collar);
                this.overlays.Add(this.pettag);
            }
            return(false);
        }
Example #15
0
 public void rotate(  )
 {
     if (Task13.User.stat != 0 || Task13.User.restrained() || !Task13.User.canmove)
     {
         return;
     }
     this.dir = Num13.Rotate(this.dir, -90);
     this.fixdir();
     return;
 }
Example #16
0
        // Function from file: work_tools.dm
        public bool layCable(Tile new_turf = null)
        {
            double?fdirn           = null;
            Obj_Structure_Cable LC = null;
            Obj_Structure_Cable NC = null;
            Powernet            PN = null;


            if (this.equip_ready || !(new_turf is Tile) || !this.dismantleFloor(new_turf))
            {
                this.reset(); return(false);
            }
            fdirn = Num13.Rotate(this.chassis.dir, 180);

            foreach (dynamic _a in Lang13.Enumerate(new_turf, typeof(Obj_Structure_Cable)))
            {
                LC = _a;


                if (LC.d1 == fdirn || LC.d2 == fdirn)
                {
                    this.reset(); return(false);
                }
            }

            if (!this.use_cable(1))
            {
                this.reset(); return(false);
            }
            NC = new Obj_Structure_Cable(new_turf);
            NC.cableColor("red");
            NC.d1 = 0;
            NC.d2 = fdirn;
            NC.updateicon();
            PN = null;

            if (this.last_piece != null && this.last_piece.d2 != this.chassis.dir)
            {
                this.last_piece.d1 = Num13.MinInt(((int)(this.last_piece.d2 ?? 0)), this.chassis.dir);
                this.last_piece.d2 = Num13.MaxInt(((int)(this.last_piece.d2 ?? 0)), this.chassis.dir);
                this.last_piece.updateicon();
                PN = this.last_piece.powernet;
            }

            if (!(PN != null))
            {
                PN = new Powernet();
                GlobalVars.powernets.Add(PN);
            }
            NC.powernet = PN;
            PN.cables.Add(NC);
            NC.mergeConnectedNetworks(NC.d2);
            this.last_piece = NC;
            return(true);
        }
Example #17
0
        // Function from file: construction.dm
        public Obj_Item_Pipe(dynamic loc = null, dynamic pipe_type = null, double?dir = null, Obj_Machinery_Atmospherics make_from = null) : base((object)(loc))
        {
            dynamic P = null;
            Obj_Machinery_Atmospherics triP = null;

            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;

            if (make_from != null)
            {
                this.dir      = make_from.dir;
                this.pipename = make_from.name;
                this.color    = make_from.color;

                if (GlobalVars.pipe_types.Contains(make_from.type))
                {
                    this.pipe_type = make_from.type;
                }
                else
                {
                    foreach (dynamic _a in Lang13.Enumerate(GlobalVars.pipe_types))
                    {
                        P = _a;


                        if (Lang13.Bool(P.IsInstanceOfType(make_from)))
                        {
                            this.pipe_type = P;
                            break;
                        }
                    }
                }
                triP = make_from;

                if (triP is Obj_Machinery_Atmospherics_Components_Trinary && Lang13.Bool(((dynamic)triP).flipped))
                {
                    this.flipped = 1;
                    this.dir     = Num13.Rotate(this.dir, -45);
                }
            }
            else
            {
                this.pipe_type = pipe_type;
                this.dir       = ((int)(dir ?? 0));
            }

            if (GlobalVars.diagonals.Contains(this.dir))
            {
                this.is_bent = true;
            }
            this.update();
            this.pixel_x = Rand13.Int(-5, 5);
            this.pixel_y = Rand13.Int(-5, 5);
            return;
        }
        // Function from file: tracker.dm
        public void set_angle(double angle = 0)
        {
            this.sun_angle = angle;
            this.dir       = Num13.Rotate(GlobalVars.NORTH, -angle - 22.5);

            if (Lang13.Bool(this.powernet) && this.powernet == this.control.powernet)
            {
                this.control.currentdir = angle;
            }
            return;
        }
Example #19
0
        // Function from file: chair.dm
        public void spin(  )
        {
            this.dir = Num13.Rotate(this.dir, 90);
            this.handle_layer();

            if (Lang13.Bool(this.buckled_mob))
            {
                this.buckled_mob.dir = this.dir;
            }
            return;
        }
Example #20
0
 // Function from file: machinery.dm
 public virtual bool default_change_direction_wrench(dynamic user = null, dynamic W = null)
 {
     if (Lang13.Bool(this.panel_open) && W is Obj_Item_Weapon_Wrench)
     {
         GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1);
         this.dir = Num13.Rotate(this.dir, -90);
         user.WriteMsg("<span class='notice'>You rotate " + this + ".</span>");
         return(true);
     }
     return(false);
 }
Example #21
0
        // Function from file: binary_devices.dm
        public override void atmosinit(ByTable node_connects = null)
        {
            int     node2_connect  = 0;
            int     node1_connect  = 0;
            ByTable node_connects2 = null;

            node2_connect  = this.dir;
            node1_connect  = Num13.Rotate(this.dir, 180);
            node_connects2 = new ByTable(new object [] { node1_connect, node2_connect });
            base.atmosinit(node_connects2);
            return;
        }
Example #22
0
        // Function from file: cable.dm
        public void mergeConnectedNetworks(double?direction = null)
        {
            double?fdir               = null;
            Tile   TB                 = null;
            Obj_Structure_Cable C     = null;
            Powernet            newPN = null;

            fdir = (!Lang13.Bool(direction) ? 0 : Num13.Rotate(direction, 180));

            if (!(this.d1 == direction || this.d2 == direction))
            {
                return;
            }
            TB = Map13.GetStep(this, ((int)(direction ?? 0)));

            foreach (dynamic _a in Lang13.Enumerate(TB, typeof(Obj_Structure_Cable)))
            {
                C = _a;


                if (!(C != null))
                {
                    continue;
                }

                if (this == C)
                {
                    continue;
                }

                if (C.d1 == fdir || C.d2 == fdir)
                {
                    if (!(C.powernet != null))
                    {
                        newPN = new Powernet();
                        newPN.add_cable(C);
                    }

                    if (this.powernet != null)
                    {
                        GlobalFuncs.merge_powernets(this.powernet, C.powernet);
                    }
                    else
                    {
                        C.powernet.add_cable(this);
                    }
                }
            }
            return;
        }
        public void rotate(  )
        {
            if (!(Task13.User != null) || !(Task13.User.loc is Tile))
            {
                return;
            }

            if (Task13.User.stat != 0 || Task13.User.restrained() || !Task13.User.canmove)
            {
                return;
            }
            this.dir = Num13.Rotate(this.dir, 90);
            return;
        }
        // Function from file: disposal-structures.dm
        public Obj_Structure_Disposalpipe_Segment(dynamic loc = null, Game_Data make_from = null) : base((object)(loc), make_from)
        {
            // Warning: Super call was HERE! If anything above HERE is needed by the super call, it might break!;

            if (Lang13.Bool(((dynamic)this.stored).ptype) == false)
            {
                this.dpdir = this.dir | Num13.Rotate(this.dir, 180);
            }
            else
            {
                this.dpdir = this.dir | Num13.Rotate(this.dir, -90);
            }
            this.update();
            return;
        }
        public bool rotate(  )
        {
            if (Task13.User.stat != 0 || !Task13.User.canmove || Task13.User.restrained())
            {
                return(false);
            }

            if (Lang13.Bool(this.anchored))
            {
                Task13.User.WriteMsg("It is fastened to the floor!");
                return(false);
            }
            this.dir = Num13.Rotate(this.dir, 270);
            return(true);
        }
Example #26
0
        public void rotate(  )
        {
            if (Task13.User.stat != 0 || !Task13.User.canmove || Task13.User.restrained())
            {
                return;
            }

            if (Lang13.Bool(this.anchored))
            {
                Task13.User.WriteMsg("<span class='warning'>You must unfasten the pipe before rotating it!</span>");
                return;
            }
            this.dir = Num13.Rotate(this.dir, -90);
            this.update();
            return;
        }
        // Function from file: disposal-structures.dm
        public override void pipe_eject(int?direction = null)
        {
            ByTable dirs = null;


            if (Lang13.Bool(direction))
            {
                dirs = new ByTable(new object [] { direction, Num13.Rotate(direction, -45), Num13.Rotate(direction, 45) });
            }
            else
            {
                dirs = GlobalVars.alldirs.Copy();
            }
            this.streak(dirs);
            return;
        }
Example #28
0
        // Function from file: conveyor2.dm
        public override dynamic attackby(dynamic A = null, dynamic user = null, string _params = null, bool?silent = null, bool?replace_spent = null)
        {
            Obj_Item_ConveyorConstruct C = null;


            if (A is Obj_Item_Weapon_Crowbar)
            {
                if (!((this.stat & 1) != 0))
                {
                    C    = new Obj_Item_ConveyorConstruct(this.loc);
                    C.id = this.id;
                    this.transfer_fingerprints_to(C);
                }
                user.WriteMsg("<span class='notice'>You remove the conveyor belt.</span>");
                GlobalFuncs.qdel(this);
                return(null);
            }

            if (A is Obj_Item_Weapon_Wrench)
            {
                if (!((this.stat & 1) != 0))
                {
                    GlobalFuncs.playsound(this.loc, "sound/items/ratchet.ogg", 50, 1);
                    this.dir = Num13.Rotate(this.dir, -45);
                    this.update_move_direction();
                    user.WriteMsg("<span class='notice'>You rotate " + this + ".</span>");
                    return(null);
                }
            }

            if (user is Mob_Living_Silicon_Robot)
            {
                return(null);
            }

            if (!Lang13.Bool(user.drop_item()))
            {
                user.WriteMsg(new Txt("<span class='warning'>").The(A).item().str(" is stuck to your hand, you cannot place it on the conveyor!</span>").ToString());
                return(null);
            }

            if (Lang13.Bool(A) && A.loc != null)
            {
                A.loc = this.loc;
            }
            return(null);
        }
        // Function from file: disposal-structures.dm
        public void updatedir(  )
        {
            this.posdir = this.dir;
            this.negdir = Num13.Rotate(this.posdir, 180);

            if (Convert.ToInt32(((dynamic)this.stored).ptype) == 9)
            {
                this.sortdir = Num13.Rotate(this.posdir, -90);
            }
            else
            {
                this.icon_state = "pipe-j2s";
                this.sortdir    = Num13.Rotate(this.posdir, 90);
            }
            this.dpdir = this.sortdir | this.posdir | this.negdir;
            return;
        }
Example #30
0
        public void flip(  )
        {
            if (Task13.User.stat != 0 || Task13.User.restrained() || !Task13.User.canmove)
            {
                return;
            }

            if (new ByTable(new object [] { typeof(Obj_Machinery_Atmospherics_Components_Trinary_Filter), typeof(Obj_Machinery_Atmospherics_Components_Trinary_Mixer) }).Contains(this.pipe_type))
            {
                this.dir     = Num13.Rotate(this.dir, (Lang13.Bool(this.flipped) ? 45 : -45));
                this.flipped = !Lang13.Bool(this.flipped) ?1:0;
                return;
            }
            this.dir = Num13.Rotate(this.dir, -180);
            this.fixdir();
            return;
        }