コード例 #1
0
        public override void Initialize()
        {
            base.Initialize();

            // Register after all mods have loaded.
            foreach (EverestModule module in Everest.Modules)
            {
                GhostNetFrame.RegisterChunksFromModule(module);
            }

            if (_StartServer && !_StartHeadless)
            {
                Start(true, true);
            }
        }
コード例 #2
0
        public override void Load()
        {
            Everest.Events.Input.OnInitialize += OnInputInitialize;
            Everest.Events.Input.OnDeregister += OnInputDeregister;
            Everest.Events.Level.OnLoadEntity += OnLoadEntity;

            GhostNetHooks.Load();

            // Example of a MP server mod.
            GhostNetServer.OnCreate += GhostNetRaceManager.OnCreateServer;

            base.Initialize();

            Queue <string> args = new Queue <string>(Everest.Args);

            while (args.Count > 0)
            {
                string arg = args.Dequeue();
                if (arg == "--server")
                {
                    _StartServer = true;
                }
                else if (arg == "--headless")
                {
                    _StartHeadless = true;
                }
            }

            GhostModule.SettingsOverridden = true;
            ResetGhostModuleSettings();

            if (_StartServer && _StartHeadless)
            {
                // We don't care about other mods.
                GhostNetFrame.RegisterChunksFromModule(this);

                Start(true, true);
                RunDedicated();
                Environment.Exit(0);
            }
        }