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:
@@ -31,8 +31,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
[RegisterComponent]
|
||||
public class FlammableComponent : SharedFlammableComponent, ICollideBehavior, IFireAct, IReagentReaction
|
||||
{
|
||||
[Dependency] private IEntityManager _entityManager = default!;
|
||||
|
||||
private bool _resisting = false;
|
||||
private readonly List<EntityUid> _collided = new List<EntityUid>();
|
||||
|
||||
@@ -137,13 +135,13 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
foreach (var uid in _collided.ToArray())
|
||||
{
|
||||
if (!uid.IsValid() || !_entityManager.EntityExists(uid))
|
||||
if (!uid.IsValid() || !Owner.EntityManager.EntityExists(uid))
|
||||
{
|
||||
_collided.Remove(uid);
|
||||
continue;
|
||||
}
|
||||
|
||||
var entity = _entityManager.GetEntity(uid);
|
||||
var entity = Owner.EntityManager.GetEntity(uid);
|
||||
var physics = Owner.GetComponent<IPhysicsComponent>();
|
||||
var otherPhysics = entity.GetComponent<IPhysicsComponent>();
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
[RegisterComponent]
|
||||
public class GasAnalyzerComponent : SharedGasAnalyzerComponent, IAfterInteract, IDropped, IUse
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
private GasAnalyzerDanger _pressureDanger;
|
||||
private float _timeSinceSync;
|
||||
private const float TimeBetweenSyncs = 2f;
|
||||
@@ -183,14 +181,14 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
if (!_checkPlayer && _position.HasValue)
|
||||
{
|
||||
// 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;
|
||||
|
||||
pos = _position.Value;
|
||||
}
|
||||
|
||||
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;
|
||||
if (tile == null)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
||||
/// </summary>
|
||||
public abstract class BaseSiphonComponent : PipeNetDeviceComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private PipeNode _scrubberOutlet;
|
||||
@@ -65,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
||||
if (!SiphonEnabled)
|
||||
return;
|
||||
|
||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
|
||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(Owner.EntityManager);
|
||||
if (tileAtmos == null)
|
||||
return;
|
||||
ScrubGas(tileAtmos.Air, _scrubberOutlet.Air);
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
||||
/// </summary>
|
||||
public abstract class BaseVentComponent : PipeNetDeviceComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private PipeNode _ventInlet;
|
||||
@@ -65,7 +64,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
||||
if (!VentEnabled)
|
||||
return;
|
||||
|
||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(_entityManager);
|
||||
var tileAtmos = Owner.Transform.Coordinates.GetTileAtmosphere(Owner.EntityManager);
|
||||
if (tileAtmos == null)
|
||||
return;
|
||||
VentGas(_ventInlet.Air, tileAtmos.Air);
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
public class ConstructionComponent : Component, IExamine, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
@@ -50,8 +50,6 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override string Name => "Puddle";
|
||||
|
||||
private CancellationTokenSource _evaporationToken;
|
||||
@@ -399,7 +397,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
if (puddle == default)
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -17,8 +17,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
[RegisterComponent]
|
||||
public class CursedEntityStorageComponent : EntityStorageComponent
|
||||
{
|
||||
[Dependency] private IEntityManager _entityManager = default!;
|
||||
[Dependency] private IRobustRandom _robustRandom = default!;
|
||||
[Dependency] private IRobustRandom _robustRandom = default!;
|
||||
|
||||
public override string Name => "CursedEntityStorage";
|
||||
|
||||
@@ -29,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
// No contents, we do nothing
|
||||
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))
|
||||
lockers.Remove(Owner);
|
||||
|
||||
@@ -36,8 +36,6 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
[ComponentReference(typeof(IStorageComponent))]
|
||||
public class ServerStorageComponent : SharedStorageComponent, IInteractUsing, IUse, IActivate, IStorageComponent, IDestroyAct, IExAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
private const string LoggerName = "Storage";
|
||||
|
||||
private Container? _storage;
|
||||
@@ -361,14 +359,14 @@ namespace Content.Server.GameObjects.Components.Items.Storage
|
||||
var ownerTransform = Owner.Transform;
|
||||
var playerTransform = player.Transform;
|
||||
|
||||
if (!playerTransform.Coordinates.InRange(_entityManager, ownerTransform.Coordinates, 2) ||
|
||||
if (!playerTransform.Coordinates.InRange(Owner.EntityManager, ownerTransform.Coordinates, 2) ||
|
||||
!ownerTransform.IsMapTransform &&
|
||||
!playerTransform.ContainsEntity(ownerTransform))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var entity = _entityManager.GetEntity(remove.EntityUid);
|
||||
var entity = Owner.EntityManager.GetEntity(remove.EntityUid);
|
||||
|
||||
if (entity == null || _storage?.Contains(entity) == false)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class MicrowaveComponent : SharedMicrowaveComponent, IActivate, IInteractUsing, ISolutionChange, ISuicideAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly RecipeManager _recipeManager = default!;
|
||||
|
||||
#region YAMLSERIALIZE
|
||||
@@ -340,7 +339,7 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
if (recipeToCook != null)
|
||||
{
|
||||
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));
|
||||
@@ -391,9 +390,9 @@ namespace Content.Server.GameObjects.Components.Kitchen
|
||||
|
||||
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]
|
||||
public class SignalTransmitterComponent : Component, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override string Name => "SignalTransmitter";
|
||||
|
||||
private List<SignalReceiverComponent> _unresolvedReceivers;
|
||||
@@ -62,7 +60,7 @@ namespace Content.Server.GameObjects.Components.MachineLinking
|
||||
_unresolvedReceivers = new List<SignalReceiverComponent>();
|
||||
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))
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
{
|
||||
[Dependency] private readonly IGameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly IReflectionManager _reflectionManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
public override string Name => "ConditionalSpawner";
|
||||
@@ -87,7 +86,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
}
|
||||
|
||||
if(!Owner.Deleted)
|
||||
_entityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
||||
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(Prototypes), Owner.Transform.Coordinates);
|
||||
}
|
||||
|
||||
public virtual void MapInit()
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
[RegisterComponent]
|
||||
public class TimedSpawnerComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
public override string Name => "TimedSpawner";
|
||||
@@ -81,7 +80,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
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]
|
||||
public class TrashSpawnerComponent : ConditionalSpawnerComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
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)))
|
||||
{
|
||||
_entityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
|
||||
Owner.EntityManager.SpawnEntity(_robustRandom.Pick(RarePrototypes), Owner.Transform.Coordinates);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -64,7 +63,7 @@ namespace Content.Server.GameObjects.Components.Markers
|
||||
var x_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);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
public class CloningPodComponent : SharedCloningPodComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly IServerPreferencesManager _prefsManager = null!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = null!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = null!;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -169,7 +168,7 @@ namespace Content.Server.GameObjects.Components.Medical
|
||||
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 profile = GetPlayerProfileAsync(client.UserId);
|
||||
mob.GetComponent<HumanoidAppearanceComponent>().UpdateFromProfile(profile);
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace Content.Server.GameObjects.Components.Metabolism
|
||||
public class MetabolismComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = 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
|
||||
if (Owner.Transform.Coordinates.TryGetTileAir(out _, _entityManager))
|
||||
if (Owner.Transform.Coordinates.TryGetTileAir(out _, Owner.EntityManager))
|
||||
{
|
||||
temperatureComponent.RemoveHeat(Math.Min(targetHeat, SweatHeatRegulation));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
internal class ShuttleControllerComponent : Component, IMoverComponent
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
private bool _movingUp;
|
||||
private bool _movingDown;
|
||||
@@ -67,7 +66,7 @@ namespace Content.Server.GameObjects.Components.Movement
|
||||
var gridId = Owner.Transform.GridID;
|
||||
|
||||
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
|
||||
if (!gridEntity.TryGetComponent(out IPhysicsComponent? physics))
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
public sealed class FoodContainer : SharedFoodContainerComponent, IUse
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override string Name => "FoodContainer";
|
||||
|
||||
private AppearanceComponent _appearance;
|
||||
@@ -60,7 +58,7 @@ namespace Content.Server.GameObjects.Components.Nutrition
|
||||
return false;
|
||||
}
|
||||
|
||||
var itemToSpawn = _entityManager.SpawnEntity(GetRandomPrototype(), Owner.Transform.Coordinates);
|
||||
var itemToSpawn = Owner.EntityManager.SpawnEntity(GetRandomPrototype(), Owner.Transform.Coordinates);
|
||||
handsComponent.PutInHandOrDrop(itemToSpawn.GetComponent<ItemComponent>());
|
||||
_count--;
|
||||
if (_count < 1)
|
||||
|
||||
@@ -11,8 +11,6 @@ namespace Content.Server.GameObjects.Components.PA
|
||||
[ComponentReference(typeof(ParticleAcceleratorPartComponent))]
|
||||
public class ParticleAcceleratorEmitterComponent : ParticleAcceleratorPartComponent
|
||||
{
|
||||
[Dependency] private IEntityManager _entityManager = null!;
|
||||
|
||||
public override string Name => "ParticleAcceleratorEmitter";
|
||||
public ParticleAcceleratorEmitterType Type;
|
||||
|
||||
@@ -25,7 +23,7 @@ namespace Content.Server.GameObjects.Components.PA
|
||||
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
[RegisterComponent]
|
||||
internal class WirePlacerComponent : Component, IAfterInteract
|
||||
{
|
||||
[Dependency] private readonly IServerEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -37,7 +36,7 @@ namespace Content.Server.GameObjects.Components.Power
|
||||
public void AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
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;
|
||||
var snapPos = grid.SnapGridCellFor(eventArgs.ClickLocation, 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))
|
||||
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
|
||||
{
|
||||
[Dependency] private readonly IChatManager _chatManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override string Name => "Radio";
|
||||
|
||||
private RadioSystem _radioSystem = default!;
|
||||
@@ -91,7 +89,7 @@ namespace Content.Server.GameObjects.Components.Radio
|
||||
public bool CanListen(string message, IEntity source)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace Content.Server.GameObjects.Components.Recycling
|
||||
[RegisterComponent]
|
||||
public class RecyclerComponent : Component, ICollideBehavior
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override string Name => "Recycler";
|
||||
|
||||
private List<IEntity> _intersecting = new List<IEntity>();
|
||||
@@ -164,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Recycling
|
||||
{
|
||||
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);
|
||||
continue;
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class EmitterComponent : Component, IActivate, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
[ComponentDependency] private AppearanceComponent? _appearance = default;
|
||||
@@ -251,7 +250,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
|
||||
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))
|
||||
{
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Content.Server.GameObjects.Components.Singularity
|
||||
}
|
||||
_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)
|
||||
{
|
||||
if (!entity.TryGetComponent<PhysicsComponent>(out var collidableComponent)) continue;
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace Content.Server.GameObjects.Components.Stack
|
||||
[ComponentReference(typeof(SharedStackComponent))]
|
||||
public class StackComponent : SharedStackComponent, IInteractUsing, IExamine
|
||||
{
|
||||
[Dependency] private IEntityManager _entityManager = default!;
|
||||
|
||||
private bool _throwIndividually = false;
|
||||
|
||||
public override int Count
|
||||
@@ -78,7 +76,7 @@ namespace Content.Server.GameObjects.Components.Stack
|
||||
{
|
||||
Count -= amount;
|
||||
|
||||
stack = _entityManager.SpawnEntity(Owner.Prototype?.ID, spawnPosition);
|
||||
stack = Owner.EntityManager.SpawnEntity(Owner.Prototype?.ID, spawnPosition);
|
||||
|
||||
if (stack.TryGetComponent(out StackComponent? stackComp))
|
||||
{
|
||||
|
||||
@@ -23,8 +23,6 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
[RegisterComponent]
|
||||
public class FlashComponent : MeleeWeaponComponent, IUse, IExamine
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public override string Name => "Flash";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private int _flashDuration = 5000;
|
||||
@@ -84,7 +82,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user