Exemplo n.º 1
0
        public override void initialize()
        {
            if (s_Logger == null)
                s_Logger = new Logger("Conquest Core", "Client");

            m_MailMan = new ResponseProcessor();

            m_CmdProc = new CommandProcessor(m_MailMan);
            m_CmdProc.initialize();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Starts up the core on the server
        /// </summary>
        public override void initialize()
        {
            if (MyAPIGateway.Session == null || m_Initialized)
                return;

            if (s_Logger == null)
                s_Logger = new Logger("Conquest Core", "Server");
            log("Conquest core (Server) started");

            s_Settings = ConquestSettings.getInstance();
            s_DelayedSettingWrite = s_Settings.WriteFailed;
            // Start round timer
            m_RoundTimer = new MyTimer(s_Settings.CPPeriod * 1000, roundEnd);
            m_RoundTimer.Start();
            log("Round timer started with " + s_Settings.CPPeriod + " seconds");

            // Start save timer
            m_SaveTimer = new MyTimer(Constants.SaveInterval * 1000, saveTimer);
            m_SaveTimer.Start();
            log("Save timer started");

            m_MailMan = new RequestProcessor();

            // If the server is a player (non-dedicated) they also need to receive notifications
            if (!MyAPIGateway.Utilities.IsDedicated) {
                m_LocalReceiver = new ResponseProcessor(false);
                m_MailMan.localMsgSent += m_LocalReceiver.incomming;
                m_CmdProc = new CommandProcessor(m_LocalReceiver);
                m_CmdProc.initialize();
                m_LocalReceiver.requestSettings();
            }

            // Subscribe events
            GridEnforcer.OnPlacementViolation += eventPlacementViolation;
            GridEnforcer.OnCleanupViolation += eventCleanupViolation;
            GridEnforcer.OnCleanupTimerStart += eventCleanupTimerStart;
            GridEnforcer.OnCleanupTimerEnd += eventCleanupTimerEnd;
            ControlPoint.OnRewardsDistributed += notifyPlayersOfCPResults;

            m_Initialized = true;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Starts up the core on the server
        /// </summary>
        public override void initialize()
        {
            if (MyAPIGateway.Session == null || m_Initialized)
                return;

            if (s_Logger == null)
                s_Logger = new Logger("Conquest Core", "Server");
            log("Conquest core (Server) started");

            s_TokenBuilder = new MyObjectBuilder_Component() { SubtypeName = "ShipLicense" };
            s_TokenDef = new VRage.ObjectBuilders.SerializableDefinitionId(
                typeof(MyObjectBuilder_InventoryItem), "ShipLicense");
            s_Sorter = new GridSorter();

            s_Settings = ConquestSettings.getInstance();
            s_DelayedSettingWrite = s_Settings.WriteFailed;
            // Start round timer
            m_RoundTimer = new MyTimer(s_Settings.CPPeriod * 1000, roundEnd);
            m_RoundTimer.Start();
            log("Round timer started");

            // Start save timer
            m_SaveTimer = new MyTimer(Constants.SaveInterval * 1000, saveTimer);
            m_SaveTimer.Start();
            log("Save timer started");

            m_MailMan = new RequestProcessor();

            // If the server is a player (non-dedicated) they also need to receive notifications
            if (!MyAPIGateway.Utilities.IsDedicated) {
                m_LocalReceiver = new ResponseProcessor(false);
                m_MailMan.localMsgSent += m_LocalReceiver.incomming;
                m_CmdProc = new CommandProcessor(m_LocalReceiver);
                m_CmdProc.initialize();
                m_LocalReceiver.requestSettings();
            }

            // Subscribe events
            GridEnforcer.OnPlacementViolation += eventPlacementViolation;
            GridEnforcer.OnCleanupViolation += eventCleanupViolation;
            GridEnforcer.OnCleanupTimerStart += eventCleanupTimerStart;
            GridEnforcer.OnCleanupTimerEnd += eventCleanupTimerEnd;

            m_Initialized = true;
        }