Beispiel #1
0
        public override void updateBeforeSimulation()
        {
            try {
                if (m_RoundEnded)
                {
                    log("Round ended, distributing CP Rewards", "updateBeforeSimulation");
                    foreach (ControlPoint cp in s_Settings.ControlPoints)
                    {
                        cp.distributeRewards();
                    }
                    m_RoundEnded = false;
                }
                if (s_DelayedSettingWrite)
                {
                    log("Settings Write was delayed, trying again", "updateBeforeSimulation");
                    s_Settings.writeSettings();
                    if (!s_Settings.WriteFailed)
                    {
                        s_DelayedSettingWrite = false;
                        log("Setting Write Success", "updateBeforeSimulation");
                    }
                }

                // Performing this notification if server is player
                if (!MyAPIGateway.Utilities.IsDedicated)
                {
                    if (m_CurrentFrame >= Constants.UpdateFrequency - 1)
                    {
                        if (m_Player.Controller.ControlledEntity is InGame.IMyShipController)
                        {
                            IMyCubeGrid  currentControllerGrid = (m_Player.Controller.ControlledEntity as IMyCubeBlock).CubeGrid;
                            IMyCubeBlock classifierBlock       = currentControllerGrid.getFirstClassifierBlock();
                            if (classifierBlock != null && classifierBlock.OwnerId != m_Player.PlayerID && s_Settings.SimpleOwnership)
                            {
                                MyAPIGateway.Utilities.ShowNotification("WARNING: Take control of the hull classifier or your position may be tracked!", 1250, MyFontEnum.Red);
                            }
                        }
                        m_CurrentFrame = 0;
                    }
                    ++m_CurrentFrame;
                }
            }
            catch (Exception e) {
                log("Error" + e, "updateBeforeSimulation", Logger.severity.ERROR);
            }
        }