Skip to content

Commit

Permalink
Actually fix Shift+Space
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetrith committed Nov 21, 2022
1 parent ea01191 commit 6b6ef5e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Source/Client/AsyncTime/TimeControlUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public static class TimeControlPatch
{
private static TimeVote[] GameSpeeds = { TimeVote.Paused, TimeVote.Normal, TimeVote.Fast, TimeVote.Superfast };

private static bool ShouldReset => Event.current.shift && Multiplayer.GameComp.IsLowestWins;

private static ITickable Tickable =>
!WorldRendererUtility.WorldRenderedNow && Multiplayer.GameComp.asyncTime
? Find.CurrentMap.AsyncTime()
Expand Down Expand Up @@ -78,7 +80,7 @@ private static void DoTimeControlsGUI(Rect timerRect)
483922
));

if (Widgets.ButtonInvisible(descRect, false) && Event.current.shift && Multiplayer.LocalServer != null)
if (Widgets.ButtonInvisible(descRect, false) && ShouldReset && Multiplayer.LocalServer != null)
SendTimeVote(TimeVote.Reset);
}

Expand All @@ -87,7 +89,7 @@ private static void DoTimeControlsGUI(Rect timerRect)
if (Widgets.ButtonImage(rect, TexButton.SpeedButtonTextures[(uint)speed]))
{
// todo Move the host check to the server?
if (Event.current.shift && Multiplayer.LocalServer != null)
if (ShouldReset && Multiplayer.LocalServer != null)
SendTimeVote(TimeVote.Reset);
else if (speed == TimeVote.Paused)
SendTimeVote(TogglePaused(CurTimeSpeedUI));
Expand Down Expand Up @@ -126,8 +128,8 @@ private static void DoTimeControlsGUI(Rect timerRect)

if (KeyBindingDefOf.TogglePause.KeyDownEvent)
{
SendTimeVote(Event.current.shift ? TimeVote.PlayerReset : TogglePaused(CurTimeSpeedUI));
if (Event.current.shift)
SendTimeVote(ShouldReset ? TimeVote.PlayerReset : TogglePaused(CurTimeSpeedUI));
if (ShouldReset)
prePauseTimeSpeed = null;
}

Expand Down

0 comments on commit 6b6ef5e

Please sign in to comment.