Skip to content

Commit

Permalink
Added Ultrafast speed to TickRatePatch, changed if/else to switch (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
SokyranTheDragon authored Apr 16, 2024
1 parent 2fc3624 commit 72c3f93
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions Source/Client/AsyncTime/TickRatePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,27 @@ static bool Prefix(TickManager __instance, ref float __result)
{
if (Multiplayer.Client == null) return true;

if (__instance.CurTimeSpeed == TimeSpeed.Paused)
__result = 0;
else if (__instance.slower.ForcedNormalSpeed)
__result = 1;
else if (__instance.CurTimeSpeed == TimeSpeed.Fast)
__result = 3;
else if (__instance.CurTimeSpeed == TimeSpeed.Superfast)
__result = 6;
else
__result = 1;
switch (__instance.CurTimeSpeed, __instance.slower.ForcedNormalSpeed)
{
case (TimeSpeed.Paused, _):
__result = 0;
break;
case (_, true):
__result = 1;
break;
case (TimeSpeed.Fast, _):
__result = 3;
break;
case (TimeSpeed.Superfast, _):
__result = 6;
break;
case (TimeSpeed.Ultrafast, _):
__result = 15;
break;
default:
__result = 1;
break;
}

return false;
}
Expand Down

0 comments on commit 72c3f93

Please sign in to comment.