use CannyFastMath in various places even where it might not be any different
also update a bunch of packages clean up redundant YamlDotNet references
This commit is contained in:
@@ -10,8 +10,8 @@ namespace Content.Shared.Chemistry
|
||||
class DefaultMetabolizable : IMetabolizable
|
||||
{
|
||||
//Rate of metabolism in units / second
|
||||
private decimal _metabolismRate = 1;
|
||||
public decimal MetabolismRate => _metabolismRate;
|
||||
private double _metabolismRate = 1;
|
||||
public double MetabolismRate => _metabolismRate;
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
||||
{
|
||||
return ReagentUnit.New(MetabolismRate * (decimal)tickTime);
|
||||
return ReagentUnit.New(MetabolismRate * tickTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,6 @@ namespace Content.Shared.Chemistry
|
||||
return new ReagentUnit(value * (int) Math.Pow(10, Shift));
|
||||
}
|
||||
|
||||
public static ReagentUnit New(decimal value)
|
||||
{
|
||||
return new ReagentUnit((int) Math.Round(value * (decimal) Math.Pow(10, Shift), MidpointRounding.AwayFromZero));
|
||||
}
|
||||
|
||||
public static ReagentUnit New(float value)
|
||||
{
|
||||
return new ReagentUnit(FromFloat(value));
|
||||
@@ -42,7 +37,7 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
private static int FromFloat(float value)
|
||||
{
|
||||
return (int) Math.Round(value * (float) Math.Pow(10, Shift), MidpointRounding.AwayFromZero);
|
||||
return (int) MathF.Round(value * MathF.Pow(10, Shift), MidpointRounding.AwayFromZero);
|
||||
}
|
||||
|
||||
public static ReagentUnit New(double value)
|
||||
@@ -83,12 +78,6 @@ namespace Content.Shared.Chemistry
|
||||
return New(aD * b);
|
||||
}
|
||||
|
||||
public static ReagentUnit operator *(ReagentUnit a, decimal b)
|
||||
{
|
||||
var aD = (decimal) a.ShiftDown();
|
||||
return New(aD * b);
|
||||
}
|
||||
|
||||
public static ReagentUnit operator *(ReagentUnit a, double b)
|
||||
{
|
||||
var aD = a.ShiftDown();
|
||||
@@ -166,11 +155,6 @@ namespace Content.Shared.Chemistry
|
||||
return (float) ShiftDown();
|
||||
}
|
||||
|
||||
public decimal Decimal()
|
||||
{
|
||||
return (decimal) ShiftDown();
|
||||
}
|
||||
|
||||
public double Double()
|
||||
{
|
||||
return ShiftDown();
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Content.Shared.Chemistry
|
||||
if(quantity <= 0)
|
||||
return;
|
||||
|
||||
var ratio = (TotalVolume - quantity).Decimal() / TotalVolume.Decimal();
|
||||
var ratio = (TotalVolume - quantity).Double() / TotalVolume.Double();
|
||||
|
||||
if (ratio <= 0)
|
||||
{
|
||||
@@ -180,13 +180,13 @@ namespace Content.Shared.Chemistry
|
||||
}
|
||||
|
||||
newSolution = new Solution();
|
||||
var newTotalVolume = ReagentUnit.New(0M);
|
||||
var newTotalVolume = ReagentUnit.New(0);
|
||||
var remainingVolume = TotalVolume;
|
||||
|
||||
for (var i = 0; i < _contents.Count; i++)
|
||||
{
|
||||
var reagent = _contents[i];
|
||||
var ratio = (remainingVolume - quantity).Decimal() / remainingVolume.Decimal();
|
||||
var ratio = (remainingVolume - quantity).Double() / remainingVolume.Double();
|
||||
remainingVolume -= reagent.Quantity;
|
||||
|
||||
var newQuantity = reagent.Quantity * ratio;
|
||||
|
||||
Reference in New Issue
Block a user