Skip to content

Commit

Permalink
cache goals
Browse files Browse the repository at this point in the history
  • Loading branch information
TheShuEd committed Jun 26, 2024
1 parent b2a7534 commit ae14d98
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Content.Server/Corvax/StationGoal/StationGoalPaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ private void OnRoundStarting(RoundStartingEvent ev)
var query = EntityQueryEnumerator<StationGoalComponent>();
while (query.MoveNext(out var uid, out var station))
{
var tempGoals = new List<ProtoId<StationGoalPrototype>>(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;
}

Expand Down

0 comments on commit ae14d98

Please sign in to comment.