Skip to content

Commit

Permalink
Use HashSet for techs, remove LINQ
Browse files Browse the repository at this point in the history
  • Loading branch information
Tayrtahn committed Jun 16, 2024
1 parent 268808f commit 64f6652
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Linq;
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Popups;
Expand Down Expand Up @@ -39,15 +38,14 @@ private void OnMapInit(Entity<TechnologyDiskComponent> ent, ref MapInitEvent arg
var tier = int.Parse(weightedRandom.Pick(_random));

//get a list of every distinct recipe in all the technologies.
var techs = new List<ProtoId<LatheRecipePrototype>>();
var techs = new HashSet<ProtoId<LatheRecipePrototype>>();
foreach (var tech in _protoMan.EnumeratePrototypes<TechnologyPrototype>())
{
if (tech.Tier != tier)
continue;

techs.AddRange(tech.RecipeUnlocks);
techs.UnionWith(tech.RecipeUnlocks);
}
techs = techs.Distinct().ToList();

if (techs.Count == 0)
return;
Expand Down

0 comments on commit 64f6652

Please sign in to comment.