From ab3ab6f2307a2705c4d0cf24af6226f7e95d216f Mon Sep 17 00:00:00 2001 From: figrita Date: Fri, 3 Jul 2015 21:25:08 -0400 Subject: [PATCH] Added option to turn off rendering of target lines in the settings --- OpenRA.Game/Settings.cs | 1 + OpenRA.Game/Traits/DrawLineToTarget.cs | 3 +++ OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs | 1 + mods/cnc/chrome/settings.yaml | 7 +++++++ mods/ra/chrome/settings.yaml | 7 +++++++ 5 files changed, 19 insertions(+) diff --git a/OpenRA.Game/Settings.cs b/OpenRA.Game/Settings.cs index daa6fca16a..46534a95be 100644 --- a/OpenRA.Game/Settings.cs +++ b/OpenRA.Game/Settings.cs @@ -140,6 +140,7 @@ namespace OpenRA public bool UseClassicMouseStyle = false; public bool AlwaysShowStatusBars = false; public bool TeamHealthColors = false; + public bool DrawTargetLine = true; public bool AllowDownloading = true; public string MapRepository = "http://resource.openra.net/map/"; diff --git a/OpenRA.Game/Traits/DrawLineToTarget.cs b/OpenRA.Game/Traits/DrawLineToTarget.cs index e0923acede..0e4f4cac51 100644 --- a/OpenRA.Game/Traits/DrawLineToTarget.cs +++ b/OpenRA.Game/Traits/DrawLineToTarget.cs @@ -64,6 +64,9 @@ namespace OpenRA.Traits if ((lifetime <= 0 || --lifetime <= 0) && !force) yield break; + if (!(force || Game.Settings.Game.DrawTargetLine)) + yield break; + if (targets == null || targets.Count == 0) yield break; diff --git a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs index 6a7412acc1..cac73c3b91 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/SettingsLogic.cs @@ -154,6 +154,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic BindCheckboxPref(panel, "FRAME_LIMIT_CHECKBOX", ds, "CapFramerate"); BindCheckboxPref(panel, "SHOW_SHELLMAP", gs, "ShowShellmap"); BindCheckboxPref(panel, "ALWAYS_SHOW_STATUS_BARS_CHECKBOX", gs, "AlwaysShowStatusBars"); + BindCheckboxPref(panel, "DISPLAY_TARGET_LINES_CHECKBOX", gs, "DrawTargetLine"); BindCheckboxPref(panel, "TEAM_HEALTH_COLORS_CHECKBOX", gs, "TeamHealthColors"); var languageDropDownButton = panel.Get("LANGUAGE_DROPDOWNBUTTON"); diff --git a/mods/cnc/chrome/settings.yaml b/mods/cnc/chrome/settings.yaml index 5da00aea63..dcc212fe86 100644 --- a/mods/cnc/chrome/settings.yaml +++ b/mods/cnc/chrome/settings.yaml @@ -190,6 +190,13 @@ Container@SETTINGS_PANEL: Height: 20 Font: Regular Text: Always Show Status Bars + Checkbox@DISPLAY_TARGET_LINES_CHECKBOX: + X: 310 + Y: 245 + Width: 200 + Height: 20 + Font: Regular + Text: Display Target Lines Label@LOCALIZATION_TITLE: Y: 265 Width: PARENT_RIGHT diff --git a/mods/ra/chrome/settings.yaml b/mods/ra/chrome/settings.yaml index 3b994fd5cc..f01ec21ede 100644 --- a/mods/ra/chrome/settings.yaml +++ b/mods/ra/chrome/settings.yaml @@ -203,6 +203,13 @@ Background@SETTINGS_PANEL: Height: 20 Font: Regular Text: Always Show Status Bars + Checkbox@DISPLAY_TARGET_LINES_CHECKBOX: + X: 310 + Y: 265 + Width: 200 + Height: 20 + Font: Regular + Text: Display Target Lines Label@LOCALIZATION_TITLE: Y: 270 Width: PARENT_RIGHT