Even more resolve removals.
This commit is contained in:
@@ -41,10 +41,11 @@ namespace Content.Shared.Actions.Behaviors.Item
|
||||
Performer = performer;
|
||||
ActionType = actionType;
|
||||
Item = item;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Item, out ItemActions))
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entMan.TryGetComponent(Item, out ItemActions))
|
||||
{
|
||||
throw new InvalidOperationException($"performer {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(performer).EntityName} tried to perform item action {actionType} " +
|
||||
$" for item {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Item).EntityName} but the item had no ItemActionsComponent," +
|
||||
throw new InvalidOperationException($"performer {entMan.GetComponent<MetaDataComponent>(performer).EntityName} tried to perform item action {actionType} " +
|
||||
$" for item {entMan.GetComponent<MetaDataComponent>(Item).EntityName} but the item had no ItemActionsComponent," +
|
||||
" which should never occur");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Content.Shared.Body.Components
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedBodyPartComponent : Component, IBodyPartContainer
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "BodyPart";
|
||||
|
||||
private SharedBodyComponent? _body;
|
||||
@@ -109,11 +111,11 @@ namespace Content.Shared.Body.Components
|
||||
public BodyPartSymmetry Symmetry { get; private set; } = BodyPartSymmetry.None;
|
||||
|
||||
[ViewVariables]
|
||||
public ISurgeryData? SurgeryDataComponent => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ISurgeryData>(Owner);
|
||||
public ISurgeryData? SurgeryDataComponent => _entMan.GetComponentOrNull<ISurgeryData>(Owner);
|
||||
|
||||
protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
|
||||
{
|
||||
var prototypeId = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID;
|
||||
var prototypeId = _entMan.GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID;
|
||||
|
||||
if (!_mechanismIds.Contains(prototypeId))
|
||||
{
|
||||
@@ -128,7 +130,7 @@ namespace Content.Shared.Body.Components
|
||||
|
||||
protected virtual void OnRemoveMechanism(SharedMechanismComponent mechanism)
|
||||
{
|
||||
_mechanismIds.Remove(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID);
|
||||
_mechanismIds.Remove(_entMan.GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID);
|
||||
mechanism.Part = null;
|
||||
SizeUsed -= mechanism.Size;
|
||||
|
||||
@@ -267,7 +269,7 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
if (RemoveMechanism(mechanism))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mechanism.Owner).Coordinates = coordinates;
|
||||
_entMan.GetComponent<TransformComponent>(mechanism.Owner).Coordinates = coordinates;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -292,34 +294,34 @@ namespace Content.Shared.Body.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(mechanism.Owner);
|
||||
_entMan.DeleteEntity(mechanism.Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddedToBody(SharedBodyComponent body)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation = 0;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).AttachParent(body.Owner);
|
||||
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = 0;
|
||||
_entMan.GetComponent<TransformComponent>(Owner).AttachParent(body.Owner);
|
||||
OnAddedToBody(body);
|
||||
|
||||
foreach (var mechanism in _mechanisms)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.Owner, new AddedToBodyEvent(body));
|
||||
_entMan.EventBus.RaiseLocalEvent(mechanism.Owner, new AddedToBodyEvent(body));
|
||||
}
|
||||
}
|
||||
|
||||
private void RemovedFromBody(SharedBodyComponent old)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Deleted)
|
||||
if (!_entMan.GetComponent<TransformComponent>(Owner).Deleted)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).AttachToGridOrMap();
|
||||
_entMan.GetComponent<TransformComponent>(Owner).AttachToGridOrMap();
|
||||
}
|
||||
|
||||
OnRemovedFromBody(old);
|
||||
|
||||
foreach (var mechanism in _mechanisms)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.Owner, new RemovedFromBodyEvent(old));
|
||||
_entMan.EventBus.RaiseLocalEvent(mechanism.Owner, new RemovedFromBodyEvent(old));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +360,7 @@ namespace Content.Shared.Body.Components
|
||||
return _mechanisms;
|
||||
}
|
||||
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
entityManager ??= _entMan;
|
||||
|
||||
var mechanisms = new List<SharedMechanismComponent>(MechanismIds.Length);
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
public abstract class SharedMechanismComponent : Component, ISerializationHooks
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Mechanism";
|
||||
|
||||
protected readonly Dictionary<int, object> OptionsCache = new();
|
||||
@@ -37,11 +39,11 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
if (old.Body == null)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new RemovedFromPartEvent(old));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new RemovedFromPartEvent(old));
|
||||
}
|
||||
else
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new RemovedFromPartInBodyEvent(old.Body, old));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new RemovedFromPartInBodyEvent(old.Body, old));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,11 +51,11 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
if (value.Body == null)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new AddedToPartEvent(value));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new AddedToPartEvent(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new AddedToPartInBodyEvent(value.Body, value));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new AddedToPartInBodyEvent(value.Body, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Content.Shared.Hands.Components
|
||||
[NetworkedComponent]
|
||||
public abstract class SharedHandsComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public sealed override string Name => "Hands";
|
||||
|
||||
public event Action? OnItemChanged; //TODO: Try to replace C# event
|
||||
@@ -96,12 +98,12 @@ namespace Content.Shared.Hands.Components
|
||||
UpdateHandVisualizer();
|
||||
Dirty();
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage { Hands = this });
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage { Hands = this });
|
||||
}
|
||||
|
||||
public void UpdateHandVisualizer()
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var entMan = _entMan;
|
||||
|
||||
if (!entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
return;
|
||||
@@ -377,7 +379,7 @@ namespace Content.Shared.Hands.Components
|
||||
if (!TryGetHand(handName, out var hand))
|
||||
return false;
|
||||
|
||||
return TryDropHeldEntity(hand, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
return TryDropHeldEntity(hand, _entMan.GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -388,7 +390,7 @@ namespace Content.Shared.Hands.Components
|
||||
if (!TryGetHandHoldingEntity(entity, out var hand))
|
||||
return false;
|
||||
|
||||
return TryDropHeldEntity(hand, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
return TryDropHeldEntity(hand, _entMan.GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -481,7 +483,7 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
EntitySystem.Get<SharedInteractionSystem>().DroppedInteraction(Owner, heldEntity);
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(heldEntity).WorldPosition = GetFinalDropCoordinates(targetDropLocation);
|
||||
_entMan.GetComponent<TransformComponent>(heldEntity).WorldPosition = GetFinalDropCoordinates(targetDropLocation);
|
||||
|
||||
OnItemChanged?.Invoke();
|
||||
}
|
||||
@@ -491,8 +493,8 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
private Vector2 GetFinalDropCoordinates(EntityCoordinates targetCoords)
|
||||
{
|
||||
var origin = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapPosition;
|
||||
var target = targetCoords.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var origin = _entMan.GetComponent<TransformComponent>(Owner).MapPosition;
|
||||
var target = targetCoords.ToMap(_entMan);
|
||||
|
||||
var dropVector = target.Position - origin.Position;
|
||||
var requestedDropDistance = dropVector.Length;
|
||||
@@ -530,7 +532,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
private void DropHeldEntityToFloor(Hand hand)
|
||||
{
|
||||
DropHeldEntity(hand, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
DropHeldEntity(hand, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
}
|
||||
|
||||
private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker)
|
||||
@@ -654,7 +656,7 @@ namespace Content.Shared.Hands.Components
|
||||
if (hand.Name == ActiveHand)
|
||||
SelectActiveHeldEntity();
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).LocalPosition = Vector2.Zero;
|
||||
_entMan.GetComponent<TransformComponent>(entity).LocalPosition = Vector2.Zero;
|
||||
|
||||
OnItemChanged?.Invoke();
|
||||
|
||||
@@ -772,7 +774,7 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
private void HandCountChanged()
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new HandCountChangedEvent(Owner));
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new HandCountChangedEvent(Owner));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -791,7 +793,7 @@ namespace Content.Shared.Hands.Components
|
||||
var entity = item.Owner;
|
||||
|
||||
if (!TryPutInActiveHandOrAny(entity, checkActionBlocker))
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
_entMan.GetComponent<TransformComponent>(entity).Coordinates = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -203,8 +203,9 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPosition = origin.ToMap(entMan);
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
|
||||
predicate, ignoreInsideBlocker);
|
||||
@@ -217,8 +218,9 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPosition = origin.ToMap(entMan);
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
|
||||
predicate, ignoreInsideBlocker);
|
||||
@@ -231,8 +233,9 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPosition = origin.ToMap(entMan);
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
|
||||
predicate, ignoreInsideBlocker);
|
||||
@@ -246,7 +249,7 @@ namespace Content.Shared.Interaction.Helpers
|
||||
bool ignoreInsideBlocker = true,
|
||||
IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
IoCManager.Resolve(ref entityManager);
|
||||
|
||||
var originPosition = origin.ToMap(entityManager);
|
||||
var otherPosition = other.ToMap(entityManager);
|
||||
@@ -263,7 +266,7 @@ namespace Content.Shared.Interaction.Helpers
|
||||
bool ignoreInsideBlocker = true,
|
||||
IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
IoCManager.Resolve(ref entityManager);
|
||||
|
||||
var originPosition = origin.ToMap(entityManager);
|
||||
|
||||
@@ -280,7 +283,8 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
|
||||
ignoreInsideBlocker);
|
||||
@@ -293,7 +297,8 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
|
||||
ignoreInsideBlocker);
|
||||
@@ -306,7 +311,8 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
|
||||
ignoreInsideBlocker);
|
||||
@@ -320,7 +326,7 @@ namespace Content.Shared.Interaction.Helpers
|
||||
bool ignoreInsideBlocker = true,
|
||||
IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
IoCManager.Resolve(ref entityManager);
|
||||
|
||||
var otherPosition = other.ToMap(entityManager);
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Content.Shared.Item
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedItemComponent : Component, IEquipped, IUnequipped, IInteractHand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Item";
|
||||
|
||||
/// <summary>
|
||||
@@ -115,10 +117,10 @@ namespace Content.Shared.Item
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(user))
|
||||
return false;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapID)
|
||||
if (_entMan.GetComponent<TransformComponent>(user).MapID != _entMan.GetComponent<TransformComponent>(Owner).MapID)
|
||||
return false;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out IPhysBody? physics) || physics.BodyType == BodyType.Static)
|
||||
if (!_entMan.TryGetComponent(Owner, out IPhysBody? physics) || physics.BodyType == BodyType.Static)
|
||||
return false;
|
||||
|
||||
return user.InRangeUnobstructed(Owner, ignoreInsideBlocker: true, popup: popup);
|
||||
@@ -141,7 +143,7 @@ namespace Content.Shared.Item
|
||||
if (!CanPickup(user))
|
||||
return false;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out SharedHandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(user, out SharedHandsComponent? hands))
|
||||
return false;
|
||||
|
||||
var activeHand = hands.ActiveHand;
|
||||
|
||||
@@ -12,14 +12,15 @@ namespace Content.Shared.Lathe
|
||||
[NetworkedComponent()]
|
||||
public class SharedLatheComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
|
||||
|
||||
public override string Name => "Lathe";
|
||||
|
||||
public bool CanProduce(LatheRecipePrototype recipe, int quantity = 1)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedMaterialStorageComponent? storage)
|
||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedLatheDatabaseComponent? database)) return false;
|
||||
if (!_entMan.TryGetComponent(Owner, out SharedMaterialStorageComponent? storage)
|
||||
|| !_entMan.TryGetComponent(Owner, out SharedLatheDatabaseComponent? database)) return false;
|
||||
|
||||
if (!database.Contains(recipe)) return false;
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Content.Shared.MobState.Components
|
||||
[NetworkedComponent]
|
||||
public class MobStateComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "MobState";
|
||||
|
||||
/// <summary>
|
||||
@@ -60,13 +62,13 @@ namespace Content.Shared.MobState.Components
|
||||
else
|
||||
{
|
||||
// Initialize with some amount of damage, defaulting to 0.
|
||||
UpdateState(IoCManager.Resolve<IEntityManager>().GetComponentOrNull<DamageableComponent>(Owner)?.TotalDamage ?? FixedPoint2.Zero);
|
||||
UpdateState(_entMan.GetComponentOrNull<DamageableComponent>(Owner)?.TotalDamage ?? FixedPoint2.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRemove()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedAlertsComponent? status))
|
||||
if (_entMan.TryGetComponent(Owner, out SharedAlertsComponent? status))
|
||||
{
|
||||
status.ClearAlert(AlertType.HumanHealth);
|
||||
}
|
||||
@@ -289,7 +291,7 @@ namespace Content.Shared.MobState.Components
|
||||
/// </summary>
|
||||
private void SetMobState(IMobState? old, (IMobState state, FixedPoint2 threshold)? current)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var entMan = _entMan;
|
||||
|
||||
if (!current.HasValue)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Content.Shared.Movement
|
||||
{
|
||||
var (walkDir, sprintDir) = mover.VelocityDir;
|
||||
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Owner);
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(mover.Owner);
|
||||
var parentRotation = transform.Parent!.WorldRotation;
|
||||
|
||||
// Regular movement.
|
||||
@@ -105,7 +105,7 @@ namespace Content.Shared.Movement
|
||||
}
|
||||
|
||||
UsedMobMovement[mover.Owner] = true;
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Owner);
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(mover.Owner);
|
||||
var weightless = mover.Owner.IsWeightless(physicsComponent, mapManager: _mapManager, entityManager: _entityManager);
|
||||
var (walkDir, sprintDir) = mover.VelocityDir;
|
||||
|
||||
@@ -164,9 +164,9 @@ namespace Content.Shared.Movement
|
||||
protected bool UseMobMovement(PhysicsComponent body)
|
||||
{
|
||||
return body.BodyStatus == BodyStatus.OnGround &&
|
||||
IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(body.Owner) &&
|
||||
EntityManager.HasComponent<MobStateComponent>(body.Owner) &&
|
||||
// If we're being pulled then don't mess with our velocity.
|
||||
(!IoCManager.Resolve<IEntityManager>().TryGetComponent(body.Owner, out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||
(!EntityManager.TryGetComponent(body.Owner, out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||
_blocker.CanMove((body).Owner);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Content.Shared.Movement
|
||||
!otherCollider.CanCollide ||
|
||||
((collider.CollisionMask & otherCollider.CollisionLayer) == 0 &&
|
||||
(otherCollider.CollisionMask & collider.CollisionLayer) == 0) ||
|
||||
(IoCManager.Resolve<IEntityManager>().TryGetComponent(otherCollider.Owner, out SharedPullableComponent? pullable) && pullable.BeingPulled))
|
||||
(EntityManager.TryGetComponent(otherCollider.Owner, out SharedPullableComponent? pullable) && pullable.BeingPulled))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Content.Shared.Storage
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedStorageComponent : Component, IDraggable
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Storage";
|
||||
|
||||
public abstract IReadOnlyList<EntityUid>? StoredEntities { get; }
|
||||
@@ -29,7 +31,7 @@ namespace Content.Shared.Storage
|
||||
|
||||
bool IDraggable.CanDrop(CanDropEvent args)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Target, out PlaceableSurfaceComponent? placeable) &&
|
||||
return _entMan.TryGetComponent(args.Target, out PlaceableSurfaceComponent? placeable) &&
|
||||
placeable.IsPlaceable;
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ namespace Content.Shared.Storage
|
||||
{
|
||||
if (Remove(storedEntity))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(storedEntity).WorldPosition = eventArgs.DropLocation.Position;
|
||||
_entMan.GetComponent<TransformComponent>(storedEntity).WorldPosition = eventArgs.DropLocation.Position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user