Change ThrowHelper methods to be extensions (#2254)

This commit is contained in:
DrSmugleaf
2020-10-14 22:41:44 +02:00
committed by GitHub
parent d9b3833577
commit e9d9618c8f
3 changed files with 6 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ namespace Content.Server.Throw
/// <param name="throwSourceEnt">
/// The entity that did the throwing. An opposite impulse will be applied to this entity if passed in.
/// </param>
public static void Throw(IEntity thrownEnt, float throwForce, EntityCoordinates targetLoc, EntityCoordinates sourceLoc, bool spread = false, IEntity throwSourceEnt = null)
public static void Throw(this IEntity thrownEnt, float throwForce, EntityCoordinates targetLoc, EntityCoordinates sourceLoc, bool spread = false, IEntity throwSourceEnt = null)
{
if (!thrownEnt.TryGetComponent(out IPhysicsComponent colComp))
return;
@@ -125,7 +125,7 @@ namespace Content.Server.Throw
/// <param name="throwSourceEnt">
/// The entity that did the throwing. An opposite impulse will be applied to this entity if passed in.
/// </param>
public static void ThrowTo(IEntity thrownEnt, float throwForceMax, EntityCoordinates targetLoc,
public static void ThrowTo(this IEntity thrownEnt, float throwForceMax, EntityCoordinates targetLoc,
EntityCoordinates sourceLoc, bool spread = false, IEntity throwSourceEnt = null)
{
var entityManager = IoCManager.Resolve<IEntityManager>();
@@ -149,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, MathF.Min(forceNecessary, throwForceMax), targetLoc, sourceLoc, spread, throwSourceEnt);
thrownEnt.Throw(MathF.Min(forceNecessary, throwForceMax), targetLoc, sourceLoc, spread, throwSourceEnt);
}
}
}