예제 #1
0
 public static void Init(FillContainer container)
 {
     container.RegisterFill("Flatgrass", FFlatgrass);
     container.RegisterFill("White", FWhite);
     container.RegisterFill("Bedrock", FBedrock);
     container.RegisterFill("Wireworld", FWireworld);
 }
예제 #2
0
        /// <summary>
        /// Loads server settings, loads the database, and prepares the system for use.
        /// </summary>
        public static void Setup()
        {
            Setting = new PbSettingsLoader();
            TextFormats = new Text();

            SysSettings = new Settings("System.txt", ReadSystemSettings);
            Setting.RegisterFile(SysSettings);
            SysSettings.LoadFile();

            Rulesfile = new Settings("Rules.txt", ReadRules, "Settings/", false);
            Setting.RegisterFile(Rulesfile);
            Rulesfile.LoadFile();

            if (RotateLogs)
                Logger.RotateLogs();

            Permholder = new PermissionContainer();
            Rankholder = new RankContainer();
            Blockholder = new BlockContainer();
            BmContainer = new BuildMode();

            DefaultRank = Rankholder.GetRank(DefaultRank.Name);

            DB = new Database();
            Logger.Log("Database", "Database loaded.", LogType.Info);

            Nh = new NetworkHandler();
            Logger.Log("", "Core Initialized.", LogType.Info);

            Maps = new Dictionary<string, HypercubeMap>(StringComparer.InvariantCultureIgnoreCase);
            HypercubeMap.LoadMaps();

            HypercubeMap m;
            Maps.TryGetValue(MapMain, out m);

            if (m == null) {
                var mainMap = new HypercubeMap("Maps/" + MapMain + ".cw", MapMain, 128, 128, 128);
                Maps.Add(MapMain, mainMap);
                Logger.Log("Core", "Main world not found, a new one has been created.", LogType.Warning);
            }

            Commandholder = new CommandHandler();
            Fillholder = new FillContainer();

            Luahandler = new HCLua();
            Luahandler.RegisterFunctions();
            Luahandler.LoadScripts();

            Setting.SaveAll();

            FillStacks();
            ActionQueue = new ConcurrentQueue<MapAction>();
        }