Skip to content

Commit adc9d8b

Browse files
committed
Changes suggested by Sokyran #508
Discord messages Sokyran: I think that Find.CurrentMap == null check could be skipped here if you change WorldRendererUtility.WorldRenderedNow to WorldRendererUtility.WorldSelected. At least the null CurrentMap check wasn't needed before. https://github.com/Tick-git/Multiplayer/blob/03f6d2b7e1c704563810abe74d6df538738c7926/Source/Client/AsyncTime/AsyncTimePatches.cs#L149-L150 Is 2 constructors needed here? The second one already includes the default value of 0, so in that they already match what they do. https://github.com/Tick-git/Multiplayer/blob/03f6d2b7e1c704563810abe74d6df538738c7926/Source/Client/AsyncTime/AsyncTimeComp.cs#L101-L111
1 parent e65617a commit adc9d8b

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

Source/Client/AsyncTime/AsyncTimeComp.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ public int GameStartAbsTick
9898

9999
public Queue<ScheduledCommand> cmds = new();
100100

101-
public AsyncTimeComp(Map map)
102-
{
103-
this.map = map;
104-
this.gameStartAbsTickMap = 0;
105-
}
106-
107101
public AsyncTimeComp(Map map, int gameStartAbsTick = 0)
108102
{
109103
this.map = map;

Source/Client/AsyncTime/AsyncTimePatches.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ static void Postfix(ref bool __result)
147147
{
148148
if (Multiplayer.Client == null) return;
149149
if (WorldRendererUtility.WorldRenderedNow) return;
150-
if (Find.CurrentMap == null) return;
151150

152151
var asyncTime = Find.CurrentMap.AsyncTime();
153152
var timeSpeed = Multiplayer.IsReplay ? TickPatch.replayTimeSpeed : asyncTime.DesiredTimeSpeed;

Source/Client/Saving/SavingPatches.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static void Postfix(Map __instance)
104104

105105
if (Scribe.mode == LoadSaveMode.LoadingVars || Scribe.mode == LoadSaveMode.Saving)
106106
{
107-
Scribe_Deep.Look(ref asyncTime, "mpAsyncTime", __instance);
107+
Scribe_Deep.Look(ref asyncTime, "mpAsyncTime", __instance, 0);
108108
Scribe_Deep.Look(ref comp, "mpMapComp", __instance);
109109
}
110110

@@ -114,7 +114,7 @@ static void Postfix(Map __instance)
114114
{
115115
Log.Error($"{typeof(AsyncTimeComp)} missing during loading");
116116
// This is just so the game doesn't completely freeze
117-
asyncTime = new AsyncTimeComp(__instance);
117+
asyncTime = new AsyncTimeComp(__instance, 0);
118118
}
119119

120120
Multiplayer.game.asyncTimeComps.Add(asyncTime);

0 commit comments

Comments
 (0)