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:
@@ -25,8 +25,6 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class ClientStorageComponent : SharedStorageComponent, IDraggable
|
public class ClientStorageComponent : SharedStorageComponent, IDraggable
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private List<IEntity> _storedEntities = new List<IEntity>();
|
private List<IEntity> _storedEntities = new List<IEntity>();
|
||||||
private int StorageSizeUsed;
|
private int StorageSizeUsed;
|
||||||
private int StorageCapacityMax;
|
private int StorageCapacityMax;
|
||||||
@@ -58,7 +56,7 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
}
|
}
|
||||||
|
|
||||||
_storedEntities = state.StoredEntities
|
_storedEntities = state.StoredEntities
|
||||||
.Select(id => _entityManager.GetEntity(id))
|
.Select(id => Owner.EntityManager.GetEntity(id))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,7 +86,7 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
/// <param name="storageState"></param>
|
/// <param name="storageState"></param>
|
||||||
private void HandleStorageMessage(StorageHeldItemsMessage storageState)
|
private void HandleStorageMessage(StorageHeldItemsMessage storageState)
|
||||||
{
|
{
|
||||||
_storedEntities = storageState.StoredEntities.Select(id => _entityManager.GetEntity(id)).ToList();
|
_storedEntities = storageState.StoredEntities.Select(id => Owner.EntityManager.GetEntity(id)).ToList();
|
||||||
StorageSizeUsed = storageState.StorageSizeUsed;
|
StorageSizeUsed = storageState.StorageSizeUsed;
|
||||||
StorageCapacityMax = storageState.StorageSizeMax;
|
StorageCapacityMax = storageState.StorageSizeMax;
|
||||||
Window.BuildEntityList();
|
Window.BuildEntityList();
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
|||||||
public class SuspicionRoleComponent : SharedSuspicionRoleComponent
|
public class SuspicionRoleComponent : SharedSuspicionRoleComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
||||||
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
@@ -107,7 +106,7 @@ namespace Content.Client.GameObjects.Components.Suspicion
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var overlay = new TraitorOverlay(Owner, _entityManager, _resourceCache, _eyeManager);
|
var overlay = new TraitorOverlay(Owner, Owner.EntityManager, _resourceCache, _eyeManager);
|
||||||
_overlayManager.AddOverlay(overlay);
|
_overlayManager.AddOverlay(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private int _nextId;
|
private int _nextId;
|
||||||
private readonly Dictionary<int, ConstructionGhostComponent> _ghosts = new Dictionary<int, ConstructionGhostComponent>();
|
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())
|
if (!args.EntityUid.IsValid() || !args.EntityUid.IsClientSide())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var entity = _entityManager.GetEntity(args.EntityUid);
|
var entity = EntityManager.GetEntity(args.EntityUid);
|
||||||
|
|
||||||
if (!entity.TryGetComponent(out ConstructionGhostComponent ghostComp))
|
if (!entity.TryGetComponent(out ConstructionGhostComponent ghostComp))
|
||||||
return false;
|
return false;
|
||||||
@@ -167,7 +166,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ghost = _entityManager.SpawnEntity("constructionghost", loc);
|
var ghost = EntityManager.SpawnEntity("constructionghost", loc);
|
||||||
var comp = ghost.GetComponent<ConstructionGhostComponent>();
|
var comp = ghost.GetComponent<ConstructionGhostComponent>();
|
||||||
comp.Prototype = prototype;
|
comp.Prototype = prototype;
|
||||||
comp.GhostID = _nextId++;
|
comp.GhostID = _nextId++;
|
||||||
|
|||||||
@@ -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).
|
* 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 IGameTiming _gameTiming = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// We'll use an excess time so stuff like finishing effects can show.
|
/// 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 HashSet<DoAfterComponent> _knownComponents = new HashSet<DoAfterComponent>();
|
||||||
|
|
||||||
private IEntity? _attachedEntity;
|
private IEntity? _attachedEntity;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -50,14 +49,14 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
{
|
{
|
||||||
_attachedEntity = message.AttachedEntity;
|
_attachedEntity = message.AttachedEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
base.Update(frameTime);
|
base.Update(frameTime);
|
||||||
|
|
||||||
var currentTime = _gameTiming.CurTime;
|
var currentTime = _gameTiming.CurTime;
|
||||||
var foundComps = new HashSet<DoAfterComponent>();
|
var foundComps = new HashSet<DoAfterComponent>();
|
||||||
|
|
||||||
// Can't see any I guess?
|
// Can't see any I guess?
|
||||||
if (_attachedEntity == null || _attachedEntity.Deleted)
|
if (_attachedEntity == null || _attachedEntity.Deleted)
|
||||||
return;
|
return;
|
||||||
@@ -68,7 +67,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
{
|
{
|
||||||
_knownComponents.Add(comp);
|
_knownComponents.Add(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
var doAfters = comp.DoAfters.ToList();
|
var doAfters = comp.DoAfters.ToList();
|
||||||
|
|
||||||
if (doAfters.Count == 0)
|
if (doAfters.Count == 0)
|
||||||
@@ -88,10 +87,10 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
{
|
{
|
||||||
if (comp.Gui != null)
|
if (comp.Gui != null)
|
||||||
comp.Gui.FirstDraw = true;
|
comp.Gui.FirstDraw = true;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
comp.Enable();
|
comp.Enable();
|
||||||
|
|
||||||
var userGrid = comp.Owner.Transform.Coordinates;
|
var userGrid = comp.Owner.Transform.Coordinates;
|
||||||
@@ -124,7 +123,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
|
|
||||||
if (doAfter.BreakOnTargetMove)
|
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);
|
comp.Cancel(id, currentTime);
|
||||||
continue;
|
continue;
|
||||||
@@ -142,7 +141,7 @@ namespace Content.Client.GameObjects.EntitySystems.DoAfter
|
|||||||
comp.Remove(cancelled.Message);
|
comp.Remove(cancelled.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any components that we no longer need to track
|
// Remove any components that we no longer need to track
|
||||||
foundComps.Add(comp);
|
foundComps.Add(comp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
public class DragDropSystem : EntitySystem
|
public class DragDropSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
@@ -137,7 +136,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
|
|
||||||
// possibly initiating a drag
|
// possibly initiating a drag
|
||||||
// check if the clicked entity is draggable
|
// 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
|
// check if the entity is reachable
|
||||||
if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
|
if (!_interactionSystem.InRangeUnobstructed(dragger, entity))
|
||||||
@@ -241,7 +240,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
_state = DragState.Dragging;
|
_state = DragState.Dragging;
|
||||||
// pop up drag shadow under mouse
|
// pop up drag shadow under mouse
|
||||||
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
var mousePos = _eyeManager.ScreenToMap(_inputManager.MouseScreenPosition);
|
||||||
_dragShadow = _entityManager.SpawnEntity("dragshadow", mousePos);
|
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
||||||
var dragSprite = _dragShadow.GetComponent<SpriteComponent>();
|
var dragSprite = _dragShadow.GetComponent<SpriteComponent>();
|
||||||
dragSprite.CopyFrom(draggedSprite);
|
dragSprite.CopyFrom(draggedSprite);
|
||||||
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
||||||
@@ -328,7 +327,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
RemoveHighlights();
|
RemoveHighlights();
|
||||||
if (_dragShadow != null)
|
if (_dragShadow != null)
|
||||||
{
|
{
|
||||||
_entityManager.DeleteEntity(_dragShadow);
|
EntityManager.DeleteEntity(_dragShadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
_dragShadow = null;
|
_dragShadow = null;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
public const string StyleClassEntityTooltip = "entity-tooltip";
|
public const string StyleClassEntityTooltip = "entity-tooltip";
|
||||||
@@ -52,7 +51,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
|
|
||||||
private bool HandleExamine(ICommonSession session, EntityCoordinates coords, EntityUid uid)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
public sealed class VerbSystem : SharedVerbSystem, IResettingEntitySystem
|
public sealed class VerbSystem : SharedVerbSystem, IResettingEntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||||
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
|
[Dependency] private readonly IItemSlotManager _itemSlotManager = default!;
|
||||||
@@ -148,7 +147,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapCoordinates = args.Coordinates.ToMap(_entityManager);
|
var mapCoordinates = args.Coordinates.ToMap(EntityManager);
|
||||||
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
var playerEntity = _playerManager.LocalPlayer?.ControlledEntity;
|
||||||
|
|
||||||
if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities))
|
if (playerEntity == null || !TryGetContextEntities(playerEntity, mapCoordinates, out var entities))
|
||||||
@@ -196,7 +195,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
|
|
||||||
private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class FlammableComponent : SharedFlammableComponent, ICollideBehavior, IFireAct, IReagentReaction
|
public class FlammableComponent : SharedFlammableComponent, ICollideBehavior, IFireAct, IReagentReaction
|
||||||
{
|
{
|
||||||
[Dependency] private IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private bool _resisting = false;
|
private bool _resisting = false;
|
||||||
private readonly List<EntityUid> _collided = new List<EntityUid>();
|
private readonly List<EntityUid> _collided = new List<EntityUid>();
|
||||||
|
|
||||||
@@ -137,13 +135,13 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
foreach (var uid in _collided.ToArray())
|
foreach (var uid in _collided.ToArray())
|
||||||
{
|
{
|
||||||
if (!uid.IsValid() || !_entityManager.EntityExists(uid))
|
if (!uid.IsValid() || !Owner.EntityManager.EntityExists(uid))
|
||||||
{
|
{
|
||||||
_collided.Remove(uid);
|
_collided.Remove(uid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = _entityManager.GetEntity(uid);
|
var entity = Owner.EntityManager.GetEntity(uid);
|
||||||
var physics = Owner.GetComponent<IPhysicsComponent>();
|
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||||
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse
|
public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private GasAnalyzerDanger _pressureDanger;
|
private GasAnalyzerDanger _pressureDanger;
|
||||||
private float _timeSinceSync;
|
private float _timeSinceSync;
|
||||||
private const float TimeBetweenSyncs = 2f;
|
private const float TimeBetweenSyncs = 2f;
|
||||||
@@ -183,14 +181,14 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
if (!_checkPlayer && _position.HasValue)
|
if (!_checkPlayer && _position.HasValue)
|
||||||
{
|
{
|
||||||
// Check if position is out of range => don't update
|
// Check if position is out of range => don't update
|
||||||
if (!_position.Value.InRange(_entityManager, pos, SharedInteractionSystem.InteractionRange))
|
if (!_position.Value.InRange(Owner.EntityManager, pos, SharedInteractionSystem.InteractionRange))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pos = _position.Value;
|
pos = _position.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
var atmosSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||||
var gam = atmosSystem.GetGridAtmosphere(pos.GetGridId(_entityManager));
|
var gam = atmosSystem.GetGridAtmosphere(pos.GetGridId(Owner.EntityManager));
|
||||||
var tile = gam?.GetTile(pos).Air;
|
var tile = gam?.GetTile(pos).Air;
|
||||||
if (tile == null)
|
if (tile == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseSiphonComponent : PipeNetDeviceComponent
|
public abstract class BaseSiphonComponent : PipeNetDeviceComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private PipeNode _scrubberOutlet;
|
private PipeNode _scrubberOutlet;
|
||||||
@@ -65,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
|||||||
if (!SiphonEnabled)
|
if (!SiphonEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
|
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(Owner.EntityManager);
|
||||||
if (tileAtmos == null)
|
if (tileAtmos == null)
|
||||||
return;
|
return;
|
||||||
ScrubGas(tileAtmos.Air, _scrubberOutlet.Air);
|
ScrubGas(tileAtmos.Air, _scrubberOutlet.Air);
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class BaseVentComponent : PipeNetDeviceComponent
|
public abstract class BaseVentComponent : PipeNetDeviceComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private PipeNode _ventInlet;
|
private PipeNode _ventInlet;
|
||||||
@@ -65,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
|||||||
if (!VentEnabled)
|
if (!VentEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
|
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(Owner.EntityManager);
|
||||||
if (tileAtmos == null)
|
if (tileAtmos == null)
|
||||||
return;
|
return;
|
||||||
VentGas(_ventInlet.Air, tileAtmos.Air);
|
VentGas(_ventInlet.Air, tileAtmos.Air);
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
public class ConstructionComponent : Component, IExamine, IInteractUsing
|
public class ConstructionComponent : Component, IExamine, IInteractUsing
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Construction";
|
public override string Name => "Construction";
|
||||||
|
|
||||||
@@ -392,7 +391,7 @@ namespace Content.Server.GameObjects.Components.Construction
|
|||||||
{
|
{
|
||||||
if (node.Entity == Owner.Prototype?.ID || string.IsNullOrEmpty(node.Entity)) return false;
|
if (node.Entity == Owner.Prototype?.ID || string.IsNullOrEmpty(node.Entity)) return false;
|
||||||
|
|
||||||
var entity = _entityManager.SpawnEntity(node.Entity, Owner.Transform.Coordinates);
|
var entity = Owner.EntityManager.SpawnEntity(node.Entity, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
entity.Transform.LocalRotation = Owner.Transform.LocalRotation;
|
entity.Transform.LocalRotation = Owner.Transform.LocalRotation;
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,6 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
|
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Puddle";
|
public override string Name => "Puddle";
|
||||||
|
|
||||||
private CancellationTokenSource _evaporationToken;
|
private CancellationTokenSource _evaporationToken;
|
||||||
@@ -399,7 +397,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
|||||||
if (puddle == default)
|
if (puddle == default)
|
||||||
{
|
{
|
||||||
var grid = _snapGrid.DirectionToGrid(direction);
|
var grid = _snapGrid.DirectionToGrid(direction);
|
||||||
puddle = () => _entityManager.SpawnEntity(Owner.Prototype.ID, grid).GetComponent<PuddleComponent>();
|
puddle = () => Owner.EntityManager.SpawnEntity(Owner.Prototype.ID, grid).GetComponent<PuddleComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class CursedEntityStorageComponent : EntityStorageComponent
|
public class CursedEntityStorageComponent : EntityStorageComponent
|
||||||
{
|
{
|
||||||
[Dependency] private IEntityManager _entityManager = default!;
|
[Dependency] private IRobustRandom _robustRandom = default!;
|
||||||
[Dependency] private IRobustRandom _robustRandom = default!;
|
|
||||||
|
|
||||||
public override string Name => "CursedEntityStorage";
|
public override string Name => "CursedEntityStorage";
|
||||||
|
|
||||||
@@ -29,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
// No contents, we do nothing
|
// No contents, we do nothing
|
||||||
if (Contents.ContainedEntities.Count == 0) return;
|
if (Contents.ContainedEntities.Count == 0) return;
|
||||||
|
|
||||||
var lockers = _entityManager.GetEntities(new TypeEntityQuery(typeof(EntityStorageComponent))).ToList();
|
var lockers = Owner.EntityManager.GetEntities(new TypeEntityQuery(typeof(EntityStorageComponent))).ToList();
|
||||||
|
|
||||||
if (lockers.Contains(Owner))
|
if (lockers.Contains(Owner))
|
||||||
lockers.Remove(Owner);
|
lockers.Remove(Owner);
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
[ComponentReference(typeof(IStorageComponent))]
|
[ComponentReference(typeof(IStorageComponent))]
|
||||||
public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct
|
public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private const string LoggerName = "Storage";
|
private const string LoggerName = "Storage";
|
||||||
|
|
||||||
private Container? _storage;
|
private Container? _storage;
|
||||||
@@ -361,14 +359,14 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
|||||||
var ownerTransform = Owner.Transform;
|
var ownerTransform = Owner.Transform;
|
||||||
var playerTransform = player.Transform;
|
var playerTransform = player.Transform;
|
||||||
|
|
||||||
if (!playerTransform.Coordinates.InRange(_entityManager, ownerTransform.Coordinates, 2) ||
|
if (!playerTransform.Coordinates.InRange(Owner.EntityManager, ownerTransform.Coordinates, 2) ||
|
||||||
!ownerTransform.IsMapTransform &&
|
!ownerTransform.IsMapTransform &&
|
||||||
!playerTransform.ContainsEntity(ownerTransform))
|
!playerTransform.ContainsEntity(ownerTransform))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = _entityManager.GetEntity(remove.EntityUid);
|
var entity = Owner.EntityManager.GetEntity(remove.EntityUid);
|
||||||
|
|
||||||
if (entity == null || _storage?.Contains(entity) == false)
|
if (entity == null || _storage?.Contains(entity) == false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
public class MicrowaveComponent : SharedMicrowaveComponent, IActivate, IInteractUsing, ISolutionChange, ISuicideAct
|
public class MicrowaveComponent : SharedMicrowaveComponent, IActivate, IInteractUsing, ISolutionChange, ISuicideAct
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly RecipeManager _recipeManager = default!;
|
[Dependency] private readonly RecipeManager _recipeManager = default!;
|
||||||
|
|
||||||
#region YAMLSERIALIZE
|
#region YAMLSERIALIZE
|
||||||
@@ -340,7 +339,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
if (recipeToCook != null)
|
if (recipeToCook != null)
|
||||||
{
|
{
|
||||||
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
|
var entityToSpawn = goodMeal ? recipeToCook.Result : _badRecipeName;
|
||||||
_entityManager.SpawnEntity(entityToSpawn, Owner.Transform.Coordinates);
|
Owner.EntityManager.SpawnEntity(entityToSpawn, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
|
_audioSystem.PlayFromEntity(_cookingCompleteSound, Owner, AudioParams.Default.WithVolume(-1f));
|
||||||
@@ -391,9 +390,9 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
|||||||
|
|
||||||
private void EjectSolid(EntityUid entityID)
|
private void EjectSolid(EntityUid entityID)
|
||||||
{
|
{
|
||||||
if (_entityManager.EntityExists(entityID))
|
if (Owner.EntityManager.EntityExists(entityID))
|
||||||
{
|
{
|
||||||
_storage.Remove(_entityManager.GetEntity(entityID));
|
_storage.Remove(Owner.EntityManager.GetEntity(entityID));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ namespace Content.Server.GameObjects.Components.MachineLinking
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class SignalTransmitterComponent : Component, IInteractUsing
|
public class SignalTransmitterComponent : Component, IInteractUsing
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "SignalTransmitter";
|
public override string Name => "SignalTransmitter";
|
||||||
|
|
||||||
private List<SignalReceiverComponent> _unresolvedReceivers;
|
private List<SignalReceiverComponent> _unresolvedReceivers;
|
||||||
@@ -62,7 +60,7 @@ namespace Content.Server.GameObjects.Components.MachineLinking
|
|||||||
_unresolvedReceivers = new List<SignalReceiverComponent>();
|
_unresolvedReceivers = new List<SignalReceiverComponent>();
|
||||||
foreach (var entityUid in entityUids)
|
foreach (var entityUid in entityUids)
|
||||||
{
|
{
|
||||||
if (!_entityManager.TryGetEntity(entityUid, out var entity)
|
if (!Owner.EntityManager.TryGetEntity(entityUid, out var entity)
|
||||||
|| !entity.TryGetComponent<SignalReceiverComponent>(out var receiver))
|
|| !entity.TryGetComponent<SignalReceiverComponent>(out var receiver))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
||||||
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
|
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
public override string Name => "ConditionalSpawner";
|
public override string Name => "ConditionalSpawner";
|
||||||
@@ -87,7 +86,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!Owner.Deleted)
|
if(!Owner.Deleted)
|
||||||
_entityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void MapInit()
|
public virtual void MapInit()
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class TimedSpawnerComponent : Component
|
public class TimedSpawnerComponent : Component
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
public override string Name => "TimedSpawner";
|
public override string Name => "TimedSpawner";
|
||||||
@@ -81,7 +80,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
for (int i = 0; i < number; i++)
|
for (int i = 0; i < number; i++)
|
||||||
{
|
{
|
||||||
var entity = _robustRandom.Pick(Prototypes);
|
var entity = _robustRandom.Pick(Prototypes);
|
||||||
_entityManager.SpawnEntity(entity, Owner.Transform.Coordinates);
|
Owner.EntityManager.SpawnEntity(entity, Owner.Transform.Coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class TrashSpawnerComponent : ConditionalSpawnerComponent
|
public class TrashSpawnerComponent : ConditionalSpawnerComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
public override string Name => "TrashSpawner";
|
public override string Name => "TrashSpawner";
|
||||||
@@ -42,7 +41,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
{
|
{
|
||||||
if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance)))
|
if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance)))
|
||||||
{
|
{
|
||||||
_entityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
|
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
|||||||
var x_negative = random.Prob(0.5f) ? -1 : 1;
|
var x_negative = random.Prob(0.5f) ? -1 : 1;
|
||||||
var y_negative = random.Prob(0.5f) ? -1 : 1;
|
var y_negative = random.Prob(0.5f) ? -1 : 1;
|
||||||
|
|
||||||
var entity = _entityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
var entity = Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
||||||
entity.Transform.LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative);
|
entity.Transform.LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
public class CloningPodComponent : SharedCloningPodComponent, IActivate
|
public class CloningPodComponent : SharedCloningPodComponent, IActivate
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IServerPreferencesManager _prefsManager = null!;
|
[Dependency] private readonly IServerPreferencesManager _prefsManager = null!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = null!;
|
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = null!;
|
[Dependency] private readonly IPlayerManager _playerManager = null!;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
@@ -169,7 +168,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
|||||||
if (!dead) return;
|
if (!dead) return;
|
||||||
|
|
||||||
|
|
||||||
var mob = _entityManager.SpawnEntity("HumanMob_Content", Owner.Transform.MapPosition);
|
var mob = Owner.EntityManager.SpawnEntity("HumanMob_Content", Owner.Transform.MapPosition);
|
||||||
var client = _playerManager.GetSessionByUserId(mind.UserId!.Value);
|
var client = _playerManager.GetSessionByUserId(mind.UserId!.Value);
|
||||||
var profile = GetPlayerProfileAsync(client.UserId);
|
var profile = GetPlayerProfileAsync(client.UserId);
|
||||||
mob.GetComponent<HumanoidAppearanceComponent>().UpdateFromProfile(profile);
|
mob.GetComponent<HumanoidAppearanceComponent>().UpdateFromProfile(profile);
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Metabolism
|
|||||||
public class MetabolismComponent : Component
|
public class MetabolismComponent : Component
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
[ComponentDependency] private readonly IBody? _body = default!;
|
[ComponentDependency] private readonly IBody? _body = default!;
|
||||||
|
|
||||||
@@ -294,7 +293,7 @@ namespace Content.Server.GameObjects.Components.Metabolism
|
|||||||
}
|
}
|
||||||
|
|
||||||
// creadth: sweating does not help in airless environment
|
// creadth: sweating does not help in airless environment
|
||||||
if (Owner.Transform.Coordinates.TryGetTileAir(out _, _entityManager))
|
if (Owner.Transform.Coordinates.TryGetTileAir(out _, Owner.EntityManager))
|
||||||
{
|
{
|
||||||
temperatureComponent.RemoveHeat(Math.Min(targetHeat, SweatHeatRegulation));
|
temperatureComponent.RemoveHeat(Math.Min(targetHeat, SweatHeatRegulation));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
internal class ShuttleControllerComponent : Component, IMoverComponent
|
internal class ShuttleControllerComponent : Component, IMoverComponent
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private bool _movingUp;
|
private bool _movingUp;
|
||||||
private bool _movingDown;
|
private bool _movingDown;
|
||||||
@@ -67,7 +66,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
|||||||
var gridId = Owner.Transform.GridID;
|
var gridId = Owner.Transform.GridID;
|
||||||
|
|
||||||
if (_mapManager.TryGetGrid(gridId, out var grid) &&
|
if (_mapManager.TryGetGrid(gridId, out var grid) &&
|
||||||
_entityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
Owner.EntityManager.TryGetEntity(grid.GridEntityId, out var gridEntity))
|
||||||
{
|
{
|
||||||
//TODO: Switch to shuttle component
|
//TODO: Switch to shuttle component
|
||||||
if (!gridEntity.TryGetComponent(out IPhysicsComponent? physics))
|
if (!gridEntity.TryGetComponent(out IPhysicsComponent? physics))
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
public sealed class FoodContainer : SharedFoodContainerComponent, IUse
|
public sealed class FoodContainer : SharedFoodContainerComponent, IUse
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IRobustRandom _random = default!;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "FoodContainer";
|
public override string Name => "FoodContainer";
|
||||||
|
|
||||||
private AppearanceComponent _appearance;
|
private AppearanceComponent _appearance;
|
||||||
@@ -60,7 +58,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemToSpawn = _entityManager.SpawnEntity(GetRandomPrototype(), Owner.Transform.Coordinates);
|
var itemToSpawn = Owner.EntityManager.SpawnEntity(GetRandomPrototype(), Owner.Transform.Coordinates);
|
||||||
handsComponent.PutInHandOrDrop(itemToSpawn.GetComponent<ItemComponent>());
|
handsComponent.PutInHandOrDrop(itemToSpawn.GetComponent<ItemComponent>());
|
||||||
_count--;
|
_count--;
|
||||||
if (_count < 1)
|
if (_count < 1)
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ namespace Content.Server.GameObjects.Components.PA
|
|||||||
[ComponentReference(typeof(ParticleAcceleratorPartComponent))]
|
[ComponentReference(typeof(ParticleAcceleratorPartComponent))]
|
||||||
public class ParticleAcceleratorEmitterComponent : ParticleAcceleratorPartComponent
|
public class ParticleAcceleratorEmitterComponent : ParticleAcceleratorPartComponent
|
||||||
{
|
{
|
||||||
[Dependency] private IEntityManager _entityManager = null!;
|
|
||||||
|
|
||||||
public override string Name => "ParticleAcceleratorEmitter";
|
public override string Name => "ParticleAcceleratorEmitter";
|
||||||
public ParticleAcceleratorEmitterType Type;
|
public ParticleAcceleratorEmitterType Type;
|
||||||
|
|
||||||
@@ -25,7 +23,7 @@ namespace Content.Server.GameObjects.Components.PA
|
|||||||
|
|
||||||
public void Fire(ParticleAcceleratorPowerState strength)
|
public void Fire(ParticleAcceleratorPowerState strength)
|
||||||
{
|
{
|
||||||
var projectile = _entityManager.SpawnEntity("ParticlesProjectile", Owner.Transform.Coordinates);
|
var projectile = Owner.EntityManager.SpawnEntity("ParticlesProjectile", Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (!projectile.TryGetComponent<ParticleProjectileComponent>(out var particleProjectileComponent))
|
if (!projectile.TryGetComponent<ParticleProjectileComponent>(out var particleProjectileComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
internal class WirePlacerComponent : Component, IAfterInteract
|
internal class WirePlacerComponent : Component, IAfterInteract
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IServerEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -37,7 +36,7 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
public void AfterInteract(AfterInteractEventArgs eventArgs)
|
public void AfterInteract(AfterInteractEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) return;
|
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true)) return;
|
||||||
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(_entityManager), out var grid))
|
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(Owner.EntityManager), out var grid))
|
||||||
return;
|
return;
|
||||||
var snapPos = grid.SnapGridCellFor(eventArgs.ClickLocation, SnapGridOffset.Center);
|
var snapPos = grid.SnapGridCellFor(eventArgs.ClickLocation, SnapGridOffset.Center);
|
||||||
var snapCell = grid.GetSnapGridCell(snapPos, SnapGridOffset.Center);
|
var snapCell = grid.GetSnapGridCell(snapPos, SnapGridOffset.Center);
|
||||||
@@ -52,7 +51,7 @@ namespace Content.Server.GameObjects.Components.Power
|
|||||||
}
|
}
|
||||||
if (Owner.TryGetComponent(out StackComponent stack) && !stack.Use(1))
|
if (Owner.TryGetComponent(out StackComponent stack) && !stack.Use(1))
|
||||||
return;
|
return;
|
||||||
_entityManager.SpawnEntity(_wirePrototypeID, grid.GridTileToLocal(snapPos));
|
Owner.EntityManager.SpawnEntity(_wirePrototypeID, grid.GridTileToLocal(snapPos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ namespace Content.Server.GameObjects.Components.Radio
|
|||||||
public class HandheldRadioComponent : Component, IUse, IListen, IRadio, IActivate, IExamine
|
public class HandheldRadioComponent : Component, IUse, IListen, IRadio, IActivate, IExamine
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Radio";
|
public override string Name => "Radio";
|
||||||
|
|
||||||
private RadioSystem _radioSystem = default!;
|
private RadioSystem _radioSystem = default!;
|
||||||
@@ -91,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Radio
|
|||||||
public bool CanListen(string message, IEntity source)
|
public bool CanListen(string message, IEntity source)
|
||||||
{
|
{
|
||||||
return RadioOn &&
|
return RadioOn &&
|
||||||
Owner.Transform.Coordinates.TryDistance(_entityManager, source.Transform.Coordinates, out var distance) &&
|
Owner.Transform.Coordinates.TryDistance(Owner.EntityManager, source.Transform.Coordinates, out var distance) &&
|
||||||
distance <= ListenRange;
|
distance <= ListenRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ namespace Content.Server.GameObjects.Components.Recycling
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class RecyclerComponent : Component, ICollideBehavior
|
public class RecyclerComponent : Component, ICollideBehavior
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Recycler";
|
public override string Name => "Recycler";
|
||||||
|
|
||||||
private List<IEntity> _intersecting = new List<IEntity>();
|
private List<IEntity> _intersecting = new List<IEntity>();
|
||||||
@@ -164,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Recycling
|
|||||||
{
|
{
|
||||||
var entity = _intersecting[i];
|
var entity = _intersecting[i];
|
||||||
|
|
||||||
if (entity.Deleted || !CanMove(entity) || !_entityManager.IsIntersecting(Owner, entity))
|
if (entity.Deleted || !CanMove(entity) || !Owner.EntityManager.IsIntersecting(Owner, entity))
|
||||||
{
|
{
|
||||||
_intersecting.RemoveAt(i);
|
_intersecting.RemoveAt(i);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
[ComponentReference(typeof(IActivate))]
|
[ComponentReference(typeof(IActivate))]
|
||||||
public class EmitterComponent : Component, IActivate, IInteractUsing
|
public class EmitterComponent : Component, IActivate, IInteractUsing
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
[ComponentDependency] private AppearanceComponent? _appearance = default;
|
[ComponentDependency] private AppearanceComponent? _appearance = default;
|
||||||
@@ -251,7 +250,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
|
|
||||||
private void Fire()
|
private void Fire()
|
||||||
{
|
{
|
||||||
var projectile = _entityManager.SpawnEntity(_boltType, Owner.Transform.Coordinates);
|
var projectile = Owner.EntityManager.SpawnEntity(_boltType, Owner.Transform.Coordinates);
|
||||||
|
|
||||||
if (!projectile.TryGetComponent<PhysicsComponent>(out var physicsComponent))
|
if (!projectile.TryGetComponent<PhysicsComponent>(out var physicsComponent))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
|||||||
}
|
}
|
||||||
_previousPulledEntites.Clear();
|
_previousPulledEntites.Clear();
|
||||||
|
|
||||||
var entitiesToPull = _entityManager.GetEntitiesInRange(Owner.Transform.Coordinates, Level * 10);
|
var entitiesToPull = Owner.EntityManager.GetEntitiesInRange(Owner.Transform.Coordinates, Level * 10);
|
||||||
foreach (var entity in entitiesToPull)
|
foreach (var entity in entitiesToPull)
|
||||||
{
|
{
|
||||||
if (!entity.TryGetComponent<PhysicsComponent>(out var collidableComponent)) continue;
|
if (!entity.TryGetComponent<PhysicsComponent>(out var collidableComponent)) continue;
|
||||||
|
|||||||
@@ -24,8 +24,6 @@ namespace Content.Server.GameObjects.Components.Stack
|
|||||||
[ComponentReference(typeof(SharedStackComponent))]
|
[ComponentReference(typeof(SharedStackComponent))]
|
||||||
public class StackComponent : SharedStackComponent, IInteractUsing, IExamine
|
public class StackComponent : SharedStackComponent, IInteractUsing, IExamine
|
||||||
{
|
{
|
||||||
[Dependency] private IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private bool _throwIndividually = false;
|
private bool _throwIndividually = false;
|
||||||
|
|
||||||
public override int Count
|
public override int Count
|
||||||
@@ -78,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Stack
|
|||||||
{
|
{
|
||||||
Count -= amount;
|
Count -= amount;
|
||||||
|
|
||||||
stack = _entityManager.SpawnEntity(Owner.Prototype?.ID, spawnPosition);
|
stack = Owner.EntityManager.SpawnEntity(Owner.Prototype?.ID, spawnPosition);
|
||||||
|
|
||||||
if (stack.TryGetComponent(out StackComponent? stackComp))
|
if (stack.TryGetComponent(out StackComponent? stackComp))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class FlashComponent : MeleeWeaponComponent, IUse, IExamine
|
public class FlashComponent : MeleeWeaponComponent, IUse, IExamine
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public override string Name => "Flash";
|
public override string Name => "Flash";
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] private int _flashDuration = 5000;
|
[ViewVariables(VVAccess.ReadWrite)] private int _flashDuration = 5000;
|
||||||
@@ -84,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entity in _entityManager.GetEntitiesInRange(Owner.Transform.Coordinates, _range))
|
foreach (var entity in Owner.EntityManager.GetEntitiesInRange(Owner.Transform.Coordinates, _range))
|
||||||
{
|
{
|
||||||
Flash(entity, eventArgs.User, _aoeFlashDuration);
|
Flash(entity, eventArgs.User, _aoeFlashDuration);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
public IReadOnlyDictionary<GridId, Dictionary<Vector2i, PathfindingChunk>> Graph => _graph;
|
public IReadOnlyDictionary<GridId, Dictionary<Vector2i, PathfindingChunk>> Graph => _graph;
|
||||||
private readonly Dictionary<GridId, Dictionary<Vector2i, PathfindingChunk>> _graph = new Dictionary<GridId, Dictionary<Vector2i, PathfindingChunk>>();
|
private readonly Dictionary<GridId, Dictionary<Vector2i, PathfindingChunk>> _graph = new Dictionary<GridId, Dictionary<Vector2i, PathfindingChunk>>();
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
|
|||||||
// Also look at increasing tile cost the more physics entities are on it
|
// Also look at increasing tile cost the more physics entities are on it
|
||||||
public bool CanTraverse(IEntity entity, EntityCoordinates coordinates)
|
public bool CanTraverse(IEntity entity, EntityCoordinates coordinates)
|
||||||
{
|
{
|
||||||
var gridId = coordinates.GetGridId(_entityManager);
|
var gridId = coordinates.GetGridId(EntityManager);
|
||||||
var tile = _mapManager.GetGrid(gridId).GetTileRef(coordinates);
|
var tile = _mapManager.GetGrid(gridId).GetTileRef(coordinates);
|
||||||
var node = GetNode(tile);
|
var node = GetNode(tile);
|
||||||
return CanTraverse(entity, node);
|
return CanTraverse(entity, node);
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
// http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview
|
// http://www.red3d.com/cwr/papers/1999/gdc99steer.html for a steering overview
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IPauseManager _pauseManager = default!;
|
[Dependency] private readonly IPauseManager _pauseManager = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private PathfindingSystem _pathfindingSystem;
|
private PathfindingSystem _pathfindingSystem;
|
||||||
|
|
||||||
@@ -269,7 +268,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering
|
|||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
// Check if we can even arrive -> Currently only samegrid movement supported
|
// Check if we can even arrive -> Currently only samegrid movement supported
|
||||||
if (entity.Transform.GridID != steeringRequest.TargetGrid.GetGridId(_entityManager))
|
if (entity.Transform.GridID != steeringRequest.TargetGrid.GetGridId(EntityManager))
|
||||||
{
|
{
|
||||||
controller.VelocityDir = Vector2.Zero;
|
controller.VelocityDir = Vector2.Zero;
|
||||||
return SteeringStatus.NoPath;
|
return SteeringStatus.NoPath;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
public class AtmosExposedSystem
|
public class AtmosExposedSystem
|
||||||
: EntitySystem
|
: EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private const float UpdateDelay = 1f;
|
private const float UpdateDelay = 1f;
|
||||||
private float _lastUpdate;
|
private float _lastUpdate;
|
||||||
@@ -24,7 +23,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
// creadth: everything exposable by atmos should be updated as well
|
// creadth: everything exposable by atmos should be updated as well
|
||||||
foreach (var atmosExposedComponent in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>())
|
foreach (var atmosExposedComponent in EntityManager.ComponentManager.EntityQuery<AtmosExposedComponent>())
|
||||||
{
|
{
|
||||||
var tile = atmosExposedComponent.Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
|
var tile = atmosExposedComponent.Owner.Transform.Coordinates.GetTileAtmosphere(EntityManager);
|
||||||
if (tile == null) continue;
|
if (tile == null) continue;
|
||||||
atmosExposedComponent.Update(tile, _lastUpdate);
|
atmosExposedComponent.Update(tile, _lastUpdate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
{
|
{
|
||||||
public class ExamineSystem : ExamineSystemShared
|
public class ExamineSystem : ExamineSystemShared
|
||||||
{
|
{
|
||||||
[Dependency] private IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private static readonly FormattedMessage _entityNotFoundMessage;
|
private static readonly FormattedMessage _entityNotFoundMessage;
|
||||||
|
|
||||||
static ExamineSystem()
|
static ExamineSystem()
|
||||||
@@ -38,7 +36,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
var channel = player.ConnectedClient;
|
var channel = player.ConnectedClient;
|
||||||
|
|
||||||
if (playerEnt == null
|
if (playerEnt == null
|
||||||
|| !_entityManager.TryGetEntity(request.EntityUid, out var entity)
|
|| !EntityManager.TryGetEntity(request.EntityUid, out var entity)
|
||||||
|| !CanExamine(playerEnt, entity))
|
|| !CanExamine(playerEnt, entity))
|
||||||
{
|
{
|
||||||
RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(
|
RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(
|
||||||
|
|||||||
@@ -805,7 +805,7 @@ namespace Content.Server.GameObjects.EntitySystems.Click
|
|||||||
private void DoAttack(IEntity player, EntityCoordinates coordinates, bool wideAttack, EntityUid target = default)
|
private void DoAttack(IEntity player, EntityCoordinates coordinates, bool wideAttack, EntityUid target = default)
|
||||||
{
|
{
|
||||||
// Verify player is on the same map as the entity he clicked on
|
// Verify player is on the same map as the entity he clicked on
|
||||||
if (_mapManager.GetGrid(coordinates.GetGridId(_entityManager)).ParentMapId != player.Transform.MapID)
|
if (_mapManager.GetGrid(coordinates.GetGridId(EntityManager)).ParentMapId != player.Transform.MapID)
|
||||||
{
|
{
|
||||||
Logger.WarningS("system.interaction",
|
Logger.WarningS("system.interaction",
|
||||||
$"Player named {player.Name} clicked on a map he isn't located on");
|
$"Player named {player.Name} clicked on a map he isn't located on");
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
internal class ConstructionSystem : SharedConstructionSystem
|
internal class ConstructionSystem : SharedConstructionSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
@@ -83,7 +82,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var near in _entityManager.GetEntitiesInRange(user!, 2f, true))
|
foreach (var near in EntityManager.GetEntitiesInRange(user!, 2f, true))
|
||||||
{
|
{
|
||||||
yield return near;
|
yield return near;
|
||||||
}
|
}
|
||||||
@@ -264,7 +263,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newEntity = _entityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates);
|
var newEntity = EntityManager.SpawnEntity(graph.Nodes[edge.Target].Entity, user.Transform.Coordinates);
|
||||||
|
|
||||||
// Yes, this should throw if it's missing the component.
|
// Yes, this should throw if it's missing the component.
|
||||||
var construction = newEntity.GetComponent<ConstructionComponent>();
|
var construction = newEntity.GetComponent<ConstructionComponent>();
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
internal sealed class HandsSystem : EntitySystem
|
internal sealed class HandsSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons
|
private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons
|
||||||
|
|
||||||
@@ -122,7 +121,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
var entCoords = ent.Transform.Coordinates.Position;
|
var entCoords = ent.Transform.Coordinates.Position;
|
||||||
var entToDesiredDropCoords = coords.Position - entCoords;
|
var entToDesiredDropCoords = coords.Position - entCoords;
|
||||||
var targetLength = Math.Min(entToDesiredDropCoords.Length, SharedInteractionSystem.InteractionRange - 0.001f); // InteractionRange is reduced due to InRange not dealing with floating point error
|
var targetLength = Math.Min(entToDesiredDropCoords.Length, SharedInteractionSystem.InteractionRange - 0.001f); // InteractionRange is reduced due to InRange not dealing with floating point error
|
||||||
var newCoords = coords.WithPosition(entToDesiredDropCoords.Normalized * targetLength + entCoords).ToMap(_entityManager);
|
var newCoords = coords.WithPosition(entToDesiredDropCoords.Normalized * targetLength + entCoords).ToMap(EntityManager);
|
||||||
var rayLength = Get<SharedInteractionSystem>().UnobstructedDistance(ent.Transform.MapPosition, newCoords, ignoredEnt: ent);
|
var rayLength = Get<SharedInteractionSystem>().UnobstructedDistance(ent.Transform.MapPosition, newCoords, ignoredEnt: ent);
|
||||||
|
|
||||||
handsComp.Drop(handsComp.ActiveHand, coords.WithPosition(entCoords + entToDesiredDropCoords.Normalized * rayLength));
|
handsComp.Drop(handsComp.ActiveHand, coords.WithPosition(entCoords + entToDesiredDropCoords.Normalized * rayLength));
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
private AudioSystem _audioSystem = default!;
|
private AudioSystem _audioSystem = default!;
|
||||||
|
|
||||||
@@ -94,7 +93,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
if (_mapManager.GridExists(mover.LastPosition.GetGridId(EntityManager)))
|
if (_mapManager.GridExists(mover.LastPosition.GetGridId(EntityManager)))
|
||||||
{
|
{
|
||||||
// Can happen when teleporting between grids.
|
// Can happen when teleporting between grids.
|
||||||
if (!transform.Coordinates.TryDistance(_entityManager, mover.LastPosition, out var distance))
|
if (!transform.Coordinates.TryDistance(EntityManager, mover.LastPosition, out var distance))
|
||||||
{
|
{
|
||||||
mover.LastPosition = transform.Coordinates;
|
mover.LastPosition = transform.Coordinates;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
public class VerbSystem : SharedVerbSystem, IResettingEntitySystem
|
public class VerbSystem : SharedVerbSystem, IResettingEntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
private readonly HashSet<IPlayerSession> _seesThroughContainers = new HashSet<IPlayerSession>();
|
private readonly HashSet<IPlayerSession> _seesThroughContainers = new HashSet<IPlayerSession>();
|
||||||
@@ -76,7 +75,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
private void UseVerb(UseVerbMessage use, EntitySessionEventArgs eventArgs)
|
private void UseVerb(UseVerbMessage use, EntitySessionEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
if (!_entityManager.TryGetEntity(use.EntityUid, out var entity))
|
if (!EntityManager.TryGetEntity(use.EntityUid, out var entity))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -127,7 +126,7 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
var player = (IPlayerSession) eventArgs.SenderSession;
|
var player = (IPlayerSession) eventArgs.SenderSession;
|
||||||
|
|
||||||
if (!_entityManager.TryGetEntity(req.EntityUid, out var entity))
|
if (!EntityManager.TryGetEntity(req.EntityUid, out var entity))
|
||||||
{
|
{
|
||||||
Logger.Warning($"{nameof(RequestVerbs)} called on a nonexistant entity with id {req.EntityUid} by player {player}.");
|
Logger.Warning($"{nameof(RequestVerbs)} called on a nonexistant entity with id {req.EntityUid} by player {player}.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
public abstract class SharedSlipperyComponent : Component, ICollideBehavior
|
public abstract class SharedSlipperyComponent : Component, ICollideBehavior
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
|
|
||||||
public sealed override string Name => "Slippery";
|
public sealed override string Name => "Slippery";
|
||||||
|
|
||||||
@@ -110,13 +109,13 @@ namespace Content.Shared.GameObjects.Components.Movement
|
|||||||
{
|
{
|
||||||
foreach (var uid in _slipped.ToArray())
|
foreach (var uid in _slipped.ToArray())
|
||||||
{
|
{
|
||||||
if (!uid.IsValid() || !_entityManager.EntityExists(uid))
|
if (!uid.IsValid() || !Owner.EntityManager.EntityExists(uid))
|
||||||
{
|
{
|
||||||
_slipped.Remove(uid);
|
_slipped.Remove(uid);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = _entityManager.GetEntity(uid);
|
var entity = Owner.EntityManager.GetEntity(uid);
|
||||||
var physics = Owner.GetComponent<IPhysicsComponent>();
|
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||||
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user