diff --git a/Content.Client/Commands/ToggleOutlineCommand.cs b/Content.Client/Commands/ToggleOutlineCommand.cs new file mode 100644 index 0000000000..a96c9e40a5 --- /dev/null +++ b/Content.Client/Commands/ToggleOutlineCommand.cs @@ -0,0 +1,24 @@ +using Robust.Client.Interfaces.Console; +using Robust.Shared.Interfaces.Configuration; +using Robust.Shared.IoC; + +namespace Content.Client.Commands +{ + public class ToggleOutlineCommand : IConsoleCommand + { + public string Command => "toggleoutline"; + + public string Description => "Toggles outline drawing on entities."; + + public string Help => ""; + + public bool Execute(IDebugConsole console, params string[] args) + { + var _configurationManager = IoCManager.Resolve(); + var old = _configurationManager.GetCVar("outline.enabled"); + _configurationManager.SetCVar("outline.enabled", !old); + console.AddLine($"Draw outlines set to: {_configurationManager.GetCVar("outline.enabled")}"); + return false; + } + } +} diff --git a/Content.Client/EntryPoint.cs b/Content.Client/EntryPoint.cs index e6e5177867..9807f35a0a 100644 --- a/Content.Client/EntryPoint.cs +++ b/Content.Client/EntryPoint.cs @@ -24,6 +24,7 @@ using Robust.Client.Interfaces.Input; using Robust.Client.Interfaces.State; using Robust.Client.Player; using Robust.Shared.ContentPack; +using Robust.Shared.Interfaces.Configuration; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; using Robust.Shared.IoC; @@ -41,6 +42,7 @@ namespace Content.Client [Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner; [Dependency] private readonly IGameController _gameController; [Dependency] private readonly IStateManager _stateManager; + [Dependency] private readonly IConfigurationManager _configurationManager; #pragma warning restore 649 public override void Init() @@ -223,6 +225,8 @@ namespace Content.Client { IoCManager.Resolve().CreateNewMapEntity(MapId.Nullspace); }; + + _configurationManager.RegisterCVar("outline.enabled", true); } /// diff --git a/Content.Client/State/GameScreenBase.cs b/Content.Client/State/GameScreenBase.cs index f0496f8663..f407af9fe1 100644 --- a/Content.Client/State/GameScreenBase.cs +++ b/Content.Client/State/GameScreenBase.cs @@ -12,6 +12,7 @@ using Robust.Client.Interfaces.UserInterface; using Robust.Client.Player; using Robust.Shared.GameObjects; using Robust.Shared.Input; +using Robust.Shared.Interfaces.Configuration; using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Timing; @@ -36,6 +37,8 @@ namespace Content.Client.State [Dependency] private readonly IGameTiming _timing; [Dependency] private readonly IMapManager _mapManager; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager; + + [Dependency] private readonly IConfigurationManager _configurationManager; #pragma warning restore 649 private IEntity _lastHoveredEntity; @@ -72,6 +75,15 @@ namespace Content.Client.State } InteractionOutlineComponent outline; + if(!_configurationManager.GetCVar("outline.enabled")) + { + if(entityToClick != null && entityToClick.TryGetComponent(out outline)) + { + outline.OnMouseLeave(); //Prevent outline remains from persisting post command. + } + return; + } + if (entityToClick == _lastHoveredEntity) { if (entityToClick != null && entityToClick.TryGetComponent(out outline))