public void CreateModulatorUi(IMyTerminalBlock block)
        {
            try
            {
                if (ModControl)
                {
                    return;
                }
                var comp = block?.GameLogic?.GetAs <Modulators>();
                ModSep1   = TerminalHelpers.Separator(comp?.Modulator, "DS-M_sep1");
                ModDamage = TerminalHelpers.AddSlider(comp?.Modulator, "DS-M_DamageModulation", Localization.GetText("TerminalModDamageTitle"), Localization.GetText("TerminalModDamageTooltip"), ModUi.GetDamage, ModUi.SetDamage);
                ModDamage.SetLimits(20, 180);
                ModSep2      = TerminalHelpers.Separator(comp?.Modulator, "DS-M_sep2");
                ModReInforce = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateReInforceProt", Localization.GetText("TerminalModReInforceTitle"), Localization.GetText("TerminalModReInforceTooltip"), ModUi.GetReInforceProt, ModUi.SetReInforceProt);
                ModVoxels    = TerminalHelpers.AddCheckbox(comp?.Modulator, " DS-M_ModulateVoxels", Localization.GetText("TerminalModVoxelsTitle"), Localization.GetText("TerminalModVoxelsTooltip"), ModUi.GetVoxels, ModUi.SetVoxels);
                ModGrids     = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateGrids", Localization.GetText("TerminalModGridsTitle"), Localization.GetText("TerminalModGridsTooltip"), ModUi.GetGrids, ModUi.SetGrids);
                ModAllies    = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateAllies", Localization.GetText("TerminalModAlliesTitle"), Localization.GetText("TerminalModAlliesTooltip"), ModUi.GetAllies, ModUi.SetAllies);
                ModEmp       = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateEmpProt", Localization.GetText("TerminalModEmpTitle"), Localization.GetText("TerminalModEmpTooltip"), ModUi.GetEmpProt, ModUi.SetEmpProt);

                CreateActionDamageModRate <IMyUpgradeModule>(ModDamage);

                CreateAction <IMyUpgradeModule>(ModVoxels);
                CreateAction <IMyUpgradeModule>(ModGrids);
                CreateAction <IMyUpgradeModule>(ModEmp);
                CreateAction <IMyUpgradeModule>(ModReInforce);
                ModControl = true;
            }
            catch (Exception ex) { Log.Line($"Exception in CreateModulatorUi: {ex}"); }
        }
Пример #2
0
        public void CreateModulatorUi(IMyTerminalBlock block)
        {
            try
            {
                if (ModControl)
                {
                    return;
                }
                var comp = block?.GameLogic?.GetAs <Modulators>();
                ModSep1   = TerminalHelpers.Separator(comp?.Modulator, "DS-M_sep1");
                ModDamage = TerminalHelpers.AddSlider(comp?.Modulator, "DS-M_DamageModulation", "Balance Shield Protection", "Balance Shield Protection", ModUi.GetDamage, ModUi.SetDamage);
                ModDamage.SetLimits(20, 180);
                ModSep2      = TerminalHelpers.Separator(comp?.Modulator, "DS-M_sep2");
                ModReInforce = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateReInforceProt", "Enhance structural integrity", "Enhance structural integrity, prevents damage from collisions", ModUi.GetReInforceProt, ModUi.SetReInforceProt);
                ModVoxels    = TerminalHelpers.AddCheckbox(comp?.Modulator, " DS-M_ModulateVoxels", "Terrain is ignored by shield", "Let voxels bypass shield", ModUi.GetVoxels, ModUi.SetVoxels);
                ModGrids     = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateGrids", "Entities may pass the shield", "Let grid bypass shield", ModUi.GetGrids, ModUi.SetGrids);
                ModAllies    = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateAllies", "Allied players can bypass", "Let ally players bypass shield", ModUi.GetAllies, ModUi.SetAllies);
                ModEmp       = TerminalHelpers.AddCheckbox(comp?.Modulator, "DS-M_ModulateEmpProt", "Protects against EMP damage", "But generates heat 10x faster", ModUi.GetEmpProt, ModUi.SetEmpProt);

                CreateActionDamageModRate <IMyUpgradeModule>(ModDamage);

                CreateAction <IMyUpgradeModule>(ModVoxels);
                CreateAction <IMyUpgradeModule>(ModGrids);
                CreateAction <IMyUpgradeModule>(ModEmp);
                CreateAction <IMyUpgradeModule>(ModReInforce);
                ModControl = true;
            }
            catch (Exception ex) { Log.Line($"Exception in CreateModulatorUi: {ex}"); }
        }
        public void CreateControllerElements(IMyTerminalBlock block)
        {
            try
            {
                if (DsControl)
                {
                    return;
                }
                var comp = block?.GameLogic?.GetAs <DefenseShields>();
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep0");
                ToggleShield = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_ToggleShield", Localization.GetText("TerminalToggleShieldTitle"), Localization.GetText("TerminalToggleShieldTooltip"), Localization.GetText("TerminalSwitchUp"), Localization.GetText("TerminalSwitchDown"), DsUi.GetRaiseShield, DsUi.SetRaiseShield);
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep1");
                //ChargeSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_ChargeRate", "Shield Charge Rate", "Percentage Of Power The Shield May Consume", DsUi.GetRate, DsUi.SetRate);
                //ChargeSlider.SetLimits(20, 95);
                PowerScaleSelect = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_PowerScale", Localization.GetText("TerminalPowerScaleSelectTitle"), Localization.GetText("TerminalPowerScaleSelectTooltip"), DsUi.GetPowerScale, DsUi.SetPowerScale, DsUi.ListPowerScale);

                PowerWatts = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_PowerWatts", Localization.GetText("TerminalPowerWattsTitle"), Localization.GetText("TerminalPowerWattsTooltip"), DsUi.GetPowerWatts, DsUi.SetPowerWatts, DsUi.EnablePowerWatts);
                PowerWatts.SetLimits(1, 999);
                if (comp != null && comp.GridIsMobile)
                {
                    TerminalHelpers.Separator(comp.Shield, "DS-C_sep2");
                }

                Fit = TerminalHelpers.AddSlider(comp?.Shield, "DS-CFit", Localization.GetText("TerminalFitTitle"), Localization.GetText("TerminalFitTooltip"), DsUi.GetFit, DsUi.SetFit);
                Fit.SetLimits(0, 22);

                SphereFit     = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_SphereFit", Localization.GetText("TerminalSphereFitTitle"), Localization.GetText("TerminalSphereFitTooltip"), DsUi.GetSphereFit, DsUi.SetSphereFit);
                FortifyShield = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_ShieldFortify", Localization.GetText("TerminalFortifyShieldTitle"), Localization.GetText("TerminalFortifyShieldTooltip"), DsUi.GetFortify, DsUi.SetFortify);

                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep3");

                WidthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_WidthSlider", Localization.GetText("TerminalWidthSliderTitle"), Localization.GetText("TerminalWidthSliderTooltip"), DsUi.GetWidth, DsUi.SetWidth);
                WidthSlider.SetLimits(30, 1000);

                HeightSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_HeightSlider", Localization.GetText("TerminalHeightSliderTitle"), Localization.GetText("TerminalHeightSliderTooltip"), DsUi.GetHeight, DsUi.SetHeight);
                HeightSlider.SetLimits(30, 1000);

                DepthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_DepthSlider", Localization.GetText("TerminalDepthSliderTitle"), Localization.GetText("TerminalDepthSliderTooltip"), DsUi.GetDepth, DsUi.SetDepth);
                DepthSlider.SetLimits(30, 1000);

                OffsetWidthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetWidthSlider", Localization.GetText("TerminalOffsetWidthSliderTitle"), Localization.GetText("TerminalOffsetWidthSliderTooltip"), DsUi.GetOffsetWidth, DsUi.SetOffsetWidth);
                OffsetWidthSlider.SetLimits(-69, 69);

                OffsetHeightSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetHeightSlider", Localization.GetText("TerminalOffsetHeightSliderTitle"), Localization.GetText("TerminalOffsetHeightSliderTooltip"), DsUi.GetOffsetHeight, DsUi.SetOffsetHeight);
                OffsetHeightSlider.SetLimits(-69, 69);

                OffsetDepthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetDepthSlider", Localization.GetText("TerminalOffsetDepthSliderTitle"), Localization.GetText("TerminalOffsetDepthSliderTooltip"), DsUi.GetOffsetDepth, DsUi.SetOffsetDepth);
                OffsetDepthSlider.SetLimits(-69, 69);

                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep4");

                BatteryBoostCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_UseBatteries", Localization.GetText("TerminalBatteryBoostCheckBoxTitle"), Localization.GetText("TerminalBatteryBoostCheckBoxTooltip"), DsUi.GetBatteries, DsUi.SetBatteries);
                SendToHudCheckBox    = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HideIcon", Localization.GetText("TerminalSendToHudCheckBoxTitle"), Localization.GetText("TerminalSendToHudCheckBoxTooltip"), DsUi.GetSendToHud, DsUi.SetSendToHud);
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep5");
                ShellSelect = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_ShellSelect", Localization.GetText("TerminalShellSelectTitle"), Localization.GetText("TerminalShellSelectTooltip"), DsUi.GetShell, DsUi.SetShell, DsUi.ListShell);

                ShellVisibility = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_ShellSelect", Localization.GetText("TerminalShellVisibilityTitle"), Localization.GetText("TerminalShellVisibilityTooltip"), DsUi.GetVisible, DsUi.SetVisible, DsUi.ListVisible);

                HideActiveCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HideActive", Localization.GetText("TerminalHideActiveCheckBoxTitle"), Localization.GetText("TerminalHideActiveCheckBoxTooltip"), DsUi.GetHideActive, DsUi.SetHideActive);

                //RefreshAnimationCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_RefreshAnimation", "Show Refresh Animation  ", "Show Random Refresh Animation", DsUi.GetRefreshAnimation, DsUi.SetRefreshAnimation);
                //HitWaveAnimationCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HitWaveAnimation", "Show Hit Wave Animation", "Show Wave Effect On Shield Damage", DsUi.GetHitWaveAnimation, DsUi.SetHitWaveAnimation);
                NoWarningSoundsCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_NoWarningSounds", Localization.GetText("TerminalNoWarningSoundsCheckBoxTitle"), Localization.GetText("TerminalNoWarningSoundsCheckBoxTooltip"), DsUi.GetNoWarningSounds, DsUi.SetNoWarningSounds);
                DimShieldHitsCheckBox   = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_DimShieldHits", Localization.GetText("TerminalDimShieldHitsCheckBoxTitle"), Localization.GetText("TerminalDimShieldHitsCheckBoxTooltip"), DsUi.GetDimShieldHits, DsUi.SetDimShieldHits);

                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep6");
                SideShunting = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_SideRedirect", Localization.GetText("TerminalSideShuntingTitle"), Localization.GetText("TerminalSideShuntingTooltip"), DsUi.GetSideShunting, DsUi.SetSideShunting);
                ShowShunting = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_ShowRedirect", Localization.GetText("TerminalShowShuntingTitle"), Localization.GetText("TerminalShowShuntingTooltip"), DsUi.GetShowShunting, DsUi.SetShowShunting);

                TopShield    = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_TopShield", Localization.GetText("TerminalTopShieldTitle"), Localization.GetText("TerminalTopShieldTooltip"), Localization.GetText("TerminalSwitchPush"), Localization.GetText("TerminalSwitchPull"), DsUi.GeTopShield, DsUi.SetTopShield, DsUi.RedirectEnabled);
                BottomShield = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_BottomShield", Localization.GetText("TerminalBottomShieldTitle"), Localization.GetText("TerminalBottomShieldTooltip"), Localization.GetText("TerminalSwitchPush"), Localization.GetText("TerminalSwitchPull"), DsUi.GetBottomShield, DsUi.SetBottomShield, DsUi.RedirectEnabled);
                LeftShield   = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_LeftShield", Localization.GetText("TerminalLeftShieldTitle"), Localization.GetText("TerminalLeftShieldTooltip"), Localization.GetText("TerminalSwitchPush"), Localization.GetText("TerminalSwitchPull"), DsUi.GetLeftShield, DsUi.SetLeftShield, DsUi.RedirectEnabled);
                RightShield  = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_RightShield", Localization.GetText("TerminalRightShieldTitle"), Localization.GetText("TerminalRightShieldTooltip"), Localization.GetText("TerminalSwitchPush"), Localization.GetText("TerminalSwitchPull"), DsUi.GetRightShield, DsUi.SetRightShield, DsUi.RedirectEnabled);
                FrontShield  = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_FrontShield", Localization.GetText("TerminalFrontShieldTitle"), Localization.GetText("TerminalFrontShieldTooltip"), Localization.GetText("TerminalSwitchPush"), Localization.GetText("TerminalSwitchPull"), DsUi.GetFrontShield, DsUi.SetFrontShield, DsUi.RedirectEnabled);
                BackShield   = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_BackShield", Localization.GetText("TerminalBackShieldTitle"), Localization.GetText("TerminalBackShieldTooltip"), Localization.GetText("TerminalSwitchPush"), Localization.GetText("TerminalSwitchPull"), DsUi.GetBackShield, DsUi.SetBackShield, DsUi.RedirectEnabled);


                CreateAction <IMyUpgradeModule>(ToggleShield);

                CreateAction <IMyUpgradeModule>(SphereFit);
                CreateFitAction <IMyUpgradeModule>(Fit);
                CreateAction <IMyUpgradeModule>(FortifyShield);


                CreateAction <IMyUpgradeModule>(HideActiveCheckBox);
                //CreateAction<IMyUpgradeModule>(RefreshAnimationCheckBox);
                //CreateAction<IMyUpgradeModule>(HitWaveAnimationCheckBox);
                CreateAction <IMyUpgradeModule>(SendToHudCheckBox);
                CreateAction <IMyUpgradeModule>(BatteryBoostCheckBox);
                CreateDepthAction <IMyUpgradeModule>(DepthSlider);
                CreateWidthAction <IMyUpgradeModule>(WidthSlider);
                CreateHeightAction <IMyUpgradeModule>(HeightSlider);

                CreateShuntAction <IMyUpgradeModule>(TopShield);
                CreateShuntAction <IMyUpgradeModule>(BottomShield);
                CreateShuntAction <IMyUpgradeModule>(LeftShield);
                CreateShuntAction <IMyUpgradeModule>(RightShield);
                CreateShuntAction <IMyUpgradeModule>(FrontShield);
                CreateShuntAction <IMyUpgradeModule>(BackShield);

                CreateAction <IMyUpgradeModule>(SideShunting);

                DsControl = true;
            }
            catch (Exception ex) { Log.Line($"Exception in CreateControlerUi: {ex}"); }
        }
Пример #4
0
        public void CreateControllerElements(IMyTerminalBlock block)
        {
            try
            {
                if (DsControl)
                {
                    return;
                }
                var comp = block?.GameLogic?.GetAs <DefenseShields>();
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep0");
                ToggleShield = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_ToggleShield", "Shield Status", "Raise or Lower Shields", "Up", "Down", DsUi.GetRaiseShield, DsUi.SetRaiseShield);
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep1");
                //ChargeSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_ChargeRate", "Shield Charge Rate", "Percentage Of Power The Shield May Consume", DsUi.GetRate, DsUi.SetRate);
                //ChargeSlider.SetLimits(20, 95);
                PowerScaleSelect = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_PowerScale", "Select Power Scale", "Select the power scale to use", DsUi.GetPowerScale, DsUi.SetPowerScale, DsUi.ListPowerScale);

                PowerWatts = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_PowerWatts", "Power To Use", "Select the maximum scaled power the shield can use", DsUi.GetPowerWatts, DsUi.SetPowerWatts, DsUi.EnablePowerWatts);
                PowerWatts.SetLimits(1, 999);
                if (comp != null && comp.GridIsMobile)
                {
                    TerminalHelpers.Separator(comp.Shield, "DS-C_sep2");
                }

                Fit = TerminalHelpers.AddSlider(comp?.Shield, "DS-CFit", "Shield Fit", "Shield Fit", DsUi.GetFit, DsUi.SetFit);
                Fit.SetLimits(0, 29);

                SphereFit     = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_SphereFit", "Sphere Shield", "Sphere Shield", DsUi.GetSphereFit, DsUi.SetSphereFit);
                FortifyShield = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_ShieldFortify", "Fortify Shield ", "Fortify Shield ", DsUi.GetFortify, DsUi.SetFortify);

                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep3");

                WidthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_WidthSlider", "Shield Size Width", "Shield Size Width", DsUi.GetWidth, DsUi.SetWidth);
                WidthSlider.SetLimits(30, 1000);

                HeightSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_HeightSlider", "Shield Size Height", "Shield Size Height", DsUi.GetHeight, DsUi.SetHeight);
                HeightSlider.SetLimits(30, 1000);

                DepthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_DepthSlider", "Shield Size Depth", "Shield Size Depth", DsUi.GetDepth, DsUi.SetDepth);
                DepthSlider.SetLimits(30, 1000);

                OffsetWidthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetWidthSlider", "Width Offset", "Width Offset", DsUi.GetOffsetWidth, DsUi.SetOffsetWidth);
                OffsetWidthSlider.SetLimits(-69, 69);

                OffsetHeightSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetHeightSlider", "Height Offset", "Height Offset", DsUi.GetOffsetHeight, DsUi.SetOffsetHeight);
                OffsetHeightSlider.SetLimits(-69, 69);

                OffsetDepthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetDepthSlider", "Depth Offset", "Depth Offset", DsUi.GetOffsetDepth, DsUi.SetOffsetDepth);
                OffsetDepthSlider.SetLimits(-69, 69);

                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep4");

                BatteryBoostCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_UseBatteries", "Ignore battery input power ", "Allow shields to fight with batteries for power", DsUi.GetBatteries, DsUi.SetBatteries);
                SendToHudCheckBox    = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HideIcon", "Broadcast Shield Status To Hud", "Broadcast Shield Status To Nearby Friendly Huds", DsUi.GetSendToHud, DsUi.SetSendToHud);
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep5");
                ShellSelect = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_ShellSelect", "Select Shield Look", "Select shield's shell texture", DsUi.GetShell, DsUi.SetShell, DsUi.ListShell);

                ShellVisibility = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_ShellSelect", "Select Shield Visibility", "Determines when the shield is visible", DsUi.GetVisible, DsUi.SetVisible, DsUi.ListVisible);

                HideActiveCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HideActive", "Hide Shield Health On Hit  ", "Hide Shield Health Grid On Hit", DsUi.GetHideActive, DsUi.SetHideActive);

                //RefreshAnimationCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_RefreshAnimation", "Show Refresh Animation  ", "Show Random Refresh Animation", DsUi.GetRefreshAnimation, DsUi.SetRefreshAnimation);
                //HitWaveAnimationCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HitWaveAnimation", "Show Hit Wave Animation", "Show Wave Effect On Shield Damage", DsUi.GetHitWaveAnimation, DsUi.SetHitWaveAnimation);
                NoWarningSoundsCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_NoWarningSounds", "Disable audio warnings    ", "Supress shield audio warnings", DsUi.GetNoWarningSounds, DsUi.SetNoWarningSounds);
                DimShieldHitsCheckBox   = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_DimShieldHits", "Dim Incoming Hit Effects ", "Supress brightness of incoming hit effects", DsUi.GetDimShieldHits, DsUi.SetDimShieldHits);

                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep6");
                SideShunting = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_SideRedirect", "Shunt Shields", "Enable Shield Shunting", DsUi.GetSideShunting, DsUi.SetSideShunting);
                ShowShunting = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_ShowRedirect", "Show Shunted Shields", "Enable/Disable showing side shield states", DsUi.GetShowShunting, DsUi.SetShowShunting);

                TopShield    = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_TopShield", "Shunt Top Shield", "Redirect Top shield power to others", "Push", "Pull", DsUi.GeTopShield, DsUi.SetTopShield, DsUi.RedirectEnabled);
                BottomShield = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_BottomShield", "Shunt Bottom Shield", "Redirect bottom shield power to others", "Push", "Pull", DsUi.GetBottomShield, DsUi.SetBottomShield, DsUi.RedirectEnabled);
                LeftShield   = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_LeftShield", "Shunt Left Shield", "Redirect Left shield power to others", "Push", "Pull", DsUi.GetLeftShield, DsUi.SetLeftShield, DsUi.RedirectEnabled);
                RightShield  = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_RightShield", "Shunt Right Shield", "Redirect Right shield power to others", "Push", "Pull", DsUi.GetRightShield, DsUi.SetRightShield, DsUi.RedirectEnabled);
                FrontShield  = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_FrontShield", "Shunt Front Shield", "Redirect Front shield power to others", "Push", "Pull", DsUi.GetFrontShield, DsUi.SetFrontShield, DsUi.RedirectEnabled);
                BackShield   = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_BackShield", "Shunt Back Shield", "Redirect Back shield power to others", "Push", "Pull", DsUi.GetBackShield, DsUi.SetBackShield, DsUi.RedirectEnabled);


                CreateAction <IMyUpgradeModule>(ToggleShield);

                CreateAction <IMyUpgradeModule>(SphereFit);
                CreateFitAction <IMyUpgradeModule>(Fit);
                CreateAction <IMyUpgradeModule>(FortifyShield);


                CreateAction <IMyUpgradeModule>(HideActiveCheckBox);
                //CreateAction<IMyUpgradeModule>(RefreshAnimationCheckBox);
                //CreateAction<IMyUpgradeModule>(HitWaveAnimationCheckBox);
                CreateAction <IMyUpgradeModule>(SendToHudCheckBox);
                CreateAction <IMyUpgradeModule>(BatteryBoostCheckBox);
                CreateDepthAction <IMyUpgradeModule>(DepthSlider);
                CreateWidthAction <IMyUpgradeModule>(WidthSlider);
                CreateHeightAction <IMyUpgradeModule>(HeightSlider);

                CreateShuntAction <IMyUpgradeModule>(TopShield);
                CreateShuntAction <IMyUpgradeModule>(BottomShield);
                CreateShuntAction <IMyUpgradeModule>(LeftShield);
                CreateShuntAction <IMyUpgradeModule>(RightShield);
                CreateShuntAction <IMyUpgradeModule>(FrontShield);
                CreateShuntAction <IMyUpgradeModule>(BackShield);

                CreateAction <IMyUpgradeModule>(SideShunting);

                DsControl = true;
            }
            catch (Exception ex) { Log.Line($"Exception in CreateControlerUi: {ex}"); }
        }
Пример #5
0
        public static void CreateTerminalUi <T>(Session session) where T : IMyTerminalBlock
        {
            try
            {
                var obs = new HashSet <Type>();

                if (typeof(T) == typeof(IMyLargeTurretBase))
                {
                    if (!session.BaseControlsActions)
                    {
                        TerminalHelpers.AlterActions <IMyUserControllableGun>();
                        TerminalHelpers.AlterControls <IMyUserControllableGun>();
                        session.BaseControlsActions = true;
                    }

                    CreateShootClick <T>();

                    TerminalHelpers.AlterActions <T>();
                    TerminalHelpers.AlterControls <T>();

                    obs.Add(new MyObjectBuilder_LargeMissileTurret().GetType());
                    obs.Add(new MyObjectBuilder_InteriorTurret().GetType());
                    obs.Add(new MyObjectBuilder_LargeGatlingTurret().GetType());
                }
                else if (typeof(T) == typeof(IMySmallMissileLauncher) || typeof(T) == typeof(IMySmallGatlingGun))
                {
                    if (!session.BaseControlsActions)
                    {
                        TerminalHelpers.AlterActions <IMyUserControllableGun>();
                        TerminalHelpers.AlterControls <IMyUserControllableGun>();

                        session.BaseControlsActions = true;
                    }

                    CreateShootClick <T>();


                    obs.Add(new MyObjectBuilder_SmallMissileLauncher().GetType());
                    obs.Add(new MyObjectBuilder_SmallMissileLauncherReload().GetType());
                    obs.Add(new MyObjectBuilder_SmallGatlingGun().GetType());
                }
                else if (typeof(T) == typeof(IMyConveyorSorter))
                {
                    obs.Add(new MyObjectBuilder_ConveyorSorter().GetType());
                    TerminalHelpers.AlterActions <T>();
                    TerminalHelpers.AlterControls <T>();

                    CreateShootClick <T>();
                }

                TerminalHelpers.AddSlider <T>(-5, "WC_Range", "Aiming Radius", "Range", WepUi.GetRange, WepUi.SetRange, WepUi.ShowRange, WepUi.GetMinRange, WepUi.GetMaxRange);

                if (obs.Count == 0)
                {
                    return;
                }

                var wepIDs = new HashSet <int>();
                foreach (KeyValuePair <MyStringHash, WeaponStructure> wp in session.WeaponPlatforms)
                {
                    foreach (KeyValuePair <MyStringHash, WeaponSystem> ws in session.WeaponPlatforms[wp.Key].WeaponSystems)
                    {
                        MyDefinitionId   defId;
                        MyDefinitionBase def = null;

                        Type type = null;
                        if (session.ReplaceVanilla && session.VanillaCoreIds.TryGetValue(wp.Key, out defId))
                        {
                            if (!MyDefinitionManager.Static.TryGetDefinition(defId, out def))
                            {
                                return;
                            }
                            type = defId.TypeId;
                        }
                        else
                        {
                            foreach (var tmpdef in session.AllDefinitions)
                            {
                                if (tmpdef.Id.SubtypeId == wp.Key)
                                {
                                    type = tmpdef.Id.TypeId;
                                    def  = tmpdef;
                                    break;
                                }
                            }
                            if (type == null)
                            {
                                return;
                            }
                        }

                        try
                        {
                            //var ob = def.GetObjectBuilder();
                            if (obs.Contains(type))
                            {
                                var wepName   = ws.Value.WeaponName;
                                var wepIdHash = ws.Value.WeaponIdHash;

                                if (!wepIDs.Contains(wepIdHash))
                                {
                                    wepIDs.Add(wepIdHash);
                                }
                                else
                                {
                                    continue;
                                }
                                if (!ws.Value.DesignatorWeapon)
                                {
                                    CreateShootActionSet <T>(wepName, wepIdHash);

                                    if (ws.Value.WeaponAmmoTypes.Length > 1)
                                    {
                                        var c = 0;
                                        for (int i = 0; i < ws.Value.WeaponAmmoTypes.Length; i++)
                                        {
                                            if (ws.Value.WeaponAmmoTypes[i].AmmoDef.HardPointUsable)
                                            {
                                                c++;
                                            }
                                        }
                                        if (c > 1)
                                        {
                                            CreateCycleAmmoOptions <T>(wepName, wepIdHash, session.ModPath());
                                        }
                                    }
                                }
                            }
                        }
                        catch (Exception e)
                        {
                            Log.Line($"Keen Broke it: {e}");
                        }
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in CreateControlUi: {ex}"); }
        }
Пример #6
0
        public void CreateControllerElements(IMyTerminalBlock block)
        {
            try
            {
                if (DsControl)
                {
                    return;
                }
                var comp = block?.GameLogic?.GetAs <DefenseShields>();
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep0");
                ToggleShield = TerminalHelpers.AddOnOff(comp?.Shield, "DS-C_ToggleShield", "Shield Status", "Raise or Lower Shields", "Up", "Down", DsUi.GetRaiseShield, DsUi.SetRaiseShield);
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep1");
                ChargeSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_ChargeRate", "Shield Charge Rate", "Percentage Of Power The Shield May Consume", DsUi.GetRate, DsUi.SetRate);
                ChargeSlider.SetLimits(20, 95);

                if (comp != null && comp.GridIsMobile)
                {
                    TerminalHelpers.Separator(comp.Shield, "DS-C_sep2");
                }

                ExtendFit     = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_ExtendFit", "Extend Shield", "Extend Shield", DsUi.GetExtend, DsUi.SetExtend);
                SphereFit     = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_SphereFit", "Sphere Shield", "Sphere Shield", DsUi.GetSphereFit, DsUi.SetSphereFit);
                FortifyShield = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_ShieldFortify", "Fortify Shield ", "Fortify Shield ", DsUi.GetFortify, DsUi.SetFortify);
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep3");

                WidthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_WidthSlider", "Shield Size Width", "Shield Size Width", DsUi.GetWidth, DsUi.SetWidth);
                WidthSlider.SetLimits(30, 600);

                HeightSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_HeightSlider", "Shield Size Height", "Shield Size Height", DsUi.GetHeight, DsUi.SetHeight);
                HeightSlider.SetLimits(30, 600);

                DepthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_DepthSlider", "Shield Size Depth", "Shield Size Depth", DsUi.GetDepth, DsUi.SetDepth);
                DepthSlider.SetLimits(30, 600);

                OffsetWidthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetWidthSlider", "Width Offset", "Width Offset", DsUi.GetOffsetWidth, DsUi.SetOffsetWidth);
                OffsetWidthSlider.SetLimits(-69, 69);

                OffsetHeightSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetHeightSlider", "Height Offset", "Height Offset", DsUi.GetOffsetHeight, DsUi.SetOffsetHeight);
                OffsetHeightSlider.SetLimits(-69, 69);

                OffsetDepthSlider = TerminalHelpers.AddSlider(comp?.Shield, "DS-C_OffsetDepthSlider", "Depth Offset", "Depth Offset", DsUi.GetOffsetDepth, DsUi.SetOffsetDepth);
                OffsetDepthSlider.SetLimits(-69, 69);

                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep4");

                BatteryBoostCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_UseBatteries", "Batteries Contribute To Shields", "Batteries May Contribute To Shield Strength", DsUi.GetBatteries, DsUi.SetBatteries);
                SendToHudCheckBox    = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HideIcon", "Broadcast Shield Status To Hud", "Broadcast Shield Status To Nearby Friendly Huds", DsUi.GetSendToHud, DsUi.SetSendToHud);
                TerminalHelpers.Separator(comp?.Shield, "DS-C_sep5");
                ShellSelect = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_ShellSelect", "Select Shield Look", "Select shield's shell texture", DsUi.GetShell, DsUi.SetShell, DsUi.ListShell);

                ShellVisibility = TerminalHelpers.AddCombobox(comp?.Shield, "DS-C_ShellSelect", "Select Shield Visibility", "Determines when the shield is visible", DsUi.GetVisible, DsUi.SetVisible, DsUi.ListVisible);

                HideActiveCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HideActive", "Hide Shield Health On Hit  ", "Hide Shield Health Grid On Hit", DsUi.GetHideActive, DsUi.SetHideActive);

                RefreshAnimationCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_RefreshAnimation", "Show Refresh Animation  ", "Show Random Refresh Animation", DsUi.GetRefreshAnimation, DsUi.SetRefreshAnimation);
                HitWaveAnimationCheckBox = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_HitWaveAnimation", "Show Hit Wave Animation", "Show Wave Effect On Shield Damage", DsUi.GetHitWaveAnimation, DsUi.SetHitWaveAnimation);
                NoWarningSoundsCheckBox  = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_NoWarningSounds", "Disable audio warnings    ", "Supress shield audio warnings", DsUi.GetNoWarningSounds, DsUi.SetNoWarningSounds);
                DimShieldHitsCheckBox    = TerminalHelpers.AddCheckbox(comp?.Shield, "DS-C_DimShieldHits", "Dim Incoming Hit Effects ", "Supress brightness of incoming hit effects", DsUi.GetDimShieldHits, DsUi.SetDimShieldHits);
                CreateAction <IMyUpgradeModule>(ToggleShield);

                CreateActionChargeRate <IMyUpgradeModule>(ChargeSlider);

                CreateAction <IMyUpgradeModule>(ExtendFit);
                CreateAction <IMyUpgradeModule>(SphereFit);
                CreateAction <IMyUpgradeModule>(FortifyShield);

                CreateAction <IMyUpgradeModule>(HideActiveCheckBox);
                CreateAction <IMyUpgradeModule>(RefreshAnimationCheckBox);
                CreateAction <IMyUpgradeModule>(HitWaveAnimationCheckBox);
                CreateAction <IMyUpgradeModule>(SendToHudCheckBox);
                CreateAction <IMyUpgradeModule>(BatteryBoostCheckBox);
                DsControl = true;
            }
            catch (Exception ex) { Log.Line($"Exception in CreateControlerUi: {ex}"); }
        }