Fix TryFindRandomTile grid weighting (#27724)
This commit is contained in:
@@ -57,7 +57,8 @@ namespace Content.Shared.Random.Helpers
|
||||
throw new InvalidOperationException($"Invalid weighted pick for {prototype.ID}!");
|
||||
}
|
||||
|
||||
public static string Pick(this IRobustRandom random, Dictionary<string, float> weights)
|
||||
public static T Pick<T>(this IRobustRandom random, Dictionary<T, float> weights)
|
||||
where T: notnull
|
||||
{
|
||||
var sum = weights.Values.Sum();
|
||||
var accumulated = 0f;
|
||||
@@ -74,7 +75,7 @@ namespace Content.Shared.Random.Helpers
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Invalid weighted pick");
|
||||
throw new InvalidOperationException("Invalid weighted pick");
|
||||
}
|
||||
|
||||
public static (string reagent, FixedPoint2 quantity) Pick(this WeightedRandomFillSolutionPrototype prototype, IRobustRandom? random = null)
|
||||
|
||||
Reference in New Issue
Block a user