コード例 #1
0
        // Function from file: transit_tube.dm
        public void init_dirs_automatic(  )
        {
            ByTable connected              = null;
            ByTable connected_auto         = null;
            dynamic direction              = null;
            Tile    location               = null;
            Obj_Structure_TransitTube tube = null;

            connected      = new ByTable();
            connected_auto = new ByTable();

            foreach (dynamic _b in Lang13.Enumerate(GlobalVars.tube_dir_list))
            {
                direction = _b;

                location = Map13.GetStep(this.loc, Convert.ToInt32(direction));

                foreach (dynamic _a in Lang13.Enumerate(location, typeof(Obj_Structure_TransitTube)))
                {
                    tube = _a;


                    if (tube.directions() == null && tube.icon_state == "auto")
                    {
                        connected_auto.Add(direction);
                        break;
                    }
                    else if (tube.directions().Contains(Num13.Rotate(direction, 180)))
                    {
                        connected.Add(direction);
                        break;
                    }
                }
            }
            connected.Add(connected_auto);
            this.tube_dirs = this.select_automatic_dirs(connected);

            if (Lang13.Length(this.tube_dirs) == 2 && GlobalVars.tube_dir_list.Find(this.tube_dirs[1]) > GlobalVars.tube_dir_list.Find(this.tube_dirs[2]))
            {
                this.tube_dirs.Swap(1, 2);
            }
            this.generate_automatic_corners(this.tube_dirs);
            this.select_automatic_icon_state(this.tube_dirs);
            return;
        }
コード例 #2
0
        // Function from file: tgstation.dme
        public override bool relaymove(Mob user = null, int?direction = null)
        {
            Obj_Structure_TransitTube_Station station = null;
            Obj_Structure_TransitTube         tube    = null;


            if (user is Mob && user.client != null)
            {
                if (!Lang13.Bool(Lang13.FindIn(typeof(Obj_Structure_TransitTube), this.loc)))
                {
                    user.loc = this.loc;
                    user.client.Move(Map13.GetStep(this.loc, direction ?? 0), direction ?? 0);
                    user.reset_perspective(null);
                }

                if (!this.moving)
                {
                    foreach (dynamic _a in Lang13.Enumerate(this.loc, typeof(Obj_Structure_TransitTube_Station)))
                    {
                        station = _a;


                        if (station.directions().Contains(this.dir))
                        {
                            if (!station.pod_moving)
                            {
                                if (direction == station.dir)
                                {
                                    if (station.icon_state == "open")
                                    {
                                        user.loc = this.loc;
                                        user.client.Move(Map13.GetStep(this.loc, direction ?? 0), direction ?? 0);
                                        user.reset_perspective(null);
                                    }
                                    else
                                    {
                                        station.open_animation();
                                    }
                                }
                                else if (station.directions().Contains(direction))
                                {
                                    this.dir = direction ?? 0;
                                    station.launch_pod();
                                }
                            }
                            return(false);
                        }
                    }

                    foreach (dynamic _b in Lang13.Enumerate(this.loc, typeof(Obj_Structure_TransitTube)))
                    {
                        tube = _b;


                        if (tube.directions().Contains(this.dir))
                        {
                            if (tube.has_exit(direction))
                            {
                                this.dir = direction ?? 0;
                                return(false);
                            }
                        }
                    }
                }
            }
            return(false);
        }