Exemple #1
0
        // Function from file: transit_tube.dm
        public void destroy_diagonals(  )
        {
            Obj_Structure_TransitTube D = null;
            int  my_dir                 = 0;
            bool is_connecting          = false;
            Obj_Structure_TransitTube N = null;


            foreach (dynamic _b in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(this, 1), typeof(Obj_Structure_TransitTube)))
            {
                D = _b;


                if (String13.SubStr(D.icon_state, 1, 3) == "D-")
                {
                    my_dir        = GlobalFuncs.text2dir_extended(String13.SubStr(D.icon_state, 3, 5));
                    is_connecting = false;

                    foreach (dynamic _a in Lang13.Enumerate(Map13.FetchInRangeExcludeThis(D, 1), typeof(Obj_Structure_TransitTube)))
                    {
                        N = _a;


                        if ((Map13.GetDistance(D, N) == Num13.Rotate(my_dir, -45) && D.has_exit(Num13.Rotate(my_dir, 90)) || Map13.GetDistance(D, N) == Num13.Rotate(my_dir, 45) && D.has_exit(Num13.Rotate(my_dir, -90))) && D != this)
                        {
                            is_connecting = true;
                            break;
                        }
                    }

                    if (!is_connecting)
                    {
                        GlobalFuncs.qdel(D);
                    }
                }
            }
            return;
        }
        // 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);
        }
        // Function from file: transit_tube_pod.dm
        public void follow_tube(bool?reverse_launch = null)
        {
            Obj_Structure_TransitTube current_tube = null;
            dynamic next_dir                = null;
            Tile    next_loc                = null;
            int     last_delay              = 0;
            int     exit_delay              = 0;
            Obj_Structure_TransitTube tube  = null;
            Obj_Structure_TransitTube tube2 = null;


            if (this.moving)
            {
                return;
            }
            this.moving  = true;
            current_tube = null;
            last_delay   = 0;

            if (reverse_launch == true)
            {
                this.dir = Num13.Rotate(this.dir, 180);
            }

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


                if (tube.has_exit(this.dir))
                {
                    current_tube = tube;
                    break;
                }
            }

            while (current_tube != null)
            {
                next_dir = current_tube.get_exit(this.dir);

                if (!Lang13.Bool(next_dir))
                {
                    break;
                }
                exit_delay  = current_tube.f_exit_delay(this, this.dir) ?1:0;
                last_delay += exit_delay;
                Task13.Sleep(exit_delay);
                next_loc     = Map13.GetStep(this.loc, Convert.ToInt32(next_dir));
                current_tube = null;

                foreach (dynamic _b in Lang13.Enumerate(next_loc, typeof(Obj_Structure_TransitTube)))
                {
                    tube2 = _b;


                    if (tube2.has_entrance(next_dir))
                    {
                        current_tube = tube2;
                        break;
                    }
                }

                if (current_tube == null)
                {
                    this.dir = Convert.ToInt32(next_dir);
                    this.Move(Map13.GetStep(this.loc, this.dir), this.dir);
                    break;
                }
                last_delay = current_tube.f_enter_delay(this, next_dir);
                Task13.Sleep(last_delay);
                this.dir     = Convert.ToInt32(next_dir);
                this.loc     = next_loc;
                this.density = current_tube.density;

                if (current_tube != null && current_tube.should_stop_pod(this, next_dir))
                {
                    current_tube.pod_stopped(this, this.dir);
                    break;
                }
            }
            this.density = true;
            this.moving  = false;
            return;
        }