Inline HasComponent entirely
This commit is contained in:
@@ -19,7 +19,7 @@ namespace Content.Shared.Movement.Components
|
||||
if (body == null)
|
||||
entity.TryGetComponent(out body);
|
||||
|
||||
if (entity.HasComponent<MovementIgnoreGravityComponent>() ||
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<MovementIgnoreGravityComponent>(entity.Uid) ||
|
||||
(body?.BodyType & (BodyType.Static | BodyType.Kinematic)) != 0) return false;
|
||||
|
||||
var transform = entity.Transform;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Players;
|
||||
@@ -85,7 +86,7 @@ namespace Content.Shared.Movement.Components
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
if (!Owner.HasComponent<IMoverComponent>())
|
||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<IMoverComponent>(Owner.Uid))
|
||||
{
|
||||
Owner.EnsureComponentWarn<SharedPlayerInputMoverComponent>();
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Content.Shared.Movement
|
||||
protected bool UseMobMovement(PhysicsComponent body)
|
||||
{
|
||||
return body.BodyStatus == BodyStatus.OnGround &&
|
||||
body.Owner.HasComponent<MobStateComponent>() &&
|
||||
IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(body.Owner.Uid) &&
|
||||
// If we're being pulled then don't mess with our velocity.
|
||||
(!body.Owner.TryGetComponent(out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||
_blocker.CanMove(body.OwnerUid);
|
||||
|
||||
Reference in New Issue
Block a user