Use EntitySystem dependencies in a bunch of systems.

This commit is contained in:
Vera Aguilera Puerto
2021-07-26 12:58:17 +02:00
parent 4e93340fb0
commit 1033d8bbe5
31 changed files with 130 additions and 130 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using Content.Server.Buckle.Components;
using Content.Server.CombatMode;
using Content.Server.DoAfter;
using Content.Server.Hands.Components;
using Content.Server.Items;
using Content.Server.Pulling;
@@ -46,6 +47,7 @@ namespace Content.Server.Interaction
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
public override void Initialize()
{
@@ -175,9 +177,7 @@ namespace Content.Server.Interaction
private void InteractionActivate(IEntity user, IEntity used)
{
var actionBlocker = Get<ActionBlockerSystem>();
if (!actionBlocker.CanInteract(user) || ! actionBlocker.CanUse(user))
if (!_actionBlockerSystem.CanInteract(user) || ! _actionBlockerSystem.CanUse(user))
return;
// all activates should only fire when in range / unobstructed
@@ -275,7 +275,7 @@ namespace Content.Server.Interaction
if (!ValidateInteractAndFace(user, coordinates))
return;
if (!Get<ActionBlockerSystem>().CanInteract(user))
if (!_actionBlockerSystem.CanInteract(user))
return;
// Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null
@@ -344,7 +344,7 @@ namespace Content.Server.Interaction
if (diff.LengthSquared <= 0.01f)
return;
var diffAngle = Angle.FromWorldVec(diff);
if (Get<ActionBlockerSystem>().CanChangeDirection(user))
if (_actionBlockerSystem.CanChangeDirection(user))
{
user.Transform.WorldRotation = diffAngle;
}
@@ -394,7 +394,7 @@ namespace Content.Server.Interaction
/// </summary>
public async Task InteractUsing(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation)
{
if (!Get<ActionBlockerSystem>().CanInteract(user))
if (!_actionBlockerSystem.CanInteract(user))
return;
// all interactions should only happen when in range / unobstructed, so no range check is needed
@@ -424,7 +424,7 @@ namespace Content.Server.Interaction
/// </summary>
public void InteractHand(IEntity user, IEntity target)
{
if (!Get<ActionBlockerSystem>().CanInteract(user))
if (!_actionBlockerSystem.CanInteract(user))
return;
// all interactions should only happen when in range / unobstructed, so no range check is needed
@@ -457,7 +457,7 @@ namespace Content.Server.Interaction
/// <param name="used"></param>
public void TryUseInteraction(IEntity user, IEntity used)
{
if (user != null && used != null && Get<ActionBlockerSystem>().CanUse(user))
if (user != null && used != null && _actionBlockerSystem.CanUse(user))
{
UseInteraction(user, used);
}
@@ -501,7 +501,7 @@ namespace Content.Server.Interaction
/// </summary>
public bool TryThrowInteraction(IEntity user, IEntity item)
{
if (user == null || item == null || !Get<ActionBlockerSystem>().CanThrow(user)) return false;
if (user == null || item == null || !_actionBlockerSystem.CanThrow(user)) return false;
ThrownInteraction(user, item);
return true;
@@ -618,7 +618,7 @@ namespace Content.Server.Interaction
/// </summary>
public bool TryDroppedInteraction(IEntity user, IEntity item, bool intentional)
{
if (user == null || item == null || !Get<ActionBlockerSystem>().CanDrop(user)) return false;
if (user == null || item == null || !_actionBlockerSystem.CanDrop(user)) return false;
DroppedInteraction(user, item, intentional);
return true;
@@ -726,7 +726,7 @@ namespace Content.Server.Interaction
if (!ValidateInteractAndFace(user, coordinates))
return;
if (!Get<ActionBlockerSystem>().CanAttack(user))
if (!_actionBlockerSystem.CanAttack(user))
return;
IEntity? targetEnt = null;