Even more resolve removals.
This commit is contained in:
@@ -119,7 +119,7 @@ namespace Content.Server.Atmos.Components
|
||||
|
||||
public static bool IsMovedByPressure(this EntityUid entity, [NotNullWhen(true)] out MovedByPressureComponent? moved)
|
||||
{
|
||||
return _entMan.TryGetComponent(entity, out moved) &&
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out moved) &&
|
||||
moved.Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Content.Server.Nutrition.Components
|
||||
[RegisterComponent]
|
||||
public sealed class HungerComponent : SharedHungerComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
private float _accumulatedFrameTime;
|
||||
@@ -88,13 +89,13 @@ namespace Content.Server.Nutrition.Components
|
||||
{
|
||||
// Revert slow speed if required
|
||||
if (_lastHungerThreshold == HungerThreshold.Starving && _currentHungerThreshold != HungerThreshold.Dead &&
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent))
|
||||
_entMan.TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent))
|
||||
{
|
||||
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
|
||||
}
|
||||
|
||||
// Update UI
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ServerAlertsComponent? alertsComponent);
|
||||
_entMan.TryGetComponent(Owner, out ServerAlertsComponent? alertsComponent);
|
||||
|
||||
if (HungerThresholdAlertTypes.TryGetValue(_currentHungerThreshold, out var alertId))
|
||||
{
|
||||
@@ -185,7 +186,7 @@ namespace Content.Server.Nutrition.Components
|
||||
return;
|
||||
// --> Current Hunger is below dead threshold
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MobStateComponent? mobState))
|
||||
if (!_entMan.TryGetComponent(Owner, out MobStateComponent? mobState))
|
||||
return;
|
||||
|
||||
if (!mobState.IsDead())
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Content.Server.Nutrition.Components
|
||||
[RegisterComponent]
|
||||
public sealed class ThirstComponent : SharedThirstComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
private float _accumulatedFrameTime;
|
||||
@@ -87,13 +88,13 @@ namespace Content.Server.Nutrition.Components
|
||||
{
|
||||
// Revert slow speed if required
|
||||
if (_lastThirstThreshold == ThirstThreshold.Parched && _currentThirstThreshold != ThirstThreshold.Dead &&
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent))
|
||||
_entMan.TryGetComponent(Owner, out MovementSpeedModifierComponent? movementSlowdownComponent))
|
||||
{
|
||||
EntitySystem.Get<MovementSpeedModifierSystem>().RefreshMovementSpeedModifiers(Owner);
|
||||
}
|
||||
|
||||
// Update UI
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ServerAlertsComponent? alertsComponent);
|
||||
_entMan.TryGetComponent(Owner, out ServerAlertsComponent? alertsComponent);
|
||||
|
||||
if (ThirstThresholdAlertTypes.TryGetValue(_currentThirstThreshold, out var alertId))
|
||||
{
|
||||
@@ -182,7 +183,7 @@ namespace Content.Server.Nutrition.Components
|
||||
return;
|
||||
// --> Current Hunger is below dead threshold
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MobStateComponent? mobState))
|
||||
if (!_entMan.TryGetComponent(Owner, out MobStateComponent? mobState))
|
||||
return;
|
||||
|
||||
if (!mobState.IsDead())
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
// This is awful. I hate this so much.
|
||||
// TODO: Please, someone refactor containers and free me from this bullshit.
|
||||
if (!smokable.Owner.TryGetContainerMan(out var containerManager) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(containerManager.Owner, out BloodstreamComponent? bloodstream))
|
||||
!EntityManager.TryGetComponent(containerManager.Owner, out BloodstreamComponent? bloodstream))
|
||||
continue;
|
||||
|
||||
_reactiveSystem.ReactionEntity(containerManager.Owner, ReactionMethod.Ingestion, inhaledSolution);
|
||||
|
||||
@@ -19,18 +19,20 @@ namespace Content.Server.PDA
|
||||
{
|
||||
IdCardComponent? firstIdInPda = null;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out HandsComponent? hands))
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (entMan.TryGetComponent(player, out HandsComponent? hands))
|
||||
{
|
||||
foreach (var item in hands.GetAllHeldItems())
|
||||
{
|
||||
if (firstIdInPda == null &&
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(item.Owner, out PDAComponent? pda) &&
|
||||
entMan.TryGetComponent(item.Owner, out PDAComponent? pda) &&
|
||||
pda.ContainedID != null)
|
||||
{
|
||||
firstIdInPda = pda.ContainedID;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(item.Owner, out IdCardComponent? card))
|
||||
if (entMan.TryGetComponent(item.Owner, out IdCardComponent? card))
|
||||
{
|
||||
return card;
|
||||
}
|
||||
@@ -44,18 +46,18 @@ namespace Content.Server.PDA
|
||||
|
||||
IdCardComponent? firstIdInInventory = null;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out InventoryComponent? inventory))
|
||||
if (entMan.TryGetComponent(player, out InventoryComponent? inventory))
|
||||
{
|
||||
foreach (var item in inventory.GetAllHeldItems())
|
||||
{
|
||||
if (firstIdInInventory == null &&
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out PDAComponent? pda) &&
|
||||
entMan.TryGetComponent(item, out PDAComponent? pda) &&
|
||||
pda.ContainedID != null)
|
||||
{
|
||||
firstIdInInventory = pda.ContainedID;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out IdCardComponent? card))
|
||||
if (entMan.TryGetComponent(item, out IdCardComponent? card))
|
||||
{
|
||||
return card;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Content.Server.Paper
|
||||
public class PaperComponent : SharedPaperComponent, IExamine, IInteractUsing, IUse
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private PaperAction _mode;
|
||||
[DataField("content")]
|
||||
public string Content { get; set; } = "";
|
||||
@@ -43,7 +45,7 @@ namespace Content.Server.Paper
|
||||
Content = content + '\n';
|
||||
UpdateUserInterface();
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (!_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
return;
|
||||
|
||||
var status = string.IsNullOrWhiteSpace(content)
|
||||
@@ -74,7 +76,7 @@ namespace Content.Server.Paper
|
||||
|
||||
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
return false;
|
||||
|
||||
_mode = PaperAction.Read;
|
||||
@@ -91,12 +93,12 @@ namespace Content.Server.Paper
|
||||
|
||||
Content += msg.Text + '\n';
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(PaperVisuals.Status, PaperStatus.Written);
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityDescription = "";
|
||||
_entMan.GetComponent<MetaDataComponent>(Owner).EntityDescription = "";
|
||||
UpdateUserInterface();
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ namespace Content.Server.Paper
|
||||
{
|
||||
if (!eventArgs.Using.HasTag("Write"))
|
||||
return false;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
return false;
|
||||
|
||||
_mode = PaperAction.Write;
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
[RegisterComponent]
|
||||
public class ParticleAcceleratorControlBoxComponent : ParticleAcceleratorPartComponent, IActivate, IWires
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
public override string Name => "ParticleAcceleratorControlBox";
|
||||
@@ -221,12 +222,12 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<WiresComponent?>(Owner, out var wires) && wires.IsPanelOpen)
|
||||
if (_entMan.TryGetComponent<WiresComponent?>(Owner, out var wires) && wires.IsPanelOpen)
|
||||
{
|
||||
wires.OpenInterface(actor.PlayerSession);
|
||||
}
|
||||
@@ -333,7 +334,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
private void UpdateWireStatus()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out WiresComponent? wires))
|
||||
if (!_entMan.TryGetComponent(Owner, out WiresComponent? wires))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -383,13 +384,13 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
_partEmitterRight = null;
|
||||
|
||||
// Find fuel chamber first by scanning cardinals.
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Anchored)
|
||||
if (_entMan.GetComponent<TransformComponent>(Owner).Anchored)
|
||||
{
|
||||
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
var grid = _mapManager.GetGrid(_entMan.GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
foreach (var maybeFuel in grid.GetCardinalNeighborCells(coords))
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(maybeFuel, out _partFuelChamber))
|
||||
if (_entMan.TryGetComponent(maybeFuel, out _partFuelChamber))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -405,7 +406,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
// Align ourselves to match fuel chamber orientation.
|
||||
// This means that if you mess up the orientation of the control box it's not a big deal,
|
||||
// because the sprite is far from obvious about the orientation.
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_partFuelChamber.Owner).LocalRotation;
|
||||
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = _entMan.GetComponent<TransformComponent>(_partFuelChamber.Owner).LocalRotation;
|
||||
|
||||
var offsetEndCap = RotateOffset((1, 1));
|
||||
var offsetPowerBox = RotateOffset((1, -1));
|
||||
@@ -451,7 +452,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
Vector2i RotateOffset(in Vector2i vec)
|
||||
{
|
||||
var rot = new Angle(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation);
|
||||
var rot = new Angle(_entMan.GetComponent<TransformComponent>(Owner).LocalRotation);
|
||||
return (Vector2i) rot.RotateVec(vec);
|
||||
}
|
||||
}
|
||||
@@ -459,11 +460,11 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
private bool ScanPart<T>(Vector2i offset, [NotNullWhen(true)] out T? part)
|
||||
where T : ParticleAcceleratorPartComponent
|
||||
{
|
||||
var grid = _mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
var grid = _mapManager.GetGrid(_entMan.GetComponent<TransformComponent>(Owner).GridID);
|
||||
var coords = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
foreach (var ent in grid.GetOffset(coords, offset))
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(ent, out part) && !part.Deleted)
|
||||
if (_entMan.TryGetComponent(ent, out part) && !part.Deleted)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -576,7 +577,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(ParticleAcceleratorVisuals.VisualState,
|
||||
_apcPowerReceiverComponent!.Powered
|
||||
@@ -682,7 +683,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
private void UpdatePartVisualState(ParticleAcceleratorPartComponent? component)
|
||||
{
|
||||
if (component == null || !IoCManager.Resolve<IEntityManager>().TryGetComponent<AppearanceComponent?>(component.Owner, out var appearanceComponent))
|
||||
if (component == null || !_entMan.TryGetComponent<AppearanceComponent?>(component.Owner, out var appearanceComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
[RegisterComponent]
|
||||
public class ParticleProjectileComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "ParticleProjectile";
|
||||
public ParticleAcceleratorPowerState State;
|
||||
|
||||
@@ -20,21 +22,21 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
{
|
||||
State = state;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(Owner, out var physicsComponent))
|
||||
if (!_entMan.TryGetComponent<PhysicsComponent?>(Owner, out var physicsComponent))
|
||||
{
|
||||
Logger.Error("ParticleProjectile tried firing, but it was spawned without a CollidableComponent");
|
||||
return;
|
||||
}
|
||||
physicsComponent.BodyStatus = BodyStatus.InAir;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ProjectileComponent?>(Owner, out var projectileComponent))
|
||||
if (!_entMan.TryGetComponent<ProjectileComponent?>(Owner, out var projectileComponent))
|
||||
{
|
||||
Logger.Error("ParticleProjectile tried firing, but it was spawned without a ProjectileComponent");
|
||||
return;
|
||||
}
|
||||
projectileComponent.IgnoreEntity(firer);
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SinguloFoodComponent?>(Owner, out var singuloFoodComponent))
|
||||
if (!_entMan.TryGetComponent<SinguloFoodComponent?>(Owner, out var singuloFoodComponent))
|
||||
{
|
||||
Logger.Error("ParticleProjectile tried firing, but it was spawned without a SinguloFoodComponent");
|
||||
return;
|
||||
@@ -59,7 +61,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
_ => "0"
|
||||
};
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<SpriteComponent?>(Owner, out var spriteComponent))
|
||||
if (!_entMan.TryGetComponent<SpriteComponent?>(Owner, out var spriteComponent))
|
||||
{
|
||||
Logger.Error("ParticleProjectile tried firing, but it was spawned without a SpriteComponent");
|
||||
return;
|
||||
@@ -69,8 +71,8 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
physicsComponent
|
||||
.LinearVelocity = angle.ToWorldVec() * 20f;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation = angle;
|
||||
Timer.Spawn(3000, () => IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner));
|
||||
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = angle;
|
||||
Timer.Spawn(3000, () => _entMan.DeleteEntity(Owner));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,11 +41,12 @@ namespace Content.Server.Physics.Controllers
|
||||
}
|
||||
|
||||
var direction = system.GetAngle(comp).ToVec();
|
||||
var ownerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(comp.Owner).WorldPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var ownerPos = entMan.GetComponent<TransformComponent>(comp.Owner).WorldPosition;
|
||||
|
||||
foreach (var (entity, physics) in EntitySystem.Get<ConveyorSystem>().GetEntitiesToMove(comp))
|
||||
{
|
||||
var itemRelativeToConveyor = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).WorldPosition - ownerPos;
|
||||
var itemRelativeToConveyor = entMan.GetComponent<TransformComponent>(entity).WorldPosition - ownerPos;
|
||||
physics.LinearVelocity += Convey(direction, comp.Speed, frameTime, itemRelativeToConveyor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Content.Server.Physics.Controllers
|
||||
{
|
||||
if (!mover.Owner.HasTag("FootstepSound")) return;
|
||||
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Owner);
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(mover.Owner);
|
||||
var coordinates = transform.Coordinates;
|
||||
var gridId = coordinates.GetGridId(EntityManager);
|
||||
var distanceNeeded = mover.Sprinting ? StepSoundMoveDistanceRunning : StepSoundMoveDistanceWalking;
|
||||
@@ -302,9 +302,9 @@ namespace Content.Server.Physics.Controllers
|
||||
|
||||
mobMover.StepSoundDistance -= distanceNeeded;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<InventoryComponent?>(mover.Owner, out var inventory)
|
||||
if (EntityManager.TryGetComponent<InventoryComponent?>(mover.Owner, out var inventory)
|
||||
&& inventory.TryGetSlotItem<ItemComponent>(EquipmentSlotDefines.Slots.SHOES, out var item)
|
||||
&& IoCManager.Resolve<IEntityManager>().TryGetComponent<FootstepModifierComponent?>(item.Owner, out var modifier))
|
||||
&& EntityManager.TryGetComponent<FootstepModifierComponent?>(item.Owner, out var modifier))
|
||||
{
|
||||
modifier.PlayFootstep();
|
||||
}
|
||||
@@ -351,7 +351,7 @@ namespace Content.Server.Physics.Controllers
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(coordinates),
|
||||
soundToPlay,
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover).Coordinates,
|
||||
EntityManager.GetComponent<TransformComponent>(mover).Coordinates,
|
||||
sprinting ? AudioParams.Default.WithVolume(0.75f) : null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Content.Server.Physics.Controllers
|
||||
|
||||
foreach (var (singularity, physics) in EntityManager.EntityQuery<ServerSingularityComponent, PhysicsComponent>())
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<ActorComponent>(singularity.Owner) ||
|
||||
if (EntityManager.HasComponent<ActorComponent>(singularity.Owner) ||
|
||||
singularity.BeingDeletedByAnotherSingularity) continue;
|
||||
|
||||
singularity.MoveAccumulator -= frameTime;
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Content.Server.Plants.Components
|
||||
[RegisterComponent]
|
||||
public class RandomPottedPlantComponent : Component, IMapInit
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "RandomPottedPlant";
|
||||
|
||||
private static readonly string[] RegularPlantStates;
|
||||
@@ -61,7 +63,7 @@ namespace Content.Server.Plants.Components
|
||||
|
||||
if (_selectedState != null)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(Owner).LayerSetState(0, _selectedState);
|
||||
_entMan.GetComponent<SpriteComponent>(Owner).LayerSetState(0, _selectedState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +74,7 @@ namespace Content.Server.Plants.Components
|
||||
var list = _plastic ? PlasticPlantStates : RegularPlantStates;
|
||||
_selectedState = random.Pick(list);
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(Owner).LayerSetState(0, _selectedState);
|
||||
_entMan.GetComponent<SpriteComponent>(Owner).LayerSetState(0, _selectedState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Content.Server.Pointing.Components
|
||||
[RegisterComponent]
|
||||
public class PointingArrowComponent : SharedPointingArrowComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The current amount of seconds left on this arrow.
|
||||
/// </summary>
|
||||
@@ -58,7 +60,7 @@ namespace Content.Server.Pointing.Components
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
{
|
||||
sprite.DrawDepth = (int) DrawDepth.Overlays;
|
||||
}
|
||||
@@ -67,7 +69,7 @@ namespace Content.Server.Pointing.Components
|
||||
public void Update(float frameTime)
|
||||
{
|
||||
var movement = _speed * frameTime * (_up ? 1 : -1);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalPosition += (0, movement);
|
||||
_entMan.GetComponent<TransformComponent>(Owner).LocalPosition += (0, movement);
|
||||
|
||||
_duration -= frameTime;
|
||||
_currentStep -= frameTime;
|
||||
@@ -76,12 +78,12 @@ namespace Content.Server.Pointing.Components
|
||||
{
|
||||
if (_rogue)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().RemoveComponent<PointingArrowComponent>(Owner);
|
||||
IoCManager.Resolve<IEntityManager>().AddComponent<RoguePointingArrowComponent>(Owner);
|
||||
_entMan.RemoveComponent<PointingArrowComponent>(Owner);
|
||||
_entMan.AddComponent<RoguePointingArrowComponent>(Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Content.Server.Power.Components
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class ApcComponent : BaseApcNetComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override string Name => "Apc";
|
||||
@@ -56,7 +57,7 @@ namespace Content.Server.Power.Components
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ApcUiKey.Key);
|
||||
|
||||
public BatteryComponent? Battery => IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out BatteryComponent? batteryComponent) ? batteryComponent : null;
|
||||
public BatteryComponent? Battery => _entMan.TryGetComponent(Owner, out BatteryComponent? batteryComponent) ? batteryComponent : null;
|
||||
|
||||
[ComponentDependency] private AccessReader? _accessReader = null;
|
||||
|
||||
@@ -94,7 +95,7 @@ namespace Content.Server.Power.Components
|
||||
if (_accessReader == null || accessSystem.IsAllowed(_accessReader, attached))
|
||||
{
|
||||
MainBreakerEnabled = !MainBreakerEnabled;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(Owner).CanDischarge = MainBreakerEnabled;
|
||||
_entMan.GetComponent<PowerNetworkBatteryComponent>(Owner).CanDischarge = MainBreakerEnabled;
|
||||
|
||||
_uiDirty = true;
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _onReceiveMessageSound.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||
@@ -113,12 +114,12 @@ namespace Content.Server.Power.Components
|
||||
_lastChargeState = newState;
|
||||
_lastChargeStateChange = _gameTiming.CurTime;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(ApcVisuals.ChargeState, newState);
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedPointLightComponent? light))
|
||||
if (_entMan.TryGetComponent(Owner, out SharedPointLightComponent? light))
|
||||
{
|
||||
light.Color = newState switch
|
||||
{
|
||||
@@ -131,7 +132,7 @@ namespace Content.Server.Power.Components
|
||||
}
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out BatteryComponent? battery);
|
||||
_entMan.TryGetComponent(Owner, out BatteryComponent? battery);
|
||||
|
||||
var newCharge = battery?.CurrentCharge;
|
||||
if (newCharge != null && newCharge != _lastCharge && _lastChargeChange + TimeSpan.FromSeconds(VisualsChangeDelay) < _gameTiming.CurTime)
|
||||
@@ -158,7 +159,7 @@ namespace Content.Server.Power.Components
|
||||
|
||||
private ApcChargeState CalcChargeState()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out BatteryComponent? battery))
|
||||
if (!_entMan.TryGetComponent(Owner, out BatteryComponent? battery))
|
||||
{
|
||||
return ApcChargeState.Lack;
|
||||
}
|
||||
@@ -170,7 +171,7 @@ namespace Content.Server.Power.Components
|
||||
return ApcChargeState.Full;
|
||||
}
|
||||
|
||||
var netBattery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(Owner);
|
||||
var netBattery = _entMan.GetComponent<PowerNetworkBatteryComponent>(Owner);
|
||||
var delta = netBattery.CurrentSupply - netBattery.CurrentReceiving;
|
||||
|
||||
return delta < 0 ? ApcChargeState.Charging : ApcChargeState.Lack;
|
||||
@@ -182,7 +183,7 @@ namespace Content.Server.Power.Components
|
||||
if (bat == null)
|
||||
return ApcExternalPowerState.None;
|
||||
|
||||
var netBat = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(Owner);
|
||||
var netBat = _entMan.GetComponent<PowerNetworkBatteryComponent>(Owner);
|
||||
if (netBat.CurrentReceiving == 0 && netBat.LoadingNetworkDemand != 0)
|
||||
{
|
||||
return ApcExternalPowerState.None;
|
||||
@@ -199,7 +200,7 @@ namespace Content.Server.Power.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace Content.Server.Power.Components
|
||||
public class ApcPowerReceiverComponent : Component, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "ApcPowerReceiver";
|
||||
|
||||
[ViewVariables]
|
||||
@@ -85,9 +87,9 @@ namespace Content.Server.Power.Components
|
||||
#pragma warning disable 618
|
||||
SendMessage(new PowerChangedMessage(Powered));
|
||||
#pragma warning restore 618
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new PowerChangedEvent(Powered, NetworkLoad.ReceivingPower));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new PowerChangedEvent(Powered, NetworkLoad.ReceivingPower));
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<AppearanceComponent?>(Owner, out var appearance))
|
||||
if (_entMan.TryGetComponent<AppearanceComponent?>(Owner, out var appearance))
|
||||
{
|
||||
appearance.SetData(PowerDeviceVisuals.Powered, Powered);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Content.Server.Power.Components
|
||||
[ComponentReference(typeof(IInteractUsing))]
|
||||
public abstract class BaseCharger : Component, IActivate, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private BatteryComponent? _heldBattery;
|
||||
|
||||
@@ -97,12 +99,12 @@ namespace Content.Server.Power.Components
|
||||
|
||||
Container.Remove(heldItem);
|
||||
_heldBattery = null;
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? handsComponent))
|
||||
if (_entMan.TryGetComponent(user, out HandsComponent? handsComponent))
|
||||
{
|
||||
handsComponent.PutInHandOrDrop(IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(heldItem));
|
||||
handsComponent.PutInHandOrDrop(_entMan.GetComponent<ItemComponent>(heldItem));
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(heldItem, out ServerBatteryBarrelComponent? batteryBarrelComponent))
|
||||
if (_entMan.TryGetComponent(heldItem, out ServerBatteryBarrelComponent? batteryBarrelComponent))
|
||||
{
|
||||
batteryBarrelComponent.UpdateAppearance();
|
||||
}
|
||||
@@ -117,7 +119,7 @@ namespace Content.Server.Power.Components
|
||||
|
||||
private CellChargerStatus GetStatus()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) &&
|
||||
if (_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) &&
|
||||
!receiver.Powered)
|
||||
{
|
||||
return CellChargerStatus.Off;
|
||||
@@ -160,13 +162,13 @@ namespace Content.Server.Power.Components
|
||||
// Not called UpdateAppearance just because it messes with the load
|
||||
var status = GetStatus();
|
||||
if (_status == status ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
!_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_status = status;
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance);
|
||||
_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance);
|
||||
|
||||
switch (_status)
|
||||
{
|
||||
@@ -205,7 +207,7 @@ namespace Content.Server.Power.Components
|
||||
|
||||
private void TransferPower(float frameTime)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) &&
|
||||
if (_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) &&
|
||||
!receiver.Powered)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Content.Server.Power.Components
|
||||
|
||||
public abstract class BaseNetConnectorComponent<TNetType> : Component, IBaseNetConnectorComponent<TNetType>
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public Voltage Voltage { get => _voltage; set => SetVoltage(value); }
|
||||
[DataField("voltage")]
|
||||
@@ -68,7 +70,7 @@ namespace Content.Server.Power.Components
|
||||
|
||||
private bool TryFindNet([NotNullWhen(true)] out TNetType? foundNet)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<NodeContainerComponent?>(Owner, out var container))
|
||||
if (_entMan.TryGetComponent<NodeContainerComponent?>(Owner, out var container))
|
||||
{
|
||||
var compatibleNet = container.Nodes.Values
|
||||
.Where(node => (NodeId == null || NodeId == node.Name) && node.NodeGroupID == (NodeGroupID) Voltage)
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Content.Server.Power.Components
|
||||
[RegisterComponent]
|
||||
public class CableComponent : Component, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Cable";
|
||||
|
||||
[ViewVariables]
|
||||
@@ -45,11 +47,11 @@ namespace Content.Server.Power.Components
|
||||
|
||||
if (EntitySystem.Get<ElectrocutionSystem>().TryDoElectrifiedAct(Owner, eventArgs.User)) return false;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
var droppedEnt = IoCManager.Resolve<IEntityManager>().SpawnEntity(_cableDroppedOnCutPrototype, eventArgs.ClickLocation);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
var droppedEnt = _entMan.SpawnEntity(_cableDroppedOnCutPrototype, eventArgs.ClickLocation);
|
||||
|
||||
// TODO: Literally just use a prototype that has a single thing in the stack, it's not that complicated...
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<StackComponent?>(droppedEnt, out var stack))
|
||||
if (_entMan.TryGetComponent<StackComponent?>(droppedEnt, out var stack))
|
||||
EntitySystem.Get<StackSystem>().SetCount(droppedEnt, 1, stack);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Content.Server.Power.Components
|
||||
[RegisterComponent]
|
||||
internal class CablePlacerComponent : Component, IAfterInteract
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -40,7 +41,7 @@ namespace Content.Server.Power.Components
|
||||
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
||||
return false;
|
||||
|
||||
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(IoCManager.Resolve<IEntityManager>()), out var grid))
|
||||
if(!_mapManager.TryGetGrid(eventArgs.ClickLocation.GetGridId(_entMan), out var grid))
|
||||
return false;
|
||||
|
||||
var snapPos = grid.TileIndicesFor(eventArgs.ClickLocation);
|
||||
@@ -51,17 +52,17 @@ namespace Content.Server.Power.Components
|
||||
|
||||
foreach (var anchored in grid.GetAnchoredEntities(snapPos))
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<CableComponent>(anchored, out var wire) && wire.CableType == _blockingCableType)
|
||||
if (_entMan.TryGetComponent<CableComponent>(anchored, out var wire) && wire.CableType == _blockingCableType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<StackComponent?>(Owner, out var stack)
|
||||
if (_entMan.TryGetComponent<StackComponent?>(Owner, out var stack)
|
||||
&& !EntitySystem.Get<StackSystem>().Use(Owner, 1, stack))
|
||||
return false;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(_cablePrototypeID, grid.GridTileToLocal(snapPos));
|
||||
_entMan.SpawnEntity(_cablePrototypeID, grid.GridTileToLocal(snapPos));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Content.Server.Power.SMES
|
||||
[RegisterComponent]
|
||||
public class SmesComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override string Name => "Smes";
|
||||
@@ -47,7 +48,7 @@ namespace Content.Server.Power.SMES
|
||||
_lastChargeLevel = newLevel;
|
||||
_lastChargeLevelChange = _gameTiming.CurTime;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(SmesVisuals.LastChargeLevel, newLevel);
|
||||
}
|
||||
@@ -59,7 +60,7 @@ namespace Content.Server.Power.SMES
|
||||
_lastChargeState = newChargeState;
|
||||
_lastChargeStateChange = _gameTiming.CurTime;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(SmesVisuals.LastChargeState, newChargeState);
|
||||
}
|
||||
@@ -68,7 +69,7 @@ namespace Content.Server.Power.SMES
|
||||
|
||||
private int GetNewChargeLevel()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out BatteryComponent? battery))
|
||||
if (!_entMan.TryGetComponent(Owner, out BatteryComponent? battery))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -78,7 +79,7 @@ namespace Content.Server.Power.SMES
|
||||
|
||||
private ChargeState GetNewChargeState()
|
||||
{
|
||||
var battery = IoCManager.Resolve<IEntityManager>().GetComponent<PowerNetworkBatteryComponent>(Owner);
|
||||
var battery = _entMan.GetComponent<PowerNetworkBatteryComponent>(Owner);
|
||||
return (battery.CurrentSupply - battery.CurrentReceiving) switch
|
||||
{
|
||||
> 0 => ChargeState.Discharging,
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Content.Server.Projectiles.Components
|
||||
[RegisterComponent]
|
||||
public class HitscanComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override string Name => "Hitscan";
|
||||
@@ -56,12 +57,12 @@ namespace Content.Server.Projectiles.Components
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
// We'll get the effects relative to the grid / map of the firer
|
||||
var gridOrMap = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).GridID == GridId.Invalid ? mapManager.GetMapEntityId(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapID) :
|
||||
mapManager.GetGrid(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).GridID).GridEntityId;
|
||||
var gridOrMap = _entMan.GetComponent<TransformComponent>(user).GridID == GridId.Invalid ? mapManager.GetMapEntityId(_entMan.GetComponent<TransformComponent>(user).MapID) :
|
||||
mapManager.GetGrid(_entMan.GetComponent<TransformComponent>(user).GridID).GridEntityId;
|
||||
|
||||
var parentXform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(gridOrMap);
|
||||
var parentXform = _entMan.GetComponent<TransformComponent>(gridOrMap);
|
||||
|
||||
var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).WorldPosition));
|
||||
var localCoordinates = new EntityCoordinates(gridOrMap, parentXform.InvWorldMatrix.Transform(_entMan.GetComponent<TransformComponent>(user).WorldPosition));
|
||||
var localAngle = angle - parentXform.WorldRotation;
|
||||
|
||||
var afterEffect = AfterEffects(localCoordinates, localAngle, distance, 1.0f);
|
||||
@@ -96,9 +97,9 @@ namespace Content.Server.Projectiles.Components
|
||||
|
||||
Owner.SpawnTimer((int) _deathTime.TotalMilliseconds, () =>
|
||||
{
|
||||
if (!((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||
if (!((!_entMan.EntityExists(Owner) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -161,7 +162,7 @@ namespace Content.Server.Projectiles.Components
|
||||
EffectSprite = _impactFlash,
|
||||
Born = _startTime,
|
||||
DeathTime = _deathTime,
|
||||
Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates.Offset(angle.ToVec() * distance),
|
||||
Coordinates = _entMan.GetComponent<TransformComponent>(Owner).Coordinates.Offset(angle.ToVec() * distance),
|
||||
//Rotated from east facing
|
||||
Rotation = (float) angle.FlipPositive(),
|
||||
Color = Vector4.Multiply(new Vector4(255, 255, 255, 750), ColorModifier),
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Content.Server.Radiation
|
||||
[ComponentReference(typeof(SharedRadiationPulseComponent))]
|
||||
public sealed class RadiationPulseComponent : SharedRadiationPulseComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
@@ -107,11 +108,11 @@ namespace Content.Server.Radiation
|
||||
|
||||
public void Update(float frameTime)
|
||||
{
|
||||
if (!Decay || (!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
if (!Decay || (!_entMan.EntityExists(Owner) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
return;
|
||||
|
||||
if (_duration <= 0f)
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner);
|
||||
_entMan.QueueDeleteEntity(Owner);
|
||||
|
||||
_duration -= frameTime;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Content.Server.Radiation
|
||||
[UsedImplicitly]
|
||||
public sealed class RadiationPulseSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IEntityLookup _lookup = default!;
|
||||
|
||||
private const float RadiationCooldown = 0.5f;
|
||||
@@ -33,16 +34,16 @@ namespace Content.Server.Radiation
|
||||
comp.Update(RadiationCooldown);
|
||||
var ent = comp.Owner;
|
||||
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(ent) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(ent).EntityLifeStage) >= EntityLifeStage.Deleted) continue;
|
||||
if ((!_entMan.EntityExists(ent) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(ent).EntityLifeStage) >= EntityLifeStage.Deleted) continue;
|
||||
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(ent).Coordinates, comp.Range))
|
||||
foreach (var entity in _lookup.GetEntitiesInRange(_entMan.GetComponent<TransformComponent>(ent).Coordinates, comp.Range))
|
||||
{
|
||||
// For now at least still need this because it uses a list internally then returns and this may be deleted before we get to it.
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted) continue;
|
||||
if ((!_entMan.EntityExists(entity) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted) continue;
|
||||
|
||||
// Note: Radiation is liable for a refactor (stinky Sloth coding a basic version when he did StationEvents)
|
||||
// so this ToArray doesn't really matter.
|
||||
foreach (var radiation in IoCManager.Resolve<IEntityManager>().GetComponents<IRadiationAct>(entity).ToArray())
|
||||
foreach (var radiation in _entMan.GetComponents<IRadiationAct>(entity).ToArray())
|
||||
{
|
||||
radiation.RadiationAct(RadiationCooldown, comp);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ namespace Content.Server.Recycling.Components
|
||||
[RegisterComponent]
|
||||
public class RecyclableComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Recyclable";
|
||||
|
||||
/// <summary>
|
||||
@@ -33,12 +35,12 @@ namespace Content.Server.Recycling.Components
|
||||
{
|
||||
for (var i = 0; i < Math.Max(_amount * efficiency, 1); i++)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(_prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.SpawnEntity(_prototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().QueueDeleteEntity(Owner);
|
||||
_entMan.QueueDeleteEntity(Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Content.Server.Recycling.Components
|
||||
[Friend(typeof(RecyclerSystem))]
|
||||
public class RecyclerComponent : Component, ISuicideAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Recycler";
|
||||
|
||||
/// <summary>
|
||||
@@ -39,7 +41,7 @@ namespace Content.Server.Recycling.Components
|
||||
|
||||
private void Clean()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(RecyclerVisuals.Bloody, false);
|
||||
}
|
||||
@@ -47,7 +49,7 @@ namespace Content.Server.Recycling.Components
|
||||
|
||||
SuicideKind ISuicideAct.Suicide(EntityUid victim, IChatManager chat)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(victim, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind)
|
||||
if (_entMan.TryGetComponent(victim, out ActorComponent? actor) && actor.PlayerSession.ContentData()?.Mind is {} mind)
|
||||
{
|
||||
EntitySystem.Get<GameTicker>().OnGhostAttempt(mind, false);
|
||||
mind.OwnedEntity?.PopupMessage(Loc.GetString("recycler-component-suicide-message"));
|
||||
@@ -55,7 +57,7 @@ namespace Content.Server.Recycling.Components
|
||||
|
||||
victim.PopupMessageOtherClients(Loc.GetString("recycler-component-suicide-message-others", ("victim",victim)));
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent?>(victim, out var body))
|
||||
if (_entMan.TryGetComponent<SharedBodyComponent?>(victim, out var body))
|
||||
{
|
||||
body.Gib(true);
|
||||
}
|
||||
|
||||
@@ -22,12 +22,13 @@ namespace Content.Server.Research.Components
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class ResearchConsoleComponent : SharedResearchConsoleComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
[DataField("sound")]
|
||||
private SoundSpecifier _soundCollectionName = new SoundCollectionSpecifier("keyboard");
|
||||
|
||||
[ViewVariables] private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
[ViewVariables] private bool Powered => !_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ResearchConsoleUiKey.Key);
|
||||
|
||||
@@ -47,9 +48,9 @@ namespace Content.Server.Research.Components
|
||||
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage message)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out TechnologyDatabaseComponent? database))
|
||||
if (!_entMan.TryGetComponent(Owner, out TechnologyDatabaseComponent? database))
|
||||
return;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ResearchClientComponent? client))
|
||||
if (!_entMan.TryGetComponent(Owner, out ResearchClientComponent? client))
|
||||
return;
|
||||
if (!Powered)
|
||||
return;
|
||||
@@ -90,7 +91,7 @@ namespace Content.Server.Research.Components
|
||||
|
||||
private ResearchConsoleBoundInterfaceState GetNewUiState()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ResearchClientComponent? client) ||
|
||||
if (!_entMan.TryGetComponent(Owner, out ResearchClientComponent? client) ||
|
||||
client.Server == null)
|
||||
return new ResearchConsoleBoundInterfaceState(default, default);
|
||||
|
||||
@@ -111,7 +112,7 @@ namespace Content.Server.Research.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
return;
|
||||
if (!Powered)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Content.Server.Sandbox.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eUid, out NodeContainerComponent? nodeContainerComponent))
|
||||
if (!entityManager.TryGetComponent(eUid, out NodeContainerComponent? nodeContainerComponent))
|
||||
{
|
||||
shell.WriteLine(Loc.GetString("shell-entity-is-not-node-container"));
|
||||
return;
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace Content.Server.Singularity.Components
|
||||
[ComponentReference(typeof(SharedContainmentFieldGeneratorComponent))]
|
||||
public class ContainmentFieldGeneratorComponent : SharedContainmentFieldGeneratorComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private int _powerBuffer;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -95,9 +97,9 @@ namespace Content.Server.Singularity.Components
|
||||
{
|
||||
if (_connection1?.Item1 == direction || _connection2?.Item1 == direction) continue;
|
||||
|
||||
var dirVec = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).WorldRotation.RotateVec(direction.ToVec());
|
||||
var ray = new CollisionRay(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).WorldPosition, dirVec, (int) CollisionGroup.MobMask);
|
||||
var rawRayCastResults = EntitySystem.Get<SharedPhysicsSystem>().IntersectRay(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapID, ray, 4.5f, Owner, false);
|
||||
var dirVec = _entMan.GetComponent<TransformComponent>(Owner).WorldRotation.RotateVec(direction.ToVec());
|
||||
var ray = new CollisionRay(_entMan.GetComponent<TransformComponent>(Owner).WorldPosition, dirVec, (int) CollisionGroup.MobMask);
|
||||
var rawRayCastResults = EntitySystem.Get<SharedPhysicsSystem>().IntersectRay(_entMan.GetComponent<TransformComponent>(Owner).MapID, ray, 4.5f, Owner, false);
|
||||
|
||||
var rayCastResults = rawRayCastResults as RayCastResults[] ?? rawRayCastResults.ToArray();
|
||||
if(!rayCastResults.Any()) continue;
|
||||
@@ -113,11 +115,11 @@ namespace Content.Server.Singularity.Components
|
||||
}
|
||||
if(closestResult == null) continue;
|
||||
var ent = closestResult.Value.HitEntity;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ContainmentFieldGeneratorComponent?>(ent, out var fieldGeneratorComponent) ||
|
||||
if (!_entMan.TryGetComponent<ContainmentFieldGeneratorComponent?>(ent, out var fieldGeneratorComponent) ||
|
||||
fieldGeneratorComponent.Owner == Owner ||
|
||||
!fieldGeneratorComponent.HasFreeConnections() ||
|
||||
IsConnectedWith(fieldGeneratorComponent) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent<PhysicsComponent?>(ent, out var collidableComponent) ||
|
||||
!_entMan.TryGetComponent<PhysicsComponent?>(ent, out var collidableComponent) ||
|
||||
collidableComponent.BodyType != BodyType.Static)
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace Content.Server.Singularity.Components
|
||||
[ComponentReference(typeof(SharedSingularityComponent))]
|
||||
public class ServerSingularityComponent : SharedSingularityComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private SharedSingularitySystem _singularitySystem = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -27,7 +29,7 @@ namespace Content.Server.Singularity.Components
|
||||
_energy = value;
|
||||
if (_energy <= 0)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,7 +94,7 @@ namespace Content.Server.Singularity.Components
|
||||
protected override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _singularityCollapsingSound.GetSound(), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _singularityCollapsingSound.GetSound(), _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ namespace Content.Server.Singularity.Components
|
||||
[RegisterComponent]
|
||||
public class SingularityGeneratorComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "SingularityGenerator";
|
||||
|
||||
[ViewVariables] private int _power;
|
||||
@@ -21,8 +23,7 @@ namespace Content.Server.Singularity.Components
|
||||
_power = value;
|
||||
if (_power > 15)
|
||||
{
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
entityManager.SpawnEntity("Singularity", IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.SpawnEntity("Singularity", _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
//dont delete ourselves, just wait to get eaten
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Content.Server.Spawners.Components
|
||||
[RegisterComponent]
|
||||
public class ConditionalSpawnerComponent : Component, IMapInit
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
public override string Name => "ConditionalSpawner";
|
||||
@@ -61,8 +62,8 @@ namespace Content.Server.Spawners.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if(!((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
if(_entMan.Deleted(Owner))
|
||||
_entMan.SpawnEntity(_robustRandom.Pick(Prototypes), _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
}
|
||||
|
||||
public virtual void MapInit()
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Content.Server.Spawners.Components
|
||||
[RegisterComponent]
|
||||
public class RandomSpawnerComponent : ConditionalSpawnerComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
public override string Name => "RandomSpawner";
|
||||
@@ -32,7 +33,7 @@ namespace Content.Server.Spawners.Components
|
||||
{
|
||||
if (RarePrototypes.Count > 0 && (RareChance == 1.0f || _robustRandom.Prob(RareChance)))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(RarePrototypes), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.SpawnEntity(_robustRandom.Pick(RarePrototypes), _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -47,15 +48,15 @@ namespace Content.Server.Spawners.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if(!((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||
if(!((!_entMan.EntityExists(Owner) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted))
|
||||
{
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
|
||||
var x_negative = random.Prob(0.5f) ? -1 : 1;
|
||||
var y_negative = random.Prob(0.5f) ? -1 : 1;
|
||||
|
||||
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_robustRandom.Pick(Prototypes), IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative);
|
||||
var entity = _entMan.SpawnEntity(_robustRandom.Pick(Prototypes), _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.GetComponent<TransformComponent>(entity).LocalPosition += new Vector2(random.NextFloat() * Offset * x_negative, random.NextFloat() * Offset * y_negative);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,7 +64,7 @@ namespace Content.Server.Spawners.Components
|
||||
public override void MapInit()
|
||||
{
|
||||
Spawn();
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,11 +51,13 @@ namespace Content.Server.StationEvents.Events
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
foreach (var entity in _powered)
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(entity) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityLifeStage) >= EntityLifeStage.Deleted) continue;
|
||||
if (entMan.Deleted(entity)) continue;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ApcPowerReceiverComponent? powerReceiverComponent))
|
||||
if (entMan.TryGetComponent(entity, out ApcPowerReceiverComponent? powerReceiverComponent))
|
||||
{
|
||||
powerReceiverComponent.PowerDisabled = false;
|
||||
}
|
||||
|
||||
@@ -89,15 +89,15 @@ namespace Content.Server.StationEvents.Events
|
||||
return;
|
||||
|
||||
var pulse = _entityManager.SpawnEntity("RadiationPulse", coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<RadiationPulseComponent>(pulse).DoPulse();
|
||||
_entityManager.GetComponent<RadiationPulseComponent>(pulse).DoPulse();
|
||||
ResetTimeUntilPulse();
|
||||
}
|
||||
|
||||
public static void SpawnPulseAt(EntityCoordinates at)
|
||||
public void SpawnPulseAt(EntityCoordinates at)
|
||||
{
|
||||
var pulse = IoCManager.Resolve<IEntityManager>()
|
||||
.SpawnEntity("RadiationPulse", at);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<RadiationPulseComponent>(pulse).DoPulse();
|
||||
_entityManager.GetComponent<RadiationPulseComponent>(pulse).DoPulse();
|
||||
}
|
||||
|
||||
private bool TryFindRandomGrid(IMapGrid mapGrid, out EntityCoordinates coordinates)
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Content.Server.Storage.Components
|
||||
[RegisterComponent]
|
||||
public class CursedEntityStorageComponent : EntityStorageComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
public override string Name => "CursedEntityStorage";
|
||||
@@ -31,7 +32,7 @@ namespace Content.Server.Storage.Components
|
||||
// No contents, we do nothing
|
||||
if (Contents.ContainedEntities.Count == 0) return;
|
||||
|
||||
var lockers = IoCManager.Resolve<IEntityManager>().EntityQuery<EntityStorageComponent>().Select(c => c.Owner).ToList();
|
||||
var lockers = _entMan.EntityQuery<EntityStorageComponent>().Select(c => c.Owner).ToList();
|
||||
|
||||
if (lockers.Contains(Owner))
|
||||
lockers.Remove(Owner);
|
||||
@@ -40,7 +41,7 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
if (lockerEnt == null) return; // No valid lockers anywhere.
|
||||
|
||||
var locker = IoCManager.Resolve<IEntityManager>().GetComponent<EntityStorageComponent>(lockerEnt);
|
||||
var locker = _entMan.GetComponent<EntityStorageComponent>(lockerEnt);
|
||||
|
||||
if (locker.Open)
|
||||
locker.TryCloseStorage(Owner);
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace Content.Server.Storage.Components
|
||||
[ComponentReference(typeof(IStorageComponent))]
|
||||
public class EntityStorageComponent : Component, IActivate, IStorageComponent, IInteractUsing, IDestroyAct, IExAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "EntityStorage";
|
||||
|
||||
private const float MaxSize = 1.0f; // maximum width or height of an entity allowed inside the storage.
|
||||
@@ -148,7 +150,7 @@ namespace Content.Server.Storage.Components
|
||||
Contents.ShowContents = _showContents;
|
||||
Contents.OccludesLight = _occludesLight;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<PlaceableSurfaceComponent?>(Owner, out var surface))
|
||||
if (_entMan.TryGetComponent<PlaceableSurfaceComponent?>(Owner, out var surface))
|
||||
{
|
||||
EntitySystem.Get<PlaceableSurfaceSystem>().SetPlaceable(Owner, Open, surface);
|
||||
}
|
||||
@@ -169,7 +171,7 @@ namespace Content.Server.Storage.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<LockComponent?>(Owner, out var @lock) && @lock.Locked)
|
||||
if (_entMan.TryGetComponent<LockComponent?>(Owner, out var @lock) && @lock.Locked)
|
||||
{
|
||||
if (!silent) Owner.PopupMessage(user, Loc.GetString("entity-storage-component-locked-message"));
|
||||
return false;
|
||||
@@ -214,14 +216,14 @@ namespace Content.Server.Storage.Components
|
||||
// 5. if this is NOT AN ITEM, then mobs can always be eaten unless unless a previous law prevents it
|
||||
|
||||
// Let's not insert admin ghosts, yeah? This is really a a hack and should be replaced by attempt events
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<GhostComponent>(entity))
|
||||
if (_entMan.HasComponent<GhostComponent>(entity))
|
||||
continue;
|
||||
|
||||
// checks
|
||||
|
||||
var targetIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(entity);
|
||||
var targetIsMob = IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity);
|
||||
var storageIsItem = IoCManager.Resolve<IEntityManager>().HasComponent<SharedItemComponent>(Owner);
|
||||
var targetIsItem = _entMan.HasComponent<SharedItemComponent>(entity);
|
||||
var targetIsMob = _entMan.HasComponent<SharedBodyComponent>(entity);
|
||||
var storageIsItem = _entMan.HasComponent<SharedItemComponent>(Owner);
|
||||
|
||||
var allowedToEat = false;
|
||||
|
||||
@@ -266,7 +268,7 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(StorageVisuals.CanWeld, _canWeldShut);
|
||||
appearance.SetData(StorageVisuals.Welded, _isWeldedShut);
|
||||
@@ -275,7 +277,7 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
private void ModifyComponents()
|
||||
{
|
||||
if (!_isCollidableWhenOpen && IoCManager.Resolve<IEntityManager>().TryGetComponent<FixturesComponent?>(Owner, out var manager))
|
||||
if (!_isCollidableWhenOpen && _entMan.TryGetComponent<FixturesComponent?>(Owner, out var manager))
|
||||
{
|
||||
if (Open)
|
||||
{
|
||||
@@ -293,12 +295,12 @@ namespace Content.Server.Storage.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<PlaceableSurfaceComponent?>(Owner, out var surface))
|
||||
if (_entMan.TryGetComponent<PlaceableSurfaceComponent?>(Owner, out var surface))
|
||||
{
|
||||
EntitySystem.Get<PlaceableSurfaceSystem>().SetPlaceable(Owner, Open, surface);
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(StorageVisuals.Open, Open);
|
||||
}
|
||||
@@ -307,7 +309,7 @@ namespace Content.Server.Storage.Components
|
||||
protected virtual bool AddToContents(EntityUid entity)
|
||||
{
|
||||
if (entity == Owner) return false;
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IPhysBody? entityPhysicsComponent))
|
||||
if (_entMan.TryGetComponent(entity, out IPhysBody? entityPhysicsComponent))
|
||||
{
|
||||
if (MaxSize < entityPhysicsComponent.GetWorldAABB().Size.X
|
||||
|| MaxSize < entityPhysicsComponent.GetWorldAABB().Size.Y)
|
||||
@@ -321,7 +323,7 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
public virtual Vector2 ContentsDumpPosition()
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).WorldPosition;
|
||||
return _entMan.GetComponent<TransformComponent>(Owner).WorldPosition;
|
||||
}
|
||||
|
||||
private void EmptyContents()
|
||||
@@ -330,8 +332,8 @@ namespace Content.Server.Storage.Components
|
||||
{
|
||||
if (Contents.Remove(contained))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained).WorldPosition = ContentsDumpPosition();
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<IPhysBody?>(contained, out var physics))
|
||||
_entMan.GetComponent<TransformComponent>(contained).WorldPosition = ContentsDumpPosition();
|
||||
if (_entMan.TryGetComponent<IPhysBody?>(contained, out var physics))
|
||||
{
|
||||
physics.CanCollide = true;
|
||||
}
|
||||
@@ -365,7 +367,7 @@ namespace Content.Server.Storage.Components
|
||||
// Trying to add while open just dumps it on the ground below us.
|
||||
if (Open)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var entMan = _entMan;
|
||||
entMan.GetComponent<TransformComponent>(entity).WorldPosition = entMan.GetComponent<TransformComponent>(Owner).WorldPosition;
|
||||
return true;
|
||||
}
|
||||
@@ -453,7 +455,7 @@ namespace Content.Server.Storage.Components
|
||||
var containedEntities = Contents.ContainedEntities.ToList();
|
||||
foreach (var entity in containedEntities)
|
||||
{
|
||||
var exActs = IoCManager.Resolve<IEntityManager>().GetComponents<IExAct>(entity).ToArray();
|
||||
var exActs = _entMan.GetComponents<IExAct>(entity).ToArray();
|
||||
foreach (var exAct in exActs)
|
||||
{
|
||||
exAct.OnExplosion(eventArgs);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Server.Storage.Components
|
||||
[RegisterComponent]
|
||||
public class SecretStashComponent : Component, IDestroyAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "SecretStash";
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
[ViewVariables] private ContainerSlot _itemContainer = default!;
|
||||
|
||||
public string SecretPartName => _secretPartNameOverride ?? Loc.GetString("comp-secret-stash-secret-part-name", ("name", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
public string SecretPartName => _secretPartNameOverride ?? Loc.GetString("comp-secret-stash-secret-part-name", ("name", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.Storage.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(itemToHide, out ItemComponent? item))
|
||||
if (!_entMan.TryGetComponent(itemToHide, out ItemComponent? item))
|
||||
return false;
|
||||
|
||||
if (item.Size > _maxItemSize)
|
||||
@@ -62,7 +62,7 @@ namespace Content.Server.Storage.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(user, out HandsComponent? hands))
|
||||
return false;
|
||||
|
||||
if (!hands.Drop(itemToHide, _itemContainer))
|
||||
@@ -85,15 +85,15 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-secret-stash-action-get-item-found-something", ("stash", SecretPartName)));
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? hands))
|
||||
if (_entMan.TryGetComponent(user, out HandsComponent? hands))
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(contained, out ItemComponent? item))
|
||||
if (!_entMan.TryGetComponent(contained, out ItemComponent? item))
|
||||
return false;
|
||||
hands.PutInHandOrDrop(item);
|
||||
}
|
||||
else if (_itemContainer.Remove(contained))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(contained).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
_entMan.GetComponent<TransformComponent>(contained).Coordinates = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -113,7 +113,7 @@ namespace Content.Server.Storage.Components
|
||||
// drop item inside
|
||||
if (_itemContainer.ContainedEntity is {Valid: true} contained)
|
||||
{
|
||||
_entities.GetComponent<TransformComponent>(contained).Coordinates = _entities.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
_entMan.GetComponent<TransformComponent>(contained).Coordinates = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ namespace Content.Server.Storage.Components
|
||||
[RegisterComponent]
|
||||
public sealed class StorageFillComponent : Component, IMapInit
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "StorageFill";
|
||||
|
||||
[DataField("contents")] private List<EntitySpawnEntry> _contents = new();
|
||||
@@ -28,7 +30,7 @@ namespace Content.Server.Storage.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out IStorageComponent? storage))
|
||||
if (!_entMan.TryGetComponent(Owner, out IStorageComponent? storage))
|
||||
{
|
||||
Logger.Error($"StorageFillComponent couldn't find any StorageComponent ({Owner})");
|
||||
return;
|
||||
@@ -48,7 +50,7 @@ namespace Content.Server.Storage.Components
|
||||
continue;
|
||||
}
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var entMan = _entMan;
|
||||
var transform = entMan.GetComponent<TransformComponent>(Owner);
|
||||
|
||||
for (var i = 0; i < storageItem.Amount; i++)
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Content.Server.Suspicion
|
||||
public class SuspicionRoleComponent : SharedSuspicionRoleComponent, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private Role? _role;
|
||||
[ViewVariables]
|
||||
private readonly HashSet<SuspicionRoleComponent> _allies = new();
|
||||
@@ -60,7 +62,7 @@ namespace Content.Server.Suspicion
|
||||
|
||||
public bool IsDead()
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MobStateComponent? state) &&
|
||||
return _entMan.TryGetComponent(Owner, out MobStateComponent? state) &&
|
||||
state.IsDead();
|
||||
}
|
||||
|
||||
@@ -76,7 +78,7 @@ namespace Content.Server.Suspicion
|
||||
|
||||
public void SyncRoles()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MindComponent? mind) ||
|
||||
if (!_entMan.TryGetComponent(Owner, out MindComponent? mind) ||
|
||||
!mind.HasMind)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Content.Server.Tiles
|
||||
[RegisterComponent]
|
||||
public class FloorTileItemComponent : Component, IAfterInteract
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
|
||||
public override string Name => "FloorTile";
|
||||
@@ -58,16 +59,16 @@ namespace Content.Server.Tiles
|
||||
if (!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
||||
return true;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out StackComponent? stack))
|
||||
if (!_entMan.TryGetComponent(Owner, out StackComponent? stack))
|
||||
return true;
|
||||
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
var location = eventArgs.ClickLocation.AlignWithClosestGridTile();
|
||||
var locationMap = location.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var locationMap = location.ToMap(_entMan);
|
||||
if (locationMap.MapId == MapId.Nullspace)
|
||||
return true;
|
||||
mapManager.TryGetGrid(location.GetGridId(IoCManager.Resolve<IEntityManager>()), out var mapGrid);
|
||||
mapManager.TryGetGrid(location.GetGridId(_entMan), out var mapGrid);
|
||||
|
||||
if (_outputTiles == null)
|
||||
return true;
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace Content.Server.Toilet
|
||||
IInteractHand, IMapInit, IExamine, ISuicideAct
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public sealed override string Name => "Toilet";
|
||||
|
||||
private const float PryLidTime = 1f;
|
||||
@@ -67,7 +69,7 @@ namespace Content.Server.Toilet
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
// are player trying place or lift of cistern lid?
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out ToolComponent? tool)
|
||||
if (_entMan.TryGetComponent(eventArgs.Using, out ToolComponent? tool)
|
||||
&& tool.Qualities.Contains(_pryingQuality))
|
||||
{
|
||||
// check if someone is already prying this toilet
|
||||
@@ -111,7 +113,7 @@ namespace Content.Server.Toilet
|
||||
|
||||
// just want to up/down seat?
|
||||
// check that nobody seats on seat right now
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out StrapComponent? strap))
|
||||
if (_entMan.TryGetComponent(Owner, out StrapComponent? strap))
|
||||
{
|
||||
if (strap.BuckledEntities.Count != 0)
|
||||
return false;
|
||||
@@ -142,7 +144,7 @@ namespace Content.Server.Toilet
|
||||
|
||||
private void UpdateSprite()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(ToiletVisuals.LidOpen, LidOpen);
|
||||
appearance.SetData(ToiletVisuals.SeatUp, IsSeatUp);
|
||||
@@ -152,23 +154,23 @@ namespace Content.Server.Toilet
|
||||
SuicideKind ISuicideAct.Suicide(EntityUid victim, IChatManager chat)
|
||||
{
|
||||
// check that victim even have head
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedBodyComponent?>(victim, out var body) &&
|
||||
if (_entMan.TryGetComponent<SharedBodyComponent?>(victim, out var body) &&
|
||||
body.HasPartOfType(BodyPartType.Head))
|
||||
{
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", ("victim",Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(victim).EntityName),("owner", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-head-message-others", ("victim",Name: _entMan.GetComponent<MetaDataComponent>(victim).EntityName),("owner", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
victim.PopupMessageOtherClients(othersMessage);
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-head-message", ("owner", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-head-message", ("owner", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
victim.PopupMessage(selfMessage);
|
||||
|
||||
return SuicideKind.Asphyxiation;
|
||||
}
|
||||
else
|
||||
{
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-message-others",("victim", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(victim).EntityName),("owner", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
var othersMessage = Loc.GetString("toilet-component-suicide-message-others",("victim", Name: _entMan.GetComponent<MetaDataComponent>(victim).EntityName),("owner", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
victim.PopupMessageOtherClients(othersMessage);
|
||||
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-message", ("owner",Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
var selfMessage = Loc.GetString("toilet-component-suicide-message", ("owner",Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName));
|
||||
victim.PopupMessage(selfMessage);
|
||||
|
||||
return SuicideKind.Blunt;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Content.Server.Tools.Components
|
||||
[RegisterComponent]
|
||||
public class TilePryingComponent : Component, IAfterInteract
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
|
||||
@@ -33,10 +34,10 @@ namespace Content.Server.Tools.Components
|
||||
|
||||
public async void TryPryTile(EntityUid user, EntityCoordinates clickLocation)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<ToolComponent?>(Owner, out var tool) && _toolComponentNeeded)
|
||||
if (!_entMan.TryGetComponent<ToolComponent?>(Owner, out var tool) && _toolComponentNeeded)
|
||||
return;
|
||||
|
||||
if (!_mapManager.TryGetGrid(clickLocation.GetGridId(IoCManager.Resolve<IEntityManager>()), out var mapGrid))
|
||||
if (!_mapManager.TryGetGrid(clickLocation.GetGridId(_entMan), out var mapGrid))
|
||||
return;
|
||||
|
||||
var tile = mapGrid.GetTileRef(clickLocation);
|
||||
@@ -54,7 +55,7 @@ namespace Content.Server.Tools.Components
|
||||
if (_toolComponentNeeded && !await EntitySystem.Get<ToolSystem>().UseTool(Owner, user, null, 0f, 0f, _qualityNeeded, toolComponent:tool))
|
||||
return;
|
||||
|
||||
coordinates.PryTile(IoCManager.Resolve<IEntityManager>(), _mapManager);
|
||||
coordinates.PryTile(_entMan, _mapManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,19 +15,21 @@ namespace Content.Server.TraitorDeathMatch.Components
|
||||
[RegisterComponent]
|
||||
public class TraitorDeathMatchRedemptionComponent : Component, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Name => "TraitorDeathMatchRedemption";
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<InventoryComponent?>(eventArgs.User, out var userInv))
|
||||
if (!_entMan.TryGetComponent<InventoryComponent?>(eventArgs.User, out var userInv))
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message",
|
||||
("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-inventory-message"))));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<MindComponent?>(eventArgs.User, out var userMindComponent))
|
||||
if (!_entMan.TryGetComponent<MindComponent?>(eventArgs.User, out var userMindComponent))
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message",
|
||||
("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-mind-message"))));
|
||||
@@ -42,14 +44,14 @@ namespace Content.Server.TraitorDeathMatch.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<UplinkComponent?>(eventArgs.Using, out var victimUplink))
|
||||
if (!_entMan.TryGetComponent<UplinkComponent?>(eventArgs.Using, out var victimUplink))
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message",
|
||||
("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-pda-message"))));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<TraitorDeathMatchReliableOwnerTagComponent?>(eventArgs.Using, out var victimPDAOwner))
|
||||
if (!_entMan.TryGetComponent<TraitorDeathMatchReliableOwnerTagComponent?>(eventArgs.Using, out var victimPDAOwner))
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-main-message",
|
||||
("secondMessage", Loc.GetString("traitor-death-match-redemption-component-interact-using-no-pda-owner-message"))));
|
||||
@@ -66,7 +68,7 @@ namespace Content.Server.TraitorDeathMatch.Components
|
||||
UplinkComponent? userUplink = null;
|
||||
|
||||
if (userInv.GetSlotItem(EquipmentSlotDefines.Slots.IDCARD)?.Owner is {Valid: true} userPDAEntity)
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<UplinkComponent?>(userPDAEntity, out var userUplinkComponent))
|
||||
if (_entMan.TryGetComponent<UplinkComponent?>(userPDAEntity, out var userUplinkComponent))
|
||||
userUplink = userUplinkComponent;
|
||||
|
||||
if (userUplink == null)
|
||||
@@ -104,12 +106,12 @@ namespace Content.Server.TraitorDeathMatch.Components
|
||||
}
|
||||
|
||||
// 4 is the per-PDA bonus amount.
|
||||
var accounts = IoCManager.Resolve<IEntityManager>().EntitySysManager.GetEntitySystem<UplinkAccountsSystem>();
|
||||
var accounts = _entMan.EntitySysManager.GetEntitySystem<UplinkAccountsSystem>();
|
||||
var transferAmount = victimAccount.Balance + 4;
|
||||
accounts.SetBalance(victimAccount, 0);
|
||||
accounts.AddToBalance(userAccount, transferAmount);
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(victimUplink.Owner);
|
||||
_entMan.DeleteEntity(victimUplink.Owner);
|
||||
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("traitor-death-match-redemption-component-interact-using-success-message", ("tcAmount", transferAmount)));
|
||||
return true;
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Content.Server.VendingMachines
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class VendingMachineComponent : SharedVendingMachineComponent, IActivate, IBreakAct, IWires
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -38,7 +39,7 @@ namespace Content.Server.VendingMachines
|
||||
private string _packPrototypeId = string.Empty;
|
||||
private string _spriteName = "";
|
||||
|
||||
private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
private bool Powered => !_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
private bool _broken;
|
||||
|
||||
[DataField("soundVend")]
|
||||
@@ -54,14 +55,14 @@ namespace Content.Server.VendingMachines
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if(!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if(!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
var wires = IoCManager.Resolve<IEntityManager>().GetComponent<WiresComponent>(Owner);
|
||||
var wires = _entMan.GetComponent<WiresComponent>(Owner);
|
||||
if (wires.IsPanelOpen)
|
||||
{
|
||||
wires.OpenInterface(actor.PlayerSession);
|
||||
@@ -79,12 +80,12 @@ namespace Content.Server.VendingMachines
|
||||
return;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName = packPrototype.Name;
|
||||
_entMan.GetComponent<MetaDataComponent>(Owner).EntityName = packPrototype.Name;
|
||||
_animationDuration = TimeSpan.FromSeconds(packPrototype.AnimationDuration);
|
||||
_spriteName = packPrototype.SpriteName;
|
||||
if (!string.IsNullOrEmpty(_spriteName))
|
||||
{
|
||||
var spriteComponent = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(Owner);
|
||||
var spriteComponent = _entMan.GetComponent<SpriteComponent>(Owner);
|
||||
const string vendingMachineRSIPath = "Structures/Machines/VendingMachines/{0}.rsi";
|
||||
spriteComponent.BaseRSIPath = string.Format(vendingMachineRSIPath, _spriteName);
|
||||
}
|
||||
@@ -106,7 +107,7 @@ namespace Content.Server.VendingMachines
|
||||
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
if (_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
TrySetVisualState(receiver.Powered ? VendingMachineVisualState.Normal : VendingMachineVisualState.Off);
|
||||
}
|
||||
@@ -182,7 +183,7 @@ namespace Content.Server.VendingMachines
|
||||
{
|
||||
_ejecting = false;
|
||||
TrySetVisualState(VendingMachineVisualState.Normal);
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(id, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.SpawnEntity(id, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
});
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _soundVend.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||
@@ -190,7 +191,7 @@ namespace Content.Server.VendingMachines
|
||||
|
||||
private void TryEject(string id, EntityUid? sender)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<AccessReader?>(Owner, out var accessReader))
|
||||
if (_entMan.TryGetComponent<AccessReader?>(Owner, out var accessReader))
|
||||
{
|
||||
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
||||
if (sender == null || !accessSystem.IsAllowed(accessReader, sender.Value))
|
||||
@@ -232,7 +233,7 @@ namespace Content.Server.VendingMachines
|
||||
finalState = VendingMachineVisualState.Off;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(VendingMachineVisuals.VisualState, finalState);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
public class AmmoComponent : Component, IExamine, ISerializationHooks
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
public override string Name => "Ammo";
|
||||
@@ -117,12 +118,12 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
}
|
||||
|
||||
_spent = true;
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
|
||||
{
|
||||
appearanceComponent.SetData(AmmoVisuals.Spent, true);
|
||||
}
|
||||
|
||||
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_projectileId, spawnAt);
|
||||
var entity = _entMan.SpawnEntity(_projectileId, spawnAt);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
[RegisterComponent]
|
||||
public class SpeedLoaderComponent : Component, IAfterInteract, IInteractUsing, IMapInit, IUse
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "SpeedLoader";
|
||||
|
||||
[DataField("caliber")]
|
||||
@@ -59,7 +61,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
|
||||
{
|
||||
appearanceComponent?.SetData(MagazineBarrelVisuals.MagLoaded, true);
|
||||
appearanceComponent?.SetData(AmmoVisuals.AmmoCount, AmmoLeft);
|
||||
@@ -69,7 +71,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
|
||||
public bool TryInsertAmmo(EntityUid user, EntityUid entity)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out AmmoComponent? ammoComponent))
|
||||
if (!_entMan.TryGetComponent(entity, out AmmoComponent? ammoComponent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -95,7 +97,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
|
||||
private bool UseEntity(EntityUid user)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? handsComponent))
|
||||
if (!_entMan.TryGetComponent(user, out HandsComponent? handsComponent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -106,7 +108,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
var itemComponent = IoCManager.Resolve<IEntityManager>().GetComponent<ItemComponent>(ammo);
|
||||
var itemComponent = _entMan.GetComponent<ItemComponent>(ammo);
|
||||
if (!handsComponent.CanPutInHand(itemComponent))
|
||||
{
|
||||
ServerRangedBarrelComponent.EjectCasing(ammo);
|
||||
@@ -130,7 +132,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
|
||||
if (_unspawnedCount > 0)
|
||||
{
|
||||
entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
entity = _entMan.SpawnEntity(_fillPrototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_unspawnedCount--;
|
||||
}
|
||||
|
||||
@@ -147,7 +149,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
// This area is dirty but not sure of an easier way to do it besides add an interface or somethin
|
||||
var changed = false;
|
||||
|
||||
var entities = IoCManager.Resolve<IEntityManager>();
|
||||
var entities = _entMan;
|
||||
if (entities.TryGetComponent(eventArgs.Target.Value, out RevolverBarrelComponent? revolverBarrel))
|
||||
{
|
||||
for (var i = 0; i < Capacity; i++)
|
||||
@@ -169,7 +171,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Target.Value, out BoltActionBarrelComponent? boltActionBarrel))
|
||||
else if (_entMan.TryGetComponent(eventArgs.Target.Value, out BoltActionBarrelComponent? boltActionBarrel))
|
||||
{
|
||||
for (var i = 0; i < Capacity; i++)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,8 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
[NetworkedComponent()]
|
||||
public sealed class PumpBarrelComponent : ServerRangedBarrelComponent, IUse, IInteractUsing, IMapInit, ISerializationHooks
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "PumpBarrel";
|
||||
|
||||
public override int ShotsLeft
|
||||
@@ -85,7 +87,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
// (Is one chambered?, is the bullet spend)
|
||||
var chamber = (chamberedExists, false);
|
||||
|
||||
if (chamberedExists && IoCManager.Resolve<IEntityManager>().TryGetComponent<AmmoComponent?>(_chamberContainer.ContainedEntity!.Value, out var ammo))
|
||||
if (chamberedExists && _entMan.TryGetComponent<AmmoComponent?>(_chamberContainer.ContainedEntity!.Value, out var ammo))
|
||||
{
|
||||
chamber.Item2 = ammo.Spent;
|
||||
}
|
||||
@@ -124,7 +126,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
_unspawnedCount--;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearanceComponent))
|
||||
{
|
||||
_appearanceComponent = appearanceComponent;
|
||||
}
|
||||
@@ -159,7 +161,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
if (_chamberContainer.ContainedEntity is not {Valid: true} chamberEntity)
|
||||
return null;
|
||||
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponentOrNull<AmmoComponent>(chamberEntity)?.TakeBullet(spawnAt);
|
||||
return _entMan.GetComponentOrNull<AmmoComponent>(chamberEntity)?.TakeBullet(spawnAt);
|
||||
}
|
||||
|
||||
private void Cycle(bool manual = false)
|
||||
@@ -167,7 +169,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
if (_chamberContainer.ContainedEntity is {Valid: true} chamberedEntity)
|
||||
{
|
||||
_chamberContainer.Remove(chamberedEntity);
|
||||
var ammoComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AmmoComponent>(chamberedEntity);
|
||||
var ammoComponent = _entMan.GetComponent<AmmoComponent>(chamberedEntity);
|
||||
if (!ammoComponent.Caseless)
|
||||
{
|
||||
EjectCasing(chamberedEntity);
|
||||
@@ -183,7 +185,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
if (_unspawnedCount > 0)
|
||||
{
|
||||
_unspawnedCount--;
|
||||
var ammoEntity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
var ammoEntity = _entMan.SpawnEntity(_fillPrototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_chamberContainer.Insert(ammoEntity);
|
||||
}
|
||||
|
||||
@@ -198,7 +200,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
|
||||
public bool TryInsertBullet(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out AmmoComponent? ammoComponent))
|
||||
if (!_entMan.TryGetComponent(eventArgs.Using, out AmmoComponent? ammoComponent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
[NetworkedComponent()]
|
||||
public sealed class RevolverBarrelComponent : ServerRangedBarrelComponent, IUse, IInteractUsing, ISerializationHooks
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override string Name => "RevolverBarrel";
|
||||
@@ -81,7 +82,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
slotsSpent[i] = null;
|
||||
var ammoEntity = _ammoSlots[i];
|
||||
if (ammoEntity != default && IoCManager.Resolve<IEntityManager>().TryGetComponent(ammoEntity, out AmmoComponent? ammo))
|
||||
if (ammoEntity != default && _entMan.TryGetComponent(ammoEntity, out AmmoComponent? ammo))
|
||||
{
|
||||
slotsSpent[i] = ammo.Spent;
|
||||
}
|
||||
@@ -113,7 +114,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
|
||||
for (var i = 0; i < _unspawnedCount; i++)
|
||||
{
|
||||
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
var entity = _entMan.SpawnEntity(_fillPrototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_ammoSlots[idx] = entity;
|
||||
_ammoContainer.Insert(entity);
|
||||
idx++;
|
||||
@@ -125,7 +126,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (!_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -138,7 +139,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
|
||||
public bool TryInsertBullet(EntityUid user, EntityUid entity)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out AmmoComponent? ammoComponent))
|
||||
if (!_entMan.TryGetComponent(entity, out AmmoComponent? ammoComponent))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -208,7 +209,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
EntityUid? bullet = null;
|
||||
if (ammo != default)
|
||||
{
|
||||
var ammoComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AmmoComponent>(ammo);
|
||||
var ammoComponent = _entMan.GetComponent<AmmoComponent>(ammo);
|
||||
bullet = ammoComponent.TakeBullet(spawnAt);
|
||||
if (ammoComponent.Caseless)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Content.Server.Weapon.Ranged
|
||||
[RegisterComponent]
|
||||
public sealed class ServerRangedWeaponComponent : SharedRangedWeaponComponent, IHandSelected
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
@@ -143,12 +144,12 @@ namespace Content.Server.Weapon.Ranged
|
||||
/// <param name="targetPos">Target position on the map to shoot at.</param>
|
||||
private void TryFire(EntityUid user, Vector2 targetPos)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHand?.Owner != Owner)
|
||||
if (!_entMan.TryGetComponent(user, out HandsComponent? hands) || hands.GetActiveHand?.Owner != Owner)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out CombatModeComponent? combat) || !combat.IsInCombatMode)
|
||||
if (!_entMan.TryGetComponent(user, out CombatModeComponent? combat) || !combat.IsInCombatMode)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -176,21 +177,21 @@ namespace Content.Server.Weapon.Ranged
|
||||
// Apply salt to the wound ("Honk!")
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(Owner), _clumsyWeaponHandlingSound.GetSound(),
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
_entMan.GetComponent<TransformComponent>(Owner).Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(Owner), _clumsyWeaponShotSound.GetSound(),
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
_entMan.GetComponent<TransformComponent>(Owner).Coordinates, AudioParams.Default.WithMaxDistance(5));
|
||||
|
||||
user.PopupMessage(Loc.GetString("server-ranged-weapon-component-try-fire-clumsy"));
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_canHotspot)
|
||||
{
|
||||
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).Coordinates, 700, 50);
|
||||
EntitySystem.Get<AtmosphereSystem>().HotspotExpose(_entMan.GetComponent<TransformComponent>(user).Coordinates, 700, 50);
|
||||
}
|
||||
FireHandler?.Invoke(user, targetPos);
|
||||
}
|
||||
|
||||
@@ -15,17 +15,19 @@ namespace Content.Server.Weapon
|
||||
[ComponentReference(typeof(BaseCharger))]
|
||||
public sealed class WeaponCapacitorChargerComponent : BaseCharger
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "WeaponCapacitorCharger";
|
||||
|
||||
public override bool IsEntityCompatible(EntityUid entity)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ServerBatteryBarrelComponent? battery) && battery.PowerCell != null ||
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out PowerCellSlotComponent? slot) && slot.HasCell;
|
||||
return _entMan.TryGetComponent(entity, out ServerBatteryBarrelComponent? battery) && battery.PowerCell != null ||
|
||||
_entMan.TryGetComponent(entity, out PowerCellSlotComponent? slot) && slot.HasCell;
|
||||
}
|
||||
|
||||
protected override BatteryComponent? GetBatteryFrom(EntityUid entity)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out PowerCellSlotComponent? slot))
|
||||
if (_entMan.TryGetComponent(entity, out PowerCellSlotComponent? slot))
|
||||
{
|
||||
if (slot.Cell != null)
|
||||
{
|
||||
@@ -33,7 +35,7 @@ namespace Content.Server.Weapon
|
||||
}
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ServerBatteryBarrelComponent? battery))
|
||||
if (_entMan.TryGetComponent(entity, out ServerBatteryBarrelComponent? battery))
|
||||
{
|
||||
if (battery.PowerCell != null)
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace Content.Server.Window
|
||||
public class WindowComponent : SharedWindowComponent, IExamine, IInteractHand
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private TimeSpan _lastKnockTime;
|
||||
@@ -43,8 +44,8 @@ namespace Content.Server.Window
|
||||
|
||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out DamageableComponent? damageable) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out DestructibleComponent? destructible))
|
||||
if (!_entMan.TryGetComponent(Owner, out DamageableComponent? damageable) ||
|
||||
!_entMan.TryGetComponent(Owner, out DestructibleComponent? destructible))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -104,7 +105,7 @@ namespace Content.Server.Window
|
||||
|
||||
SoundSystem.Play(
|
||||
Filter.Pvs(eventArgs.Target), _knockSound.GetSound(),
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.Target).Coordinates, AudioHelpers.WithVariation(0.05f));
|
||||
_entMan.GetComponent<TransformComponent>(eventArgs.Target).Coordinates, AudioHelpers.WithVariation(0.05f));
|
||||
eventArgs.Target.PopupMessageEveryone(Loc.GetString("comp-window-knock"));
|
||||
|
||||
_lastKnockTime = _gameTiming.CurTime;
|
||||
|
||||
@@ -41,10 +41,11 @@ namespace Content.Shared.Actions.Behaviors.Item
|
||||
Performer = performer;
|
||||
ActionType = actionType;
|
||||
Item = item;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Item, out ItemActions))
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
if (!entMan.TryGetComponent(Item, out ItemActions))
|
||||
{
|
||||
throw new InvalidOperationException($"performer {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(performer).EntityName} tried to perform item action {actionType} " +
|
||||
$" for item {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Item).EntityName} but the item had no ItemActionsComponent," +
|
||||
throw new InvalidOperationException($"performer {entMan.GetComponent<MetaDataComponent>(performer).EntityName} tried to perform item action {actionType} " +
|
||||
$" for item {entMan.GetComponent<MetaDataComponent>(Item).EntityName} but the item had no ItemActionsComponent," +
|
||||
" which should never occur");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Content.Shared.Body.Components
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedBodyPartComponent : Component, IBodyPartContainer
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "BodyPart";
|
||||
|
||||
private SharedBodyComponent? _body;
|
||||
@@ -109,11 +111,11 @@ namespace Content.Shared.Body.Components
|
||||
public BodyPartSymmetry Symmetry { get; private set; } = BodyPartSymmetry.None;
|
||||
|
||||
[ViewVariables]
|
||||
public ISurgeryData? SurgeryDataComponent => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ISurgeryData>(Owner);
|
||||
public ISurgeryData? SurgeryDataComponent => _entMan.GetComponentOrNull<ISurgeryData>(Owner);
|
||||
|
||||
protected virtual void OnAddMechanism(SharedMechanismComponent mechanism)
|
||||
{
|
||||
var prototypeId = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID;
|
||||
var prototypeId = _entMan.GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID;
|
||||
|
||||
if (!_mechanismIds.Contains(prototypeId))
|
||||
{
|
||||
@@ -128,7 +130,7 @@ namespace Content.Shared.Body.Components
|
||||
|
||||
protected virtual void OnRemoveMechanism(SharedMechanismComponent mechanism)
|
||||
{
|
||||
_mechanismIds.Remove(IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID);
|
||||
_mechanismIds.Remove(_entMan.GetComponent<MetaDataComponent>(mechanism.Owner).EntityPrototype!.ID);
|
||||
mechanism.Part = null;
|
||||
SizeUsed -= mechanism.Size;
|
||||
|
||||
@@ -267,7 +269,7 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
if (RemoveMechanism(mechanism))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mechanism.Owner).Coordinates = coordinates;
|
||||
_entMan.GetComponent<TransformComponent>(mechanism.Owner).Coordinates = coordinates;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -292,34 +294,34 @@ namespace Content.Shared.Body.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(mechanism.Owner);
|
||||
_entMan.DeleteEntity(mechanism.Owner);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddedToBody(SharedBodyComponent body)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation = 0;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).AttachParent(body.Owner);
|
||||
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = 0;
|
||||
_entMan.GetComponent<TransformComponent>(Owner).AttachParent(body.Owner);
|
||||
OnAddedToBody(body);
|
||||
|
||||
foreach (var mechanism in _mechanisms)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.Owner, new AddedToBodyEvent(body));
|
||||
_entMan.EventBus.RaiseLocalEvent(mechanism.Owner, new AddedToBodyEvent(body));
|
||||
}
|
||||
}
|
||||
|
||||
private void RemovedFromBody(SharedBodyComponent old)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Deleted)
|
||||
if (!_entMan.GetComponent<TransformComponent>(Owner).Deleted)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).AttachToGridOrMap();
|
||||
_entMan.GetComponent<TransformComponent>(Owner).AttachToGridOrMap();
|
||||
}
|
||||
|
||||
OnRemovedFromBody(old);
|
||||
|
||||
foreach (var mechanism in _mechanisms)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(mechanism.Owner, new RemovedFromBodyEvent(old));
|
||||
_entMan.EventBus.RaiseLocalEvent(mechanism.Owner, new RemovedFromBodyEvent(old));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +360,7 @@ namespace Content.Shared.Body.Components
|
||||
return _mechanisms;
|
||||
}
|
||||
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
entityManager ??= _entMan;
|
||||
|
||||
var mechanisms = new List<SharedMechanismComponent>(MechanismIds.Length);
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
public abstract class SharedMechanismComponent : Component, ISerializationHooks
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Mechanism";
|
||||
|
||||
protected readonly Dictionary<int, object> OptionsCache = new();
|
||||
@@ -37,11 +39,11 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
if (old.Body == null)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new RemovedFromPartEvent(old));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new RemovedFromPartEvent(old));
|
||||
}
|
||||
else
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new RemovedFromPartInBodyEvent(old.Body, old));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new RemovedFromPartInBodyEvent(old.Body, old));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,11 +51,11 @@ namespace Content.Shared.Body.Components
|
||||
{
|
||||
if (value.Body == null)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new AddedToPartEvent(value));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new AddedToPartEvent(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new AddedToPartInBodyEvent(value.Body, value));
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new AddedToPartInBodyEvent(value.Body, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Content.Shared.Hands.Components
|
||||
[NetworkedComponent]
|
||||
public abstract class SharedHandsComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public sealed override string Name => "Hands";
|
||||
|
||||
public event Action? OnItemChanged; //TODO: Try to replace C# event
|
||||
@@ -96,12 +98,12 @@ namespace Content.Shared.Hands.Components
|
||||
UpdateHandVisualizer();
|
||||
Dirty();
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage { Hands = this });
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new HandsModifiedMessage { Hands = this });
|
||||
}
|
||||
|
||||
public void UpdateHandVisualizer()
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var entMan = _entMan;
|
||||
|
||||
if (!entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
return;
|
||||
@@ -377,7 +379,7 @@ namespace Content.Shared.Hands.Components
|
||||
if (!TryGetHand(handName, out var hand))
|
||||
return false;
|
||||
|
||||
return TryDropHeldEntity(hand, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
return TryDropHeldEntity(hand, _entMan.GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -388,7 +390,7 @@ namespace Content.Shared.Hands.Components
|
||||
if (!TryGetHandHoldingEntity(entity, out var hand))
|
||||
return false;
|
||||
|
||||
return TryDropHeldEntity(hand, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
return TryDropHeldEntity(hand, _entMan.GetComponent<TransformComponent>(Owner).Coordinates, checkActionBlocker);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -481,7 +483,7 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
EntitySystem.Get<SharedInteractionSystem>().DroppedInteraction(Owner, heldEntity);
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(heldEntity).WorldPosition = GetFinalDropCoordinates(targetDropLocation);
|
||||
_entMan.GetComponent<TransformComponent>(heldEntity).WorldPosition = GetFinalDropCoordinates(targetDropLocation);
|
||||
|
||||
OnItemChanged?.Invoke();
|
||||
}
|
||||
@@ -491,8 +493,8 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
private Vector2 GetFinalDropCoordinates(EntityCoordinates targetCoords)
|
||||
{
|
||||
var origin = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapPosition;
|
||||
var target = targetCoords.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var origin = _entMan.GetComponent<TransformComponent>(Owner).MapPosition;
|
||||
var target = targetCoords.ToMap(_entMan);
|
||||
|
||||
var dropVector = target.Position - origin.Position;
|
||||
var requestedDropDistance = dropVector.Length;
|
||||
@@ -530,7 +532,7 @@ namespace Content.Shared.Hands.Components
|
||||
/// </summary>
|
||||
private void DropHeldEntityToFloor(Hand hand)
|
||||
{
|
||||
DropHeldEntity(hand, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
DropHeldEntity(hand, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
}
|
||||
|
||||
private bool CanPutHeldEntityIntoContainer(Hand hand, IContainer targetContainer, bool checkActionBlocker)
|
||||
@@ -654,7 +656,7 @@ namespace Content.Shared.Hands.Components
|
||||
if (hand.Name == ActiveHand)
|
||||
SelectActiveHeldEntity();
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).LocalPosition = Vector2.Zero;
|
||||
_entMan.GetComponent<TransformComponent>(entity).LocalPosition = Vector2.Zero;
|
||||
|
||||
OnItemChanged?.Invoke();
|
||||
|
||||
@@ -772,7 +774,7 @@ namespace Content.Shared.Hands.Components
|
||||
|
||||
private void HandCountChanged()
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new HandCountChangedEvent(Owner));
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new HandCountChangedEvent(Owner));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -791,7 +793,7 @@ namespace Content.Shared.Hands.Components
|
||||
var entity = item.Owner;
|
||||
|
||||
if (!TryPutInActiveHandOrAny(entity, checkActionBlocker))
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
_entMan.GetComponent<TransformComponent>(entity).Coordinates = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -203,8 +203,9 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPosition = origin.ToMap(entMan);
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
|
||||
predicate, ignoreInsideBlocker);
|
||||
@@ -217,8 +218,9 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPosition = origin.ToMap(entMan);
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
|
||||
predicate, ignoreInsideBlocker);
|
||||
@@ -231,8 +233,9 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var originPosition = origin.ToMap(IoCManager.Resolve<IEntityManager>());
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var originPosition = origin.ToMap(entMan);
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(originPosition, otherPosition, range,
|
||||
predicate, ignoreInsideBlocker);
|
||||
@@ -246,7 +249,7 @@ namespace Content.Shared.Interaction.Helpers
|
||||
bool ignoreInsideBlocker = true,
|
||||
IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
IoCManager.Resolve(ref entityManager);
|
||||
|
||||
var originPosition = origin.ToMap(entityManager);
|
||||
var otherPosition = other.ToMap(entityManager);
|
||||
@@ -263,7 +266,7 @@ namespace Content.Shared.Interaction.Helpers
|
||||
bool ignoreInsideBlocker = true,
|
||||
IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
IoCManager.Resolve(ref entityManager);
|
||||
|
||||
var originPosition = origin.ToMap(entityManager);
|
||||
|
||||
@@ -280,7 +283,8 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
|
||||
ignoreInsideBlocker);
|
||||
@@ -293,7 +297,8 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
|
||||
ignoreInsideBlocker);
|
||||
@@ -306,7 +311,8 @@ namespace Content.Shared.Interaction.Helpers
|
||||
Ignored? predicate = null,
|
||||
bool ignoreInsideBlocker = true)
|
||||
{
|
||||
var otherPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var otherPosition = entMan.GetComponent<TransformComponent>(other.Owner).MapPosition;
|
||||
|
||||
return ExamineSystemShared.InRangeUnOccluded(origin, otherPosition, range, predicate,
|
||||
ignoreInsideBlocker);
|
||||
@@ -320,7 +326,7 @@ namespace Content.Shared.Interaction.Helpers
|
||||
bool ignoreInsideBlocker = true,
|
||||
IEntityManager? entityManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
IoCManager.Resolve(ref entityManager);
|
||||
|
||||
var otherPosition = other.ToMap(entityManager);
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Content.Shared.Item
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedItemComponent : Component, IEquipped, IUnequipped, IInteractHand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Item";
|
||||
|
||||
/// <summary>
|
||||
@@ -115,10 +117,10 @@ namespace Content.Shared.Item
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(user))
|
||||
return false;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapID != IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapID)
|
||||
if (_entMan.GetComponent<TransformComponent>(user).MapID != _entMan.GetComponent<TransformComponent>(Owner).MapID)
|
||||
return false;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out IPhysBody? physics) || physics.BodyType == BodyType.Static)
|
||||
if (!_entMan.TryGetComponent(Owner, out IPhysBody? physics) || physics.BodyType == BodyType.Static)
|
||||
return false;
|
||||
|
||||
return user.InRangeUnobstructed(Owner, ignoreInsideBlocker: true, popup: popup);
|
||||
@@ -141,7 +143,7 @@ namespace Content.Shared.Item
|
||||
if (!CanPickup(user))
|
||||
return false;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out SharedHandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(user, out SharedHandsComponent? hands))
|
||||
return false;
|
||||
|
||||
var activeHand = hands.ActiveHand;
|
||||
|
||||
@@ -12,14 +12,15 @@ namespace Content.Shared.Lathe
|
||||
[NetworkedComponent()]
|
||||
public class SharedLatheComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
|
||||
|
||||
public override string Name => "Lathe";
|
||||
|
||||
public bool CanProduce(LatheRecipePrototype recipe, int quantity = 1)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedMaterialStorageComponent? storage)
|
||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedLatheDatabaseComponent? database)) return false;
|
||||
if (!_entMan.TryGetComponent(Owner, out SharedMaterialStorageComponent? storage)
|
||||
|| !_entMan.TryGetComponent(Owner, out SharedLatheDatabaseComponent? database)) return false;
|
||||
|
||||
if (!database.Contains(recipe)) return false;
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Content.Shared.MobState.Components
|
||||
[NetworkedComponent]
|
||||
public class MobStateComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "MobState";
|
||||
|
||||
/// <summary>
|
||||
@@ -60,13 +62,13 @@ namespace Content.Shared.MobState.Components
|
||||
else
|
||||
{
|
||||
// Initialize with some amount of damage, defaulting to 0.
|
||||
UpdateState(IoCManager.Resolve<IEntityManager>().GetComponentOrNull<DamageableComponent>(Owner)?.TotalDamage ?? FixedPoint2.Zero);
|
||||
UpdateState(_entMan.GetComponentOrNull<DamageableComponent>(Owner)?.TotalDamage ?? FixedPoint2.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnRemove()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SharedAlertsComponent? status))
|
||||
if (_entMan.TryGetComponent(Owner, out SharedAlertsComponent? status))
|
||||
{
|
||||
status.ClearAlert(AlertType.HumanHealth);
|
||||
}
|
||||
@@ -289,7 +291,7 @@ namespace Content.Shared.MobState.Components
|
||||
/// </summary>
|
||||
private void SetMobState(IMobState? old, (IMobState state, FixedPoint2 threshold)? current)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
var entMan = _entMan;
|
||||
|
||||
if (!current.HasValue)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Content.Shared.Movement
|
||||
{
|
||||
var (walkDir, sprintDir) = mover.VelocityDir;
|
||||
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Owner);
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(mover.Owner);
|
||||
var parentRotation = transform.Parent!.WorldRotation;
|
||||
|
||||
// Regular movement.
|
||||
@@ -105,7 +105,7 @@ namespace Content.Shared.Movement
|
||||
}
|
||||
|
||||
UsedMobMovement[mover.Owner] = true;
|
||||
var transform = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mover.Owner);
|
||||
var transform = EntityManager.GetComponent<TransformComponent>(mover.Owner);
|
||||
var weightless = mover.Owner.IsWeightless(physicsComponent, mapManager: _mapManager, entityManager: _entityManager);
|
||||
var (walkDir, sprintDir) = mover.VelocityDir;
|
||||
|
||||
@@ -164,9 +164,9 @@ namespace Content.Shared.Movement
|
||||
protected bool UseMobMovement(PhysicsComponent body)
|
||||
{
|
||||
return body.BodyStatus == BodyStatus.OnGround &&
|
||||
IoCManager.Resolve<IEntityManager>().HasComponent<MobStateComponent>(body.Owner) &&
|
||||
EntityManager.HasComponent<MobStateComponent>(body.Owner) &&
|
||||
// If we're being pulled then don't mess with our velocity.
|
||||
(!IoCManager.Resolve<IEntityManager>().TryGetComponent(body.Owner, out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||
(!EntityManager.TryGetComponent(body.Owner, out SharedPullableComponent? pullable) || !pullable.BeingPulled) &&
|
||||
_blocker.CanMove((body).Owner);
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace Content.Shared.Movement
|
||||
!otherCollider.CanCollide ||
|
||||
((collider.CollisionMask & otherCollider.CollisionLayer) == 0 &&
|
||||
(otherCollider.CollisionMask & collider.CollisionLayer) == 0) ||
|
||||
(IoCManager.Resolve<IEntityManager>().TryGetComponent(otherCollider.Owner, out SharedPullableComponent? pullable) && pullable.BeingPulled))
|
||||
(EntityManager.TryGetComponent(otherCollider.Owner, out SharedPullableComponent? pullable) && pullable.BeingPulled))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Content.Shared.Storage
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedStorageComponent : Component, IDraggable
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Storage";
|
||||
|
||||
public abstract IReadOnlyList<EntityUid>? StoredEntities { get; }
|
||||
@@ -29,7 +31,7 @@ namespace Content.Shared.Storage
|
||||
|
||||
bool IDraggable.CanDrop(CanDropEvent args)
|
||||
{
|
||||
return IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Target, out PlaceableSurfaceComponent? placeable) &&
|
||||
return _entMan.TryGetComponent(args.Target, out PlaceableSurfaceComponent? placeable) &&
|
||||
placeable.IsPlaceable;
|
||||
}
|
||||
|
||||
@@ -52,7 +54,7 @@ namespace Content.Shared.Storage
|
||||
{
|
||||
if (Remove(storedEntity))
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(storedEntity).WorldPosition = eventArgs.DropLocation.Position;
|
||||
_entMan.GetComponent<TransformComponent>(storedEntity).WorldPosition = eventArgs.DropLocation.Position;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user