From ec00d4fa0343297771d495df25721572a1e84b0b Mon Sep 17 00:00:00 2001 From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Thu, 29 Apr 2021 15:01:13 -0700 Subject: [PATCH] Use MainViewport when input is not provided a viewport (#3897) --- Content.Client/State/GameScreen.cs | 8 ++++++++ Content.Client/State/GameScreenBase.cs | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Content.Client/State/GameScreen.cs b/Content.Client/State/GameScreen.cs index 3342ec211f..a601f2210d 100644 --- a/Content.Client/State/GameScreen.cs +++ b/Content.Client/State/GameScreen.cs @@ -165,5 +165,13 @@ namespace Content.Client.State Viewport.Viewport.Eye = _eyeManager.CurrentEye; } + + protected override void OnKeyBindStateChanged(ViewportBoundKeyEventArgs args) + { + if (args.Viewport == null) + base.OnKeyBindStateChanged(new ViewportBoundKeyEventArgs(args.KeyEventArgs, Viewport.Viewport)); + else + base.OnKeyBindStateChanged(args); + } } } diff --git a/Content.Client/State/GameScreenBase.cs b/Content.Client/State/GameScreenBase.cs index 3c92760126..230e49c9d4 100644 --- a/Content.Client/State/GameScreenBase.cs +++ b/Content.Client/State/GameScreenBase.cs @@ -214,7 +214,7 @@ namespace Content.Client.State /// Converts a state change event from outside the simulation to inside the simulation. /// /// Event data values for a bound key state change. - private void OnKeyBindStateChanged(ViewportBoundKeyEventArgs args) + protected virtual void OnKeyBindStateChanged(ViewportBoundKeyEventArgs args) { // If there is no InputSystem, then there is nothing to forward to, and nothing to do here. if(!EntitySystemManager.TryGetEntitySystem(out InputSystem? inputSys))