Change ThrowHelper methods to be extensions (#2254)
This commit is contained in:
@@ -156,7 +156,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThrowHelper.Throw(Owner, throwForce, targetLocation, sourceLocation, true);
|
Owner.Throw(throwForce, targetLocation, sourceLocation, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
newStackComp.Count = 1;
|
newStackComp.Count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThrowHelper.ThrowTo(throwEnt, ThrowForce, coords, plyEnt.Transform.Coordinates, false, plyEnt);
|
throwEnt.ThrowTo(ThrowForce, coords, plyEnt.Transform.Coordinates, false, plyEnt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -249,7 +249,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
if (!TryGetAttachedComponent(session as IPlayerSession, out HandsComponent handsComp))
|
if (!TryGetAttachedComponent(session as IPlayerSession, out HandsComponent handsComp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
handsComp.StopPull();
|
handsComp.StopPull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.Throw
|
|||||||
/// <param name="throwSourceEnt">
|
/// <param name="throwSourceEnt">
|
||||||
/// The entity that did the throwing. An opposite impulse will be applied to this entity if passed in.
|
/// The entity that did the throwing. An opposite impulse will be applied to this entity if passed in.
|
||||||
/// </param>
|
/// </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))
|
if (!thrownEnt.TryGetComponent(out IPhysicsComponent colComp))
|
||||||
return;
|
return;
|
||||||
@@ -125,7 +125,7 @@ namespace Content.Server.Throw
|
|||||||
/// <param name="throwSourceEnt">
|
/// <param name="throwSourceEnt">
|
||||||
/// The entity that did the throwing. An opposite impulse will be applied to this entity if passed in.
|
/// The entity that did the throwing. An opposite impulse will be applied to this entity if passed in.
|
||||||
/// </param>
|
/// </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)
|
EntityCoordinates sourceLoc, bool spread = false, IEntity throwSourceEnt = null)
|
||||||
{
|
{
|
||||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||||
@@ -149,7 +149,7 @@ namespace Content.Server.Throw
|
|||||||
var forceNecessary = impulseNecessary * (1f / timing.TickRate);
|
var forceNecessary = impulseNecessary * (1f / timing.TickRate);
|
||||||
|
|
||||||
// Then clamp it to the max force allowed and call Throw().
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user