From 8d013a705a2fb549afe460811d8e293e09ee40d4 Mon Sep 17 00:00:00 2001 From: SokyranTheDragon Date: Tue, 18 Jun 2024 20:52:42 +0200 Subject: [PATCH] Use a randomized seed for long events Previously, we've used a constant seed for long events. This change will replace it with a randomized seed which is selected whenever a long event is queued. This should allow for more randomness in long events, and is required by the labyrinth map generation to produce unique maps, instead of only having a single possible layout. --- Source/Client/Patches/Seeds.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Client/Patches/Seeds.cs b/Source/Client/Patches/Seeds.cs index d4301500..cef7d7d3 100644 --- a/Source/Client/Patches/Seeds.cs +++ b/Source/Client/Patches/Seeds.cs @@ -98,11 +98,12 @@ static void Prefix(ref Action action) { if (Multiplayer.Client != null && (Multiplayer.Ticking || Multiplayer.ExecutingCmds)) { - action = PushState + action + Rand.PopState; + var seed = Rand.Int; + action = (() => PushState(seed)) + action + Rand.PopState; } } - static void PushState() => Rand.PushState(4); + static void PushState(int seed) => Rand.PushState(seed); } // Seed the rotation random