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:
@@ -5,6 +5,9 @@ using Robust.Server.AI;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Utility;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.AI
|
||||
{
|
||||
@@ -35,7 +38,7 @@ namespace Content.Server.AI
|
||||
{
|
||||
if(_timeMan.CurTime < _nextBark)
|
||||
return;
|
||||
|
||||
|
||||
var rngState = GenSeed();
|
||||
_nextBark = _timeMan.CurTime + MinimumDelay + TimeSpan.FromSeconds(Random01(ref rngState) * 10);
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ namespace Content.Server.AI
|
||||
if(Random01(ref rngState) < 0.5f)
|
||||
return;
|
||||
|
||||
var pick = (int) Math.Round(Random01(ref rngState) * (_normalAssistantConversation.Count - 1));
|
||||
var pick = (int) MathF.Round(Random01(ref rngState) * (_normalAssistantConversation.Count - 1));
|
||||
_chatMan.EntitySay(SelfEntity, _normalAssistantConversation[pick]);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Content.Server.Chemistry.Metabolism
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(ref _metabolismRate, "rate", ReagentUnit.New(1M));
|
||||
serializer.DataField(ref _metabolismRate, "rate", ReagentUnit.New(1.0));
|
||||
serializer.DataField(ref _nutritionFactor, "nutrimentFactor", 30.0f);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Content.Server.Chemistry.Metabolism
|
||||
hunger.UpdateFood(metabolismAmount.Float() * NutritionFactor);
|
||||
|
||||
//Return amount of reagent to be removed, remove reagent regardless of HungerComponent presence
|
||||
return metabolismAmount;
|
||||
return metabolismAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.Chemistry.ReactionEffects
|
||||
{
|
||||
@@ -35,9 +38,9 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
serializer.DataField(ref _maxScale, "maxScale", 1);
|
||||
}
|
||||
|
||||
public void React(IEntity solutionEntity, decimal intensity)
|
||||
public void React(IEntity solutionEntity, double intensity)
|
||||
{
|
||||
float floatIntensity = (float)intensity;
|
||||
float floatIntensity = (float)intensity;
|
||||
if (solutionEntity == null)
|
||||
return;
|
||||
if(!solutionEntity.TryGetComponent(out SolutionComponent solution))
|
||||
@@ -46,7 +49,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
//Handle scaling
|
||||
if (_scaled)
|
||||
{
|
||||
floatIntensity = Math.Min(floatIntensity, _maxScale);
|
||||
floatIntensity = MathF.Min(floatIntensity, _maxScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -54,10 +57,10 @@ namespace Content.Server.Chemistry.ReactionEffects
|
||||
}
|
||||
|
||||
//Calculate intensities
|
||||
int finalDevastationRange = (int)Math.Round(_devastationRange * floatIntensity);
|
||||
int finalHeavyImpactRange = (int)Math.Round(_heavyImpactRange * floatIntensity);
|
||||
int finalLightImpactRange = (int)Math.Round(_lightImpactRange * floatIntensity);
|
||||
int finalFlashRange = (int)Math.Round(_flashRange * floatIntensity);
|
||||
int finalDevastationRange = (int)MathF.Round(_devastationRange * floatIntensity);
|
||||
int finalHeavyImpactRange = (int)MathF.Round(_heavyImpactRange * floatIntensity);
|
||||
int finalLightImpactRange = (int)MathF.Round(_lightImpactRange * floatIntensity);
|
||||
int finalFlashRange = (int)MathF.Round(_flashRange * floatIntensity);
|
||||
ExplosionHelper.SpawnExplosion(solutionEntity.Transform.GridPosition, finalDevastationRange,
|
||||
finalHeavyImpactRange, finalLightImpactRange, finalFlashRange);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<Import Project="..\RobustToolbox\MSBuild\Robust.DefineConstants.targets" />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="YamlDotNet" Version="8.1.0" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Content.Server.Database\Content.Server.Database.csproj" />
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5.0M));
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5.0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -488,7 +488,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
//Trigger reaction effects
|
||||
foreach (var effect in reaction.Effects)
|
||||
{
|
||||
effect.React(Owner, unitReactions.Decimal());
|
||||
effect.React(Owner, unitReactions.Double());
|
||||
}
|
||||
|
||||
//Play reaction sound client-side
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Robust.Shared.GameObjects;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects
|
||||
{
|
||||
|
||||
@@ -21,6 +21,9 @@ using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Timer = Robust.Shared.Timers.Timer;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Mobs
|
||||
{
|
||||
|
||||
@@ -15,6 +15,9 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
{
|
||||
|
||||
@@ -12,6 +12,9 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
@@ -77,7 +80,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
EntityQuery = new TypeEntityQuery(typeof(SolarPanelComponent));
|
||||
// Initialize the sun to something random
|
||||
TowardsSun = Math.PI * 2 * _robustRandom.NextDouble();
|
||||
TowardsSun = Math.TAU * _robustRandom.NextDouble();
|
||||
SunAngularVelocity = Angle.FromDegrees(0.1 + ((_robustRandom.NextDouble() - 0.5) * 0.05));
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ namespace Content.Shared.Interfaces
|
||||
/// </summary>
|
||||
public interface IReactionEffect : IExposeData
|
||||
{
|
||||
void React(IEntity solutionEntity, decimal intensity);
|
||||
void React(IEntity solutionEntity, double intensity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,9 @@ using Robust.Shared.Physics;
|
||||
using Robust.Shared.Random;
|
||||
using System;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
using CannyFastMath;
|
||||
using Math = CannyFastMath.Math;
|
||||
using MathF = CannyFastMath.MathF;
|
||||
|
||||
namespace Content.Server.Throw
|
||||
{
|
||||
@@ -146,7 +149,7 @@ namespace Content.Server.Throw
|
||||
var forceNecessary = impulseNecessary * (1f / timing.TickRate);
|
||||
|
||||
// Then clamp it to the max force allowed and call Throw().
|
||||
Throw(thrownEnt, Math.Min(forceNecessary, throwForceMax), targetLoc, sourceLoc, spread, throwSourceEnt);
|
||||
Throw(thrownEnt, MathF.Min(forceNecessary, throwForceMax), targetLoc, sourceLoc, spread, throwSourceEnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user