Esempio n. 1
0
        private void CallSideControl(Session.ShieldSides side, bool enable)
        {
            switch (side)
            {
            case Session.ShieldSides.Left:
                DsUi.SetLeftShield(Shield, enable);
                break;

            case Session.ShieldSides.Right:
                DsUi.SetRightShield(Shield, enable);
                break;

            case Session.ShieldSides.Up:
                DsUi.SetTopShield(Shield, enable);
                break;

            case Session.ShieldSides.Down:
                DsUi.SetBottomShield(Shield, enable);
                break;

            case Session.ShieldSides.Forward:
                DsUi.SetFrontShield(Shield, enable);
                break;

            case Session.ShieldSides.Backward:
                DsUi.SetBackShield(Shield, enable);
                break;
            }
        }
        internal static void HeightWriter(IMyTerminalBlock blk, StringBuilder sb)
        {
            var comp = blk?.GameLogic?.GetAs <DefenseShields>();

            if (comp == null)
            {
                return;
            }
            sb.Append(DsUi.GetOffsetHeight(blk));
        }
        internal static void TerminalActionFitSizeDecrease(IMyTerminalBlock blk)
        {
            var comp = blk?.GameLogic?.GetAs <DefenseShields>();

            if (comp == null)
            {
                return;
            }

            var currentValue = DsUi.GetFit(blk);
            var nextValue    = currentValue - 1 >= 0 ? currentValue - 1 : currentValue;

            DsUi.SetFit(blk, nextValue);
        }
        internal static void TerminalActioFitSizeIncrease(IMyTerminalBlock blk)
        {
            var comp = blk?.GameLogic?.GetAs <DefenseShields>();

            if (comp == null)
            {
                return;
            }

            var currentValue = DsUi.GetFit(blk);
            var nextValue    = currentValue + 1 < Instance.Fits.Length ? currentValue + 1 : currentValue;

            DsUi.SetFit(blk, nextValue);
        }
        internal static void TerminalActioWidthIncrease(IMyTerminalBlock blk)
        {
            var comp = blk?.GameLogic?.GetAs <DefenseShields>();

            if (comp == null)
            {
                return;
            }
            var max          = comp.ShieldMode == DefenseShields.ShieldType.Station ? 70 : 39;
            var currentValue = DsUi.GetOffsetWidth(blk);
            var nextValue    = currentValue + 1 < max ? currentValue + 1 : currentValue;

            DsUi.SetOffsetWidth(blk, nextValue);
        }
Esempio n. 6
0
        private void ShieldHotKeys()
        {
            if (Session.Instance.HudComp != this || !Shield.HasPlayerAccess(MyAPIGateway.Session.Player.IdentityId) || Session.Instance.Settings.ClientConfig.DisableKeys)
            {
                return;
            }

            var input      = Session.Instance.UiInput;
            var shuntCount = ShuntedSideCount();

            if (input.LeftReleased)
            {
                QuickShuntUpdate(Session.ShieldSides.Left, shuntCount);
            }
            else if (input.RightReleased)
            {
                QuickShuntUpdate(Session.ShieldSides.Right, shuntCount);
            }
            else if (input.FrontReleased)
            {
                QuickShuntUpdate(Session.ShieldSides.Forward, shuntCount);
            }
            else if (input.BackReleased)
            {
                QuickShuntUpdate(Session.ShieldSides.Backward, shuntCount);
            }
            else if (input.UpReleased)
            {
                QuickShuntUpdate(Session.ShieldSides.Up, shuntCount);
            }
            else if (input.DownReleased)
            {
                QuickShuntUpdate(Session.ShieldSides.Down, shuntCount);
            }
            else if (input.ShuntReleased)
            {
                DsUi.SetSideShunting(Shield, !DsSet.Settings.SideShunting);
            }
            else if (input.KineticReleased || input.EnergyReleased)
            {
                SetModulatorQuickKey();
            }
        }
Esempio n. 7
0
        private void SetShieldType(bool quickCheck)
        {
            var noChange = false;
            var oldMode  = ShieldMode;

            if (_isServer)
            {
                switch (ShieldComp.EmitterMode)
                {
                case 0:
                    ShieldMode         = ShieldType.Station;
                    DsState.State.Mode = (int)ShieldMode;
                    break;

                case 1:
                    ShieldMode         = ShieldType.LargeGrid;
                    DsState.State.Mode = (int)ShieldMode;
                    break;

                case 2:
                    ShieldMode         = ShieldType.SmallGrid;
                    DsState.State.Mode = (int)ShieldMode;
                    break;

                default:
                    ShieldMode              = ShieldType.Unknown;
                    DsState.State.Mode      = (int)ShieldMode;
                    DsState.State.Suspended = true;
                    break;
                }
            }
            else
            {
                ShieldMode = (ShieldType)DsState.State.Mode;
            }

            if (ShieldMode == oldMode)
            {
                noChange = true;
            }

            if ((quickCheck && noChange) || ShieldMode == ShieldType.Unknown)
            {
                return;
            }

            switch (ShieldMode)
            {
            case ShieldType.Station:
                if (Session.Enforced.StationRatio > 0)
                {
                    _shieldTypeRatio = Session.Enforced.StationRatio;
                }
                break;

            case ShieldType.LargeGrid:
                if (Session.Enforced.LargeShipRatio > 0)
                {
                    _shieldTypeRatio = Session.Enforced.LargeShipRatio;
                }
                break;

            case ShieldType.SmallGrid:
                if (Session.Enforced.SmallShipRatio > 0)
                {
                    _shieldTypeRatio = Session.Enforced.SmallShipRatio;
                }
                break;
            }

            switch (ShieldMode)
            {
            case ShieldType.Station:
                _shapeChanged    = false;
                UpdateDimensions = true;
                break;

            case ShieldType.LargeGrid:
                _updateMobileShape = true;
                break;

            case ShieldType.SmallGrid:
                //_modelActive = "\\Models\\Cubes\\ShieldActiveBase_LOD4.mwm";
                _updateMobileShape = true;
                break;
            }
            GridIsMobile = ShieldMode != ShieldType.Station;
            DsUi.CreateUi(Shield);
            InitEntities(true);
        }