removes componentdependencies (#6160)
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Content.Server.Climbing.Components
|
||||
public class ClimbingComponent : SharedClimbingComponent
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override bool IsClimbing
|
||||
{
|
||||
@@ -73,7 +74,7 @@ namespace Content.Server.Climbing.Components
|
||||
/// </summary>
|
||||
public void TryMoveTo(Vector2 from, Vector2 to)
|
||||
{
|
||||
if (Body == null) return;
|
||||
if (!_entityManager.TryGetComponent<PhysicsComponent>(Owner, out var physicsComponent)) return;
|
||||
|
||||
var velocity = (to - from).Length;
|
||||
|
||||
@@ -82,7 +83,7 @@ namespace Content.Server.Climbing.Components
|
||||
// Since there are bodies with different masses:
|
||||
// mass * 5 seems enough to move entity
|
||||
// instead of launching cats like rockets against the walls with constant impulse value.
|
||||
Body.ApplyLinearImpulse((to - from).Normalized * velocity * Body.Mass * 5);
|
||||
physicsComponent.ApplyLinearImpulse((to - from).Normalized * velocity * physicsComponent.Mass * 5);
|
||||
OwnerIsTransitioning = true;
|
||||
|
||||
EntitySystem.Get<ClimbSystem>().UnsetTransitionBoolAfterBufferTime(Owner, this);
|
||||
|
||||
Reference in New Issue
Block a user