From ae14d9823e120a75bdba74035984afe5463e1a3c Mon Sep 17 00:00:00 2001 From: Ed Date: Wed, 26 Jun 2024 12:25:01 +0300 Subject: [PATCH] cache goals --- .../Corvax/StationGoal/StationGoalPaperSystem.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs b/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs index e59298291d0..3cd9e9ce056 100644 --- a/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs +++ b/Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs @@ -36,16 +36,17 @@ private void OnRoundStarting(RoundStartingEvent ev) var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var station)) { + var tempGoals = new List>(station.Goals); StationGoalPrototype? selGoal = null; - while (station.Goals.Count > 0) + while (tempGoals.Count > 0) { - var goalId = _random.Pick(station.Goals); + var goalId = _random.Pick(tempGoals); var goalProto = _proto.Index(goalId); if (playerCount > goalProto.MaxPlayers || playerCount < goalProto.MinPlayers) { - station.Goals.Remove(goalId); + tempGoals.Remove(goalId); continue; }