mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-16 05:41:14 +03:00
* Remove all uses of System.Random * Use IRobustRandom in BinomialNumberSelector.Get * Remove remaining ToolRefinableSystem S.Random inst
33 lines
617 B
C#
33 lines
617 B
C#
using Robust.Shared.Random;
|
|
|
|
namespace Content.Shared.EntityTable.ValueSelector;
|
|
|
|
/// <summary>
|
|
/// Gives a constant value.
|
|
/// </summary>
|
|
public sealed partial class ConstantNumberSelector : NumberSelector
|
|
{
|
|
[DataField]
|
|
public int Value = 1;
|
|
|
|
public ConstantNumberSelector(int value)
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public override int Get(IRobustRandom rand)
|
|
{
|
|
return Value;
|
|
}
|
|
|
|
public override float Odds()
|
|
{
|
|
// You really shouldn't have a constant value of 0 ever.
|
|
return 1;
|
|
}
|
|
|
|
public override float Average()
|
|
{
|
|
return Value;
|
|
}
|
|
}
|