Example #1
0
        public static ByTable List(string path)
        {
            var dir = new System.IO.DirectoryInfo(Config.DIR_CONTENT + path);

            var result_tab = new ByTable();

            foreach (var fi in dir.GetFiles())
            {
                result_tab.Add(fi.Name);
            }

            foreach (var di in dir.GetDirectories())
            {
                result_tab.Add(dir.Name);
            }

            return(result_tab);
        }
Example #2
0
        // Function from file: world.dm
        public static void update_status(  )
        {
            string  s        = null;
            ByTable features = null;
            int     n        = 0;
            dynamic M        = null;

            s = "";

            if (GlobalVars.config != null && Lang13.Bool(GlobalVars.config.server_name))
            {
                s += "<b>" + GlobalVars.config.server_name + "</b> &#8212; ";
            }
            s       += "<b>" + GlobalFuncs.station_name() + "</b>";
            s       += " (";
            s       += "<a href=\"http://\">";
            s       += "Default";
            s       += "</a>";
            s       += ")";
            features = new ByTable();

            if (GlobalVars.ticker != null)
            {
                if (Lang13.Bool(GlobalVars.master_mode))
                {
                    features.Add(GlobalVars.master_mode);
                }
            }
            else
            {
                features.Add("<b>STARTING</b>");
            }

            if (!GlobalVars.enter_allowed)
            {
                features.Add("closed");
            }
            features.Add((GlobalVars.abandon_allowed ? "respawn" : "no respawn"));

            if (GlobalVars.config != null && GlobalVars.config.allow_vote_mode)
            {
                features.Add("vote");
            }

            if (GlobalVars.config != null && GlobalVars.config.allow_ai)
            {
                features.Add("AI allowed");
            }
            n = 0;

            foreach (dynamic _a in Lang13.Enumerate(GlobalVars.player_list))
            {
                M = _a;


                if (Lang13.Bool(M.client))
                {
                    n++;
                }
            }

            if (n > 1)
            {
                features.Add("~" + n + " players");
            }
            else if (n > 0)
            {
                features.Add("~" + n + " player");
            }

            if (!Lang13.Bool(Game13.host) && GlobalVars.config != null && Lang13.Bool(GlobalVars.config.hostedby))
            {
                features.Add("hosted by <b>" + GlobalVars.config.hostedby + "</b>");
            }

            if (features != null)
            {
                s += ": " + GlobalFuncs.jointext(features, ", ");
            }

            if (Game13.status != s)
            {
                Game13.status = s;
            }
            return;
        }
Example #3
0
        // low/high coords should be ordered correctly, but do not actually need to be
        private static ByTable FetchInternal(int low_x, int low_y, int low_z, int high_x, int high_y, int high_z, Base_Static filter = null, bool tiles_only = false)
        {
            // Clamp min/max within bounds of the map.
            // If we can't, return an empty table.
            if (low_x < 1)
            {
                low_x = 1;
            }
            else if (low_x > Game13.map_size_x)
            {
                return(new ByTable());
            }

            if (low_y < 1)
            {
                low_y = 1;
            }
            else if (low_y > Game13.map_size_y)
            {
                return(new ByTable());
            }

            if (low_z < 1)
            {
                low_z = 1;
            }
            else if (low_z > Game13.map_size_z)
            {
                return(new ByTable());
            }

            if (high_x > Game13.map_size_x)
            {
                high_x = Game13.map_size_x;
            }
            else if (high_x < 1)
            {
                return(new ByTable());
            }

            if (high_y > Game13.map_size_y)
            {
                high_y = Game13.map_size_y;
            }
            else if (high_y < 1)
            {
                return(new ByTable());
            }

            if (high_z > Game13.map_size_z)
            {
                high_z = Game13.map_size_z;
            }
            else if (high_z < 1)
            {
                return(new ByTable());
            }

            HashSet <Base_Zone> collected_zones = null;

            if (!tiles_only)
            {
                collected_zones = new HashSet <Base_Zone>();
            }

            // Build result table.
            var result_table = new ByTable();

            for (int x = low_x; x <= high_x; x++)
            {
                for (int y = low_y; y <= high_y; y++)
                {
                    for (int z = low_z; z <= high_z; z++)
                    {
                        var tile = __Map[x - 1, y - 1, z - 1];

                        //EXCLUDE
                        if (tile == filter)
                        {
                            continue;
                        }

                        result_table.Add(tile);

                        if (tiles_only)
                        {
                            continue;
                        }

                        result_table.Add(tile.contents);
                        if (tile.loc != null && !collected_zones.Contains((Base_Zone)tile.loc))
                        {
                            result_table.Add(tile.loc);
                            collected_zones.Add((Base_Zone)tile.loc);
                        }
                    }
                }
            }

            // Exclude some more because I'm dumb as hell.
            if (filter != null)
            {
                result_table.Remove(filter);
            }

            return(result_table);
        }