Skip to content

Commit

Permalink
Use a randomized seed for long events
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SokyranTheDragon committed Jun 18, 2024
1 parent 41f0131 commit 8d013a7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/Client/Patches/Seeds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d013a7

Please sign in to comment.