Removed EntityManager member variable from Components and EntitySystems (#2502)

* Removed EntityManager member variable from Components and EntitySystems

* Removed EntityManager with minor corecctions

* Update PathfindingSystem.cs

* Update InteractionSystem.cs

* Update Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs

Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>

* Update Content.Client/GameObjects/Components/Suspicion/SuspicionRoleComponent.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Client/GameObjects/Components/Suspicion/TraitorOverlay.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/Components/PDA/PDAComponent.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/Components/Singularity/SingularityComponent.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/EntitySystems/AI/Pathfinding/PathfindingSystem.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/EntitySystems/Click/ExamineSystem.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

* Update Content.Server/GameObjects/Components/Stack/StackComponent.cs

Co-authored-by: Clyybber <darkmine956@gmail.com>

Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
Co-authored-by: Clyybber <darkmine956@gmail.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
ColdAutumnRain
2020-11-18 15:45:53 +01:00
committed by GitHub
parent 87e74c4494
commit f5dc62b533
42 changed files with 66 additions and 118 deletions

View File

@@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems
{
[Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private int _nextId;
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new Dictionary<int, ConstructionGhostComponent>();
@@ -124,7 +123,7 @@ namespace Content.Client.GameObjects.EntitySystems
if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide())
return false;
var entity = _entityManager.GetEntity(args.EntityUid);
var entity = EntityManager.GetEntity(args.EntityUid);
if (!entity.TryGetComponent(out ConstructionGhostComponent ghostComp))
return false;
@@ -167,7 +166,7 @@ namespace Content.Client.GameObjects.EntitySystems
return;
}
var ghost = _entityManager.SpawnEntity("constructionghost", loc);
var ghost = EntityManager.SpawnEntity("constructionghost", loc);
var comp = ghost.GetComponent<ConstructionGhostComponent>();
comp.Prototype = prototype;
comp.GhostID = _nextId++;

View File

@@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
* It'll also handle overall cleanup when one is removed (i.e. removing it from DoAfterGui).
*/
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
/// <summary>
/// We'll use an excess time so stuff like finishing effects can show.
@@ -39,7 +38,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
private HashSet<DoAfterComponent> _knownComponents = new HashSet<DoAfterComponent>();
private IEntity? _attachedEntity;
public override void Initialize()
{
base.Initialize();
@@ -50,14 +49,14 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
_attachedEntity = message.AttachedEntity;
}
public override void Update(float frameTime)
{
base.Update(frameTime);
var currentTime = _gameTiming.CurTime;
var foundComps = new HashSet<DoAfterComponent>();
// Can't see any I guess?
if (_attachedEntity == null || _attachedEntity.Deleted)
return;
@@ -68,7 +67,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
_knownComponents.Add(comp);
}
var doAfters = comp.DoAfters.ToList();
if (doAfters.Count == 0)
@@ -88,10 +87,10 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
{
if (comp.Gui != null)
comp.Gui.FirstDraw = true;
return;
}
comp.Enable();
var userGrid = comp.Owner.Transform.Coordinates;
@@ -124,7 +123,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
if (doAfter.BreakOnTargetMove)
{
if (_entityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) && targetEntity.Transform.Coordinates != doAfter.TargetGrid)
if (EntityManager.TryGetEntity(doAfter.TargetUid, out var targetEntity) && targetEntity.Transform.Coordinates != doAfter.TargetGrid)
{
comp.Cancel(id, currentTime);
continue;
@@ -142,7 +141,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
comp.Remove(cancelled.Message);
}
}
// Remove any components that we no longer need to track
foundComps.Add(comp);
}

View File

@@ -30,7 +30,6 @@ namespace Content.Client.GameObjects.EntitySystems
public class DragDropSystem : EntitySystem
{
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@@ -137,7 +136,7 @@ namespace Content.Client.GameObjects.EntitySystems
// possibly initiating a drag
// check if the clicked entity is draggable
if (_entityManager.TryGetEntity(args.EntityUid, out var entity))
if (EntityManager.TryGetEntity(args.EntityUid, out var entity))
{
// check if the entity is reachable
if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
@@ -241,7 +240,7 @@ namespace Content.Client.GameObjects.EntitySystems
_state = DragState.Dragging;
// pop up drag shadow under mouse
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
_dragShadow = _entityManager.SpawnEntity("dragshadow", mousePos);
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
var dragSprite = _dragShadow.GetComponent<SpriteComponent>();
dragSprite.CopyFrom(draggedSprite);
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
@@ -328,7 +327,7 @@ namespace Content.Client.GameObjects.EntitySystems
RemoveHighlights();
if (_dragShadow != null)
{
_entityManager.DeleteEntity(_dragShadow);
EntityManager.DeleteEntity(_dragShadow);
}
_dragShadow = null;

View File

@@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems
{
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public const string StyleClassEntityTooltip = "entity-tooltip";
@@ -52,7 +51,7 @@ namespace Content.Client.GameObjects.EntitySystems
private bool HandleExamine(ICommonSession session, EntityCoordinates coords, EntityUid uid)
{
if (!uid.IsValid() || !_entityManager.TryGetEntity(uid, out var examined))
if (!uid.IsValid() || !EntityManager.TryGetEntity(uid, out var examined))
{
return false;
}

View File

@@ -43,7 +43,6 @@ namespace Content.Client.GameObjects.EntitySystems
public sealed class VerbSystem : SharedVerbSystem, IResettingEntitySystem
{
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
@@ -148,7 +147,7 @@ namespace Content.Client.GameObjects.EntitySystems
return false;
}
var mapCoordinates = args.Coordinates.ToMap(_entityManager);
var mapCoordinates = args.Coordinates.ToMap(EntityManager);
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities))
@@ -196,7 +195,7 @@ namespace Content.Client.GameObjects.EntitySystems
private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg)
{
if (_currentEntity != msg.Entity || !_entityManager.TryGetEntity(_currentEntity, out var entity))
if (_currentEntity != msg.Entity || !EntityManager.TryGetEntity(_currentEntity, out var entity))
{
return;
}