Bunch more resolves removed.
This commit is contained in:
@@ -9,13 +9,14 @@ namespace Content.Server.Containers
|
||||
{
|
||||
public static int CountPrototypeOccurencesRecursive(this ContainerManagerComponent mgr, string prototypeId)
|
||||
{
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
int total = 0;
|
||||
foreach (var container in mgr.GetAllContainers())
|
||||
{
|
||||
foreach (var entity in container.ContainedEntities)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityPrototype?.ID == prototypeId) total++;
|
||||
if(!IoCManager.Resolve<IEntityManager>().TryGetComponent<ContainerManagerComponent?>(entity, out var component)) continue;
|
||||
if (entMan.GetComponent<MetaDataComponent>(entity).EntityPrototype?.ID == prototypeId) total++;
|
||||
if(!entMan.TryGetComponent<ContainerManagerComponent?>(entity, out var component)) continue;
|
||||
total += component.CountPrototypeOccurencesRecursive(prototypeId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,18 @@ namespace Content.Server.Coordinates.Helpers
|
||||
{
|
||||
public static class SnapgridHelper
|
||||
{
|
||||
public static void SnapToGrid(this EntityUid entity, IEntityManager? entityManager = null, IMapManager? mapManager = null)
|
||||
public static void SnapToGrid(this EntityUid entity, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).Coordinates.SnapToGrid(entityManager, mapManager);
|
||||
IoCManager.Resolve(ref entMan, ref mapManager);
|
||||
var transform = entMan.GetComponent<TransformComponent>(entity);
|
||||
transform.Coordinates = transform.Coordinates.SnapToGrid(entMan, mapManager);
|
||||
}
|
||||
|
||||
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entityManager = null, IMapManager? mapManager = null)
|
||||
public static EntityCoordinates SnapToGrid(this EntityCoordinates coordinates, IEntityManager? entMan = null, IMapManager? mapManager = null)
|
||||
{
|
||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||
mapManager ??= IoCManager.Resolve<IMapManager>();
|
||||
IoCManager.Resolve(ref entMan, ref mapManager);
|
||||
|
||||
var gridId = coordinates.GetGridId(entityManager);
|
||||
var gridId = coordinates.GetGridId(entMan);
|
||||
|
||||
var tileSize = 1f;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace Content.Server.Crayon
|
||||
[RegisterComponent]
|
||||
public class CrayonComponent : SharedCrayonComponent, IAfterInteract, IUse, IDropped, ISerializationHooks
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
[DataField("useSound")]
|
||||
@@ -91,7 +92,7 @@ namespace Content.Server.Crayon
|
||||
// Opens the selection window
|
||||
bool IUse.UseEntity(UseEntityEventArgs eventArgs)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
{
|
||||
UserInterface?.Toggle(actor.PlayerSession);
|
||||
if (UserInterface?.SessionHasOpen(actor.PlayerSession) == true)
|
||||
@@ -119,7 +120,7 @@ namespace Content.Server.Crayon
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!eventArgs.ClickLocation.IsValid(IoCManager.Resolve<IEntityManager>()))
|
||||
if (!eventArgs.ClickLocation.IsValid(_entMan))
|
||||
{
|
||||
eventArgs.User.PopupMessage(Loc.GetString("crayon-interact-invalid-location"));
|
||||
return true;
|
||||
@@ -140,7 +141,7 @@ namespace Content.Server.Crayon
|
||||
|
||||
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if (_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
UserInterface?.Close(actor.PlayerSession);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ namespace Content.Server.Cuffs.Components
|
||||
[ComponentReference(typeof(SharedCuffableComponent))]
|
||||
public class CuffableComponent : SharedCuffableComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
/// <summary>
|
||||
/// How many of this entity's hands are currently cuffed.
|
||||
/// </summary>
|
||||
@@ -64,7 +66,7 @@ namespace Content.Server.Cuffs.Components
|
||||
|
||||
if (CuffedHandCount > 0)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<HandcuffComponent?>(LastAddedCuffs, out var cuffs))
|
||||
if (_entMan.TryGetComponent<HandcuffComponent?>(LastAddedCuffs, out var cuffs))
|
||||
{
|
||||
return new CuffableComponentState(CuffedHandCount,
|
||||
CanStillInteract,
|
||||
@@ -89,7 +91,7 @@ namespace Content.Server.Cuffs.Components
|
||||
/// <param name="prototype"></param>
|
||||
public bool TryAddNewCuffs(EntityUid user, EntityUid handcuff)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<HandcuffComponent>(handcuff))
|
||||
if (!_entMan.HasComponent<HandcuffComponent>(handcuff))
|
||||
{
|
||||
Logger.Warning($"Handcuffs being applied to player are missing a {nameof(HandcuffComponent)}!");
|
||||
return false;
|
||||
@@ -102,14 +104,14 @@ namespace Content.Server.Cuffs.Components
|
||||
}
|
||||
|
||||
// Success!
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? handsComponent) && handsComponent.IsHolding(handcuff))
|
||||
if (_entMan.TryGetComponent(user, out HandsComponent? handsComponent) && handsComponent.IsHolding(handcuff))
|
||||
{
|
||||
// Good lord handscomponent is scuffed, I hope some smug person will fix it someday
|
||||
handsComponent.Drop(handcuff);
|
||||
}
|
||||
|
||||
Container.Insert(handcuff);
|
||||
CanStillInteract = IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out HandsComponent? ownerHands) && ownerHands.HandNames.Count() > CuffedHandCount;
|
||||
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? ownerHands) && ownerHands.HandNames.Count() > CuffedHandCount;
|
||||
|
||||
OnCuffedStateChanged?.Invoke();
|
||||
UpdateAlert();
|
||||
@@ -129,7 +131,7 @@ namespace Content.Server.Cuffs.Components
|
||||
/// </summary>
|
||||
public void UpdateHeldItems()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out HandsComponent? handsComponent)) return;
|
||||
if (!_entMan.TryGetComponent(Owner, out HandsComponent? handsComponent)) return;
|
||||
|
||||
var itemCount = handsComponent.GetAllHeldItems().Count();
|
||||
var freeHandCount = handsComponent.HandNames.Count() - CuffedHandCount;
|
||||
@@ -156,7 +158,7 @@ namespace Content.Server.Cuffs.Components
|
||||
/// </summary>
|
||||
private void UpdateAlert()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ServerAlertsComponent? status))
|
||||
if (_entMan.TryGetComponent(Owner, out ServerAlertsComponent? status))
|
||||
{
|
||||
if (CanStillInteract)
|
||||
{
|
||||
@@ -198,14 +200,14 @@ namespace Content.Server.Cuffs.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<HandcuffComponent?>(cuffsToRemove, out var cuff))
|
||||
if (!_entMan.TryGetComponent<HandcuffComponent?>(cuffsToRemove, out var cuff))
|
||||
{
|
||||
Logger.Warning($"A user is trying to remove handcuffs without a {nameof(HandcuffComponent)}. This should never happen!");
|
||||
return;
|
||||
}
|
||||
|
||||
var attempt = new UncuffAttemptEvent(user, Owner);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(user, attempt);
|
||||
_entMan.EventBus.RaiseLocalEvent(user, attempt);
|
||||
|
||||
if (attempt.Cancelled)
|
||||
{
|
||||
@@ -257,23 +259,23 @@ namespace Content.Server.Cuffs.Components
|
||||
SoundSystem.Play(Filter.Pvs(Owner), cuff.EndUncuffSound.GetSound(), Owner);
|
||||
|
||||
Container.ForceRemove(cuffsToRemove);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cuffsToRemove).AttachToGridOrMap();
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(cuffsToRemove).WorldPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).WorldPosition;
|
||||
_entMan.GetComponent<TransformComponent>(cuffsToRemove).AttachToGridOrMap();
|
||||
_entMan.GetComponent<TransformComponent>(cuffsToRemove).WorldPosition = _entMan.GetComponent<TransformComponent>(Owner).WorldPosition;
|
||||
|
||||
if (cuff.BreakOnRemove)
|
||||
{
|
||||
cuff.Broken = true;
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(cuffsToRemove).EntityName = cuff.BrokenName;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(cuffsToRemove).EntityDescription = cuff.BrokenDesc;
|
||||
_entMan.GetComponent<MetaDataComponent>(cuffsToRemove).EntityName = cuff.BrokenName;
|
||||
_entMan.GetComponent<MetaDataComponent>(cuffsToRemove).EntityDescription = cuff.BrokenDesc;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SpriteComponent?>(cuffsToRemove, out var sprite) && cuff.BrokenState != null)
|
||||
if (_entMan.TryGetComponent<SpriteComponent?>(cuffsToRemove, out var sprite) && cuff.BrokenState != null)
|
||||
{
|
||||
sprite.LayerSetState(0, cuff.BrokenState); // TODO: safety check to see if RSI contains the state?
|
||||
}
|
||||
}
|
||||
|
||||
CanStillInteract = IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.HandNames.Count() > CuffedHandCount;
|
||||
CanStillInteract = _entMan.TryGetComponent(Owner, out HandsComponent? handsComponent) && handsComponent.HandNames.Count() > CuffedHandCount;
|
||||
OnCuffedStateChanged?.Invoke();
|
||||
UpdateAlert();
|
||||
Dirty();
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Content.Server.Damage.Commands
|
||||
string[] args,
|
||||
[NotNullWhen(true)] out Damage? func)
|
||||
{
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!int.TryParse(args[1], out var amount))
|
||||
{
|
||||
@@ -99,7 +99,7 @@ namespace Content.Server.Damage.Commands
|
||||
var damage = new DamageSpecifier(damageGroup, amount);
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
|
||||
|
||||
shell.WriteLine($"Damaged entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageGroup} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
shell.WriteLine($"Damaged entity {entMan.GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageGroup} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
};
|
||||
|
||||
return true;
|
||||
@@ -112,7 +112,7 @@ namespace Content.Server.Damage.Commands
|
||||
var damage = new DamageSpecifier(damageType, amount);
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(entity, damage, ignoreResistances);
|
||||
|
||||
shell.WriteLine($"Damaged entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
shell.WriteLine($"Damaged entity {entMan.GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} for {amount} {damageType} damage{(ignoreResistances ? ", ignoring resistances." : ".")}");
|
||||
|
||||
};
|
||||
return true;
|
||||
@@ -137,6 +137,8 @@ namespace Content.Server.Damage.Commands
|
||||
EntityUid entity;
|
||||
Damage? damageFunc;
|
||||
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
switch (args.Length)
|
||||
{
|
||||
// Check if we have enough for the dmg types to show
|
||||
@@ -190,9 +192,9 @@ namespace Content.Server.Damage.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out DamageableComponent? damageable))
|
||||
if (!entMan.TryGetComponent(entity, out DamageableComponent? damageable))
|
||||
{
|
||||
shell.WriteLine($"Entity {IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} does not have a {nameof(DamageableComponent)}.");
|
||||
shell.WriteLine($"Entity {entMan.GetComponent<MetaDataComponent>(entity).EntityName} with id {entity} does not have a {nameof(DamageableComponent)}.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,14 +15,16 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalEntryComponent : DisposalTubeComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private const string HolderPrototypeId = "DisposalHolder";
|
||||
|
||||
public override string Name => "DisposalEntry";
|
||||
|
||||
public bool TryInsert(DisposalUnitComponent from)
|
||||
{
|
||||
var holder = IoCManager.Resolve<IEntityManager>().SpawnEntity(HolderPrototypeId, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapPosition);
|
||||
var holderComponent = IoCManager.Resolve<IEntityManager>().GetComponent<DisposalHolderComponent>(holder);
|
||||
var holder = _entMan.SpawnEntity(HolderPrototypeId, _entMan.GetComponent<TransformComponent>(Owner).MapPosition);
|
||||
var holderComponent = _entMan.GetComponent<DisposalHolderComponent>(holder);
|
||||
|
||||
foreach (var entity in from.ContainedEntities.ToArray())
|
||||
{
|
||||
@@ -37,7 +39,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
protected override Direction[] ConnectableDirections()
|
||||
{
|
||||
return new[] {IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir()};
|
||||
return new[] {_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir()};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalJunctionComponent : DisposalTubeComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,14 +28,14 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
protected override Direction[] ConnectableDirections()
|
||||
{
|
||||
var direction = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation;
|
||||
var direction = _entMan.GetComponent<TransformComponent>(Owner).LocalRotation;
|
||||
|
||||
return _degrees.Select(degree => new Angle(degree.Theta + direction.Theta).GetDir()).ToArray();
|
||||
}
|
||||
|
||||
public override Direction NextDirection(DisposalHolderComponent holder)
|
||||
{
|
||||
var next = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
var next = _entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
var directions = ConnectableDirections().Skip(1).ToArray();
|
||||
|
||||
if (holder.PreviousDirectionFrom == Direction.Invalid ||
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalRouterComponent : DisposalJunctionComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "DisposalRouter";
|
||||
|
||||
[ViewVariables]
|
||||
@@ -36,7 +38,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out IPhysBody? physics) ||
|
||||
!_entMan.TryGetComponent(Owner, out IPhysBody? physics) ||
|
||||
physics.BodyType == BodyType.Static;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalRouterUiKey.Key);
|
||||
@@ -52,7 +54,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
return directions[1];
|
||||
}
|
||||
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
return _entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetDir();
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
@@ -160,12 +162,12 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
||||
void IActivate.Activate(ActivateEventArgs args)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out HandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
||||
{
|
||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-router-window-tag-input-activate-no-hands"));
|
||||
return;
|
||||
|
||||
@@ -26,6 +26,8 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalTaggerComponent : DisposalTransitComponent, IActivate
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "DisposalTagger";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -33,7 +35,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
physics.BodyType == BodyType.Static;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(DisposalTaggerUiKey.Key);
|
||||
@@ -126,12 +128,12 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
/// <param name="args">Data relevant to the event such as the actor which triggered it.</param>
|
||||
void IActivate.Activate(ActivateEventArgs args)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out HandsComponent? hands))
|
||||
if (!_entMan.TryGetComponent(args.User, out HandsComponent? hands))
|
||||
{
|
||||
Owner.PopupMessage(args.User, Loc.GetString("disposal-tagger-window-activate-no-hands"));
|
||||
return;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
{
|
||||
public abstract class DisposalTubeComponent : Component, IDisposalTubeComponent, IBreakAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public static readonly TimeSpan ClangDelay = TimeSpan.FromSeconds(0.5);
|
||||
public TimeSpan LastClang;
|
||||
|
||||
@@ -35,7 +37,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
[ViewVariables]
|
||||
private bool Anchored =>
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics) ||
|
||||
physics.BodyType == BodyType.Static;
|
||||
|
||||
/// <summary>
|
||||
@@ -88,7 +90,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
foreach (var entity in Contents.ContainedEntities.ToArray())
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out DisposalHolderComponent? holder))
|
||||
if (!_entMan.TryGetComponent(entity, out DisposalHolderComponent? holder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -106,7 +108,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
private void UpdateVisualState()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (!_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -122,7 +124,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
|
||||
public void AnchoredChanged()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physics))
|
||||
if (!_entMan.TryGetComponent(Owner, out PhysicsComponent? physics))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
[RegisterComponent]
|
||||
public class DisposalHolderComponent : Component, IGasMixtureHolder
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "DisposalHolder";
|
||||
|
||||
public Container Container = null!;
|
||||
@@ -79,8 +81,8 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
return IoCManager.Resolve<IEntityManager>().HasComponent<ItemComponent>(entity) ||
|
||||
IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity);
|
||||
return _entMan.HasComponent<ItemComponent>(entity) ||
|
||||
_entMan.HasComponent<SharedBodyComponent>(entity);
|
||||
}
|
||||
|
||||
public bool TryInsert(EntityUid entity)
|
||||
@@ -90,7 +92,7 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out IPhysBody? physics))
|
||||
if (_entMan.TryGetComponent(entity, out IPhysBody? physics))
|
||||
{
|
||||
physics.CanCollide = false;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace Content.Server.Doors.Components
|
||||
[RegisterComponent]
|
||||
public class FirelockComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Firelock";
|
||||
|
||||
[ComponentDependency]
|
||||
@@ -31,7 +33,7 @@ namespace Content.Server.Doors.Components
|
||||
if (DoorComponent != null && DoorComponent.State == SharedDoorComponent.DoorState.Open && DoorComponent.CanCloseGeneric())
|
||||
{
|
||||
DoorComponent.Close();
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
if (_entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
{
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||
}
|
||||
@@ -47,7 +49,7 @@ namespace Content.Server.Doors.Components
|
||||
var minMoles = float.MaxValue;
|
||||
var maxMoles = 0f;
|
||||
|
||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates))
|
||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTileMixtures(_entMan.GetComponent<TransformComponent>(Owner).Coordinates))
|
||||
{
|
||||
var moles = adjacent.TotalMoles;
|
||||
if (moles < minMoles)
|
||||
@@ -63,7 +65,7 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
var atmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
|
||||
if (!atmosphereSystem.TryGetGridAndTile(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates, out var tuple))
|
||||
if (!atmosphereSystem.TryGetGridAndTile(_entMan.GetComponent<TransformComponent>(Owner).Coordinates, out var tuple))
|
||||
return false;
|
||||
|
||||
if (atmosphereSystem.GetTileMixture(tuple.Value.Grid, tuple.Value.Tile) == null)
|
||||
@@ -72,7 +74,7 @@ namespace Content.Server.Doors.Components
|
||||
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, tuple.Value.Tile))
|
||||
return true;
|
||||
|
||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates))
|
||||
foreach (var adjacent in atmosphereSystem.GetAdjacentTiles(_entMan.GetComponent<TransformComponent>(Owner).Coordinates))
|
||||
{
|
||||
if (atmosphereSystem.IsHotspotActive(tuple.Value.Grid, adjacent))
|
||||
return true;
|
||||
|
||||
@@ -38,6 +38,8 @@ namespace Content.Server.Doors.Components
|
||||
[ComponentReference(typeof(SharedDoorComponent))]
|
||||
public class ServerDoorComponent : SharedDoorComponent, IActivate, IInteractUsing, IMapInit
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("board", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
private string? _boardPrototype;
|
||||
@@ -77,7 +79,7 @@ namespace Content.Server.Doors.Components
|
||||
_ => throw new ArgumentOutOfRangeException(),
|
||||
};
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new DoorStateChangedEvent(State), false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new DoorStateChangedEvent(State), false);
|
||||
_autoCloseCancelTokenSource?.Cancel();
|
||||
|
||||
Dirty();
|
||||
@@ -219,7 +221,7 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
if (!CanWeldShut)
|
||||
{
|
||||
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' is true, but door cannot be welded.", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' is true, but door cannot be welded.", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
return;
|
||||
}
|
||||
SetAppearance(DoorVisualState.Welded);
|
||||
@@ -242,7 +244,7 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
if (IsWeldedShut)
|
||||
{
|
||||
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' and 'startOpen' are both true.", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
Logger.Warning("{0} prototype loaded with incompatible flags: 'welded' and 'startOpen' are both true.", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
return;
|
||||
}
|
||||
QuickOpen(false);
|
||||
@@ -257,7 +259,7 @@ namespace Content.Server.Doors.Components
|
||||
return;
|
||||
|
||||
var ev = new DoorClickShouldActivateEvent(eventArgs);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
if (ev.Handled)
|
||||
return;
|
||||
|
||||
@@ -276,7 +278,7 @@ namespace Content.Server.Doors.Components
|
||||
public void TryOpen(EntityUid user = default)
|
||||
{
|
||||
var msg = new DoorOpenAttemptEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, msg);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, msg);
|
||||
|
||||
if (msg.Cancelled) return;
|
||||
|
||||
@@ -289,7 +291,7 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
Open();
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(user, out HandsComponent? hands) && hands.Count == 0)
|
||||
if (_entMan.TryGetComponent(user, out HandsComponent? hands) && hands.Count == 0)
|
||||
{
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _tryOpenDoorSound.GetSound(), Owner,
|
||||
AudioParams.Default.WithVolume(-2));
|
||||
@@ -308,7 +310,7 @@ namespace Content.Server.Doors.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AccessReader? access))
|
||||
if (!_entMan.TryGetComponent(Owner, out AccessReader? access))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -332,7 +334,7 @@ namespace Content.Server.Doors.Components
|
||||
/// </summary>
|
||||
private bool HasAccessType(string accessType)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AccessReader? access))
|
||||
if (_entMan.TryGetComponent(Owner, out AccessReader? access))
|
||||
{
|
||||
return access.AccessLists.Any(list => list.Contains(accessType));
|
||||
}
|
||||
@@ -353,7 +355,7 @@ namespace Content.Server.Doors.Components
|
||||
}
|
||||
|
||||
var ev = new BeforeDoorOpenedEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
@@ -363,12 +365,12 @@ namespace Content.Server.Doors.Components
|
||||
public void Open()
|
||||
{
|
||||
State = DoorState.Opening;
|
||||
if (Occludes && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||
if (Occludes && _entMan.TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||
{
|
||||
occluder.Enabled = false;
|
||||
}
|
||||
|
||||
if (ChangeAirtight && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
if (ChangeAirtight && _entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
{
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||
}
|
||||
@@ -396,17 +398,17 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
base.OnPartialOpen();
|
||||
|
||||
if (ChangeAirtight && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
if (ChangeAirtight && _entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
{
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
|
||||
}
|
||||
|
||||
private void QuickOpen(bool refresh)
|
||||
{
|
||||
if (Occludes && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||
if (Occludes && _entMan.TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||
{
|
||||
occluder.Enabled = false;
|
||||
}
|
||||
@@ -423,7 +425,7 @@ namespace Content.Server.Doors.Components
|
||||
public void TryClose(EntityUid user = default)
|
||||
{
|
||||
var msg = new DoorCloseAttemptEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, msg);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, msg);
|
||||
|
||||
if (msg.Cancelled) return;
|
||||
|
||||
@@ -443,7 +445,7 @@ namespace Content.Server.Doors.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AccessReader? access))
|
||||
if (!_entMan.TryGetComponent(Owner, out AccessReader? access))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -459,7 +461,7 @@ namespace Content.Server.Doors.Components
|
||||
public bool CanCloseGeneric()
|
||||
{
|
||||
var ev = new BeforeDoorClosedEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
if (ev.Cancelled)
|
||||
return false;
|
||||
|
||||
@@ -469,7 +471,7 @@ namespace Content.Server.Doors.Components
|
||||
private bool SafetyCheck()
|
||||
{
|
||||
var ev = new DoorSafetyEnabledEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
return ev.Safety || _inhibitCrush;
|
||||
}
|
||||
|
||||
@@ -481,7 +483,7 @@ namespace Content.Server.Doors.Components
|
||||
{
|
||||
var safety = SafetyCheck();
|
||||
|
||||
if (safety && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PhysicsComponent? physicsComponent))
|
||||
if (safety && _entMan.TryGetComponent(Owner, out PhysicsComponent? physicsComponent))
|
||||
{
|
||||
var broadPhaseSystem = EntitySystem.Get<SharedPhysicsSystem>();
|
||||
|
||||
@@ -525,7 +527,7 @@ namespace Content.Server.Doors.Components
|
||||
OnPartialClose();
|
||||
await Timer.Delay(CloseTimeTwo, _stateChangeCancelTokenSource.Token);
|
||||
|
||||
if (Occludes && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||
if (Occludes && _entMan.TryGetComponent(Owner, out OccluderComponent? occluder))
|
||||
{
|
||||
occluder.Enabled = true;
|
||||
}
|
||||
@@ -541,12 +543,12 @@ namespace Content.Server.Doors.Components
|
||||
// if safety is off, crushes people inside of the door, temporarily turning off collisions with them while doing so.
|
||||
var becomeairtight = ChangeAirtight && (SafetyCheck() || !TryCrush());
|
||||
|
||||
if (becomeairtight && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
if (becomeairtight && _entMan.TryGetComponent(Owner, out AirtightComponent? airtight))
|
||||
{
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, true);
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, true));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -581,7 +583,7 @@ namespace Content.Server.Doors.Components
|
||||
hitsomebody = true;
|
||||
CurrentlyCrushing.Add(e.Owner);
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<DamageableComponent>(e.Owner))
|
||||
if (_entMan.HasComponent<DamageableComponent>(e.Owner))
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(e.Owner, CrushDamage);
|
||||
|
||||
EntitySystem.Get<StunSystem>().TryParalyze(e.Owner, TimeSpan.FromSeconds(DoorStunTime), true);
|
||||
@@ -602,7 +604,7 @@ namespace Content.Server.Doors.Components
|
||||
public void Deny()
|
||||
{
|
||||
var ev = new BeforeDoorDeniedEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
if (ev.Cancelled)
|
||||
return;
|
||||
|
||||
@@ -649,14 +651,14 @@ namespace Content.Server.Doors.Components
|
||||
return;
|
||||
|
||||
var autoev = new BeforeDoorAutoCloseEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, autoev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, autoev, false);
|
||||
if (autoev.Cancelled)
|
||||
return;
|
||||
|
||||
_autoCloseCancelTokenSource = new();
|
||||
|
||||
var ev = new DoorGetCloseTimeModifierEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
var realCloseTime = AutoCloseDelay * ev.CloseTimeModifier;
|
||||
|
||||
Owner.SpawnRepeatingTimer(realCloseTime, async () =>
|
||||
@@ -671,7 +673,7 @@ namespace Content.Server.Doors.Components
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if(!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out ToolComponent? tool))
|
||||
if(!_entMan.TryGetComponent(eventArgs.Using, out ToolComponent? tool))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -682,10 +684,10 @@ namespace Content.Server.Doors.Components
|
||||
if (tool.Qualities.Contains(_pryingQuality) && !IsWeldedShut)
|
||||
{
|
||||
var ev = new DoorGetPryTimeModifierEvent();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, ev, false);
|
||||
|
||||
var canEv = new BeforeDoorPryEvent(eventArgs);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, canEv, false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, canEv, false);
|
||||
|
||||
if (canEv.Cancelled) return false;
|
||||
|
||||
@@ -694,7 +696,7 @@ namespace Content.Server.Doors.Components
|
||||
|
||||
if (successfulPry && !IsWeldedShut)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new OnDoorPryEvent(eventArgs), false);
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new OnDoorPryEvent(eventArgs), false);
|
||||
if (State == DoorState.Closed)
|
||||
{
|
||||
Open();
|
||||
@@ -708,7 +710,7 @@ namespace Content.Server.Doors.Components
|
||||
}
|
||||
|
||||
// for welding doors
|
||||
if (CanWeldShut && IoCManager.Resolve<IEntityManager>().TryGetComponent(tool.Owner, out WelderComponent? welder) && welder.Lit)
|
||||
if (CanWeldShut && _entMan.TryGetComponent(tool.Owner, out WelderComponent? welder) && welder.Lit)
|
||||
{
|
||||
if(!_beingWelded)
|
||||
{
|
||||
@@ -743,7 +745,7 @@ namespace Content.Server.Doors.Components
|
||||
private void CreateDoorElectronicsBoard()
|
||||
{
|
||||
// Ensure that the construction component is aware of the board container.
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ConstructionComponent? construction))
|
||||
if (_entMan.TryGetComponent(Owner, out ConstructionComponent? construction))
|
||||
EntitySystem.Get<ConstructionSystem>().AddContainer(Owner, "board", construction);
|
||||
|
||||
// We don't do anything if this is null or empty.
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace Content.Server.Explosion.Components
|
||||
[RegisterComponent]
|
||||
public sealed class ClusterFlashComponent : Component, IInteractUsing, IUse
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "ClusterFlash";
|
||||
|
||||
private Container _grenadesContainer = default!;
|
||||
@@ -59,7 +61,7 @@ namespace Content.Server.Explosion.Components
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs args)
|
||||
{
|
||||
if (_grenadesContainer.ContainedEntities.Count >= _maxGrenades ||
|
||||
!IoCManager.Resolve<IEntityManager>().HasComponent<FlashOnTriggerComponent>(args.Using))
|
||||
!_entMan.HasComponent<FlashOnTriggerComponent>(args.Using))
|
||||
return false;
|
||||
|
||||
_grenadesContainer.Insert(args.Using);
|
||||
@@ -92,7 +94,7 @@ namespace Content.Server.Explosion.Components
|
||||
return false;
|
||||
Owner.SpawnTimer((int) (_delay * 1000), () =>
|
||||
{
|
||||
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)
|
||||
return;
|
||||
_countDown = true;
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
@@ -115,14 +117,14 @@ namespace Content.Server.Explosion.Components
|
||||
|
||||
grenade.SpawnTimer(delay, () =>
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(grenade) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(grenade).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
if ((!_entMan.EntityExists(grenade) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(grenade).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
return;
|
||||
|
||||
EntitySystem.Get<TriggerSystem>().Trigger(grenade, eventArgs.User);
|
||||
});
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@@ -134,7 +136,7 @@ namespace Content.Server.Explosion.Components
|
||||
if (_unspawnedCount > 0)
|
||||
{
|
||||
_unspawnedCount--;
|
||||
grenade = IoCManager.Resolve<IEntityManager>().SpawnEntity(_fillPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).MapPosition);
|
||||
grenade = _entMan.SpawnEntity(_fillPrototype, _entMan.GetComponent<TransformComponent>(Owner).MapPosition);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -154,7 +156,7 @@ namespace Content.Server.Explosion.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance)) return;
|
||||
if (!_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance)) return;
|
||||
|
||||
appearance.SetData(ClusterFlashVisuals.GrenadesCounter, _grenadesContainer.ContainedEntities.Count + _unspawnedCount);
|
||||
}
|
||||
|
||||
@@ -9,19 +9,21 @@ namespace Content.Server.Explosion.Components
|
||||
[RegisterComponent]
|
||||
public class ExplosionLaunchedComponent : Component, IExAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "ExplosionLaunched";
|
||||
|
||||
void IExAct.OnExplosion(ExplosionEventArgs eventArgs)
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
if (_entMan.Deleted(Owner))
|
||||
return;
|
||||
|
||||
var sourceLocation = eventArgs.Source;
|
||||
var targetLocation = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.Target).Coordinates;
|
||||
var targetLocation = _entMan.GetComponent<TransformComponent>(eventArgs.Target).Coordinates;
|
||||
|
||||
if (sourceLocation.Equals(targetLocation)) return;
|
||||
|
||||
var offset = (targetLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()) - sourceLocation.ToMapPos(IoCManager.Resolve<IEntityManager>()));
|
||||
var offset = (targetLocation.ToMapPos(_entMan) - sourceLocation.ToMapPos(_entMan));
|
||||
|
||||
//Don't throw if the direction is center (0,0)
|
||||
if (offset == Vector2.Zero) return;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace Content.Server.Extinguisher
|
||||
[RegisterComponent]
|
||||
public class FireExtinguisherComponent : SharedFireExtinguisherComponent, IAfterInteract, IUse, IActivate, IDropped
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "FireExtinguisher";
|
||||
|
||||
[DataField("refillSound")]
|
||||
@@ -58,7 +60,7 @@ namespace Content.Server.Extinguisher
|
||||
}
|
||||
|
||||
if (eventArgs.Target is not {Valid: true} target ||
|
||||
!IoCManager.Resolve<IEntityManager>().HasComponent<ReagentTankComponent>(target) ||
|
||||
!_entMan.HasComponent<ReagentTankComponent>(target) ||
|
||||
!solutionContainerSystem.TryGetDrainableSolution(target, out var targetSolution) ||
|
||||
!solutionContainerSystem.TryGetDrainableSolution(Owner, out var container))
|
||||
{
|
||||
@@ -103,13 +105,13 @@ namespace Content.Server.Extinguisher
|
||||
|
||||
_safety = state;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
appearance.SetData(FireExtinguisherVisuals.Safety, _safety);
|
||||
}
|
||||
|
||||
void IDropped.Dropped(DroppedEventArgs eventArgs)
|
||||
{
|
||||
if (_hasSafety && IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_hasSafety && _entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
appearance.SetData(FireExtinguisherVisuals.Safety, _safety);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Content.Server.Fluids.Components
|
||||
[RegisterComponent]
|
||||
public class BucketComponent : Component, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Bucket";
|
||||
public const string SolutionName = "bucket";
|
||||
|
||||
@@ -56,7 +58,7 @@ namespace Content.Server.Fluids.Components
|
||||
var solutionsSys = EntitySystem.Get<SolutionContainerSystem>();
|
||||
if (!solutionsSys.TryGetSolution(Owner, SolutionName, out var contents) ||
|
||||
_currentlyUsing.Contains(eventArgs.Using) ||
|
||||
!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out MopComponent? mopComponent) ||
|
||||
!_entMan.TryGetComponent(eventArgs.Using, out MopComponent? mopComponent) ||
|
||||
mopComponent.Mopping)
|
||||
{
|
||||
return false;
|
||||
@@ -87,7 +89,7 @@ namespace Content.Server.Fluids.Components
|
||||
_currentlyUsing.Remove(eventArgs.Using);
|
||||
|
||||
if (result == DoAfterStatus.Cancelled ||
|
||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
(!_entMan.EntityExists(Owner) ? EntityLifeStage.Deleted : _entMan.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
mopComponent.Deleted ||
|
||||
CurrentVolume <= 0 ||
|
||||
!Owner.InRangeUnobstructed(mopComponent.Owner))
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace Content.Server.Fluids.Components
|
||||
Mopping = false;
|
||||
|
||||
if (result == DoAfterStatus.Cancelled ||
|
||||
(!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
(!_entities.EntityExists(Owner) ? EntityLifeStage.Deleted : _entities.GetComponent<MetaDataComponent>(Owner).EntityLifeStage) >= EntityLifeStage.Deleted ||
|
||||
puddleComponent.Deleted)
|
||||
return false;
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace Content.Server.Fluids.Components
|
||||
// is the puddle cleaned?
|
||||
if (puddleSolution.TotalVolume - transferAmount <= 0)
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(puddleComponent.Owner);
|
||||
_entities.DeleteEntity(puddleComponent.Owner);
|
||||
|
||||
// After cleaning the puddle, make a new puddle with solution from the mop as a "wet floor". Then evaporate it slowly.
|
||||
// we do this WITHOUT adding to the existing puddle. Otherwise we have might have water puddles with the vomit sprite.
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Content.Server.Fluids.Components
|
||||
public const float SprayDistance = 3f;
|
||||
public const string SolutionName = "spray";
|
||||
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
[DataField("transferAmount")]
|
||||
@@ -99,8 +100,8 @@ namespace Content.Server.Fluids.Components
|
||||
if(curTime < _cooldownEnd)
|
||||
return true;
|
||||
|
||||
var playerPos = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates;
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
var playerPos = _entMan.GetComponent<TransformComponent>(eventArgs.User).Coordinates;
|
||||
var entManager = _entMan;
|
||||
|
||||
if (eventArgs.ClickLocation.GetGridId(entManager) != playerPos.GetGridId(entManager))
|
||||
return true;
|
||||
@@ -124,10 +125,10 @@ namespace Content.Server.Fluids.Components
|
||||
var diffNorm = diffPos.Normalized;
|
||||
var diffLength = diffPos.Length;
|
||||
|
||||
var target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
||||
var target = _entMan.GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset((diffNorm + rotation.ToVec()).Normalized * diffLength + quarter);
|
||||
|
||||
if (target.TryDistance(IoCManager.Resolve<IEntityManager>(), playerPos, out var distance) && distance > SprayDistance)
|
||||
target = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset(diffNorm * SprayDistance);
|
||||
if (target.TryDistance(_entMan, playerPos, out var distance) && distance > SprayDistance)
|
||||
target = _entMan.GetComponent<TransformComponent>(eventArgs.User).Coordinates.Offset(diffNorm * SprayDistance);
|
||||
|
||||
var solution = EntitySystem.Get<SolutionContainerSystem>().SplitSolution(Owner, contents, _transferAmount);
|
||||
|
||||
@@ -135,24 +136,24 @@ namespace Content.Server.Fluids.Components
|
||||
break;
|
||||
|
||||
var vapor = entManager.SpawnEntity(_vaporPrototype, playerPos.Offset(distance < 1 ? quarter : threeQuarters));
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor).LocalRotation = rotation;
|
||||
_entMan.GetComponent<TransformComponent>(vapor).LocalRotation = rotation;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(vapor, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(vapor, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(VaporVisuals.Color, contents.Color.WithAlpha(1f));
|
||||
appearance.SetData(VaporVisuals.State, true);
|
||||
}
|
||||
|
||||
// Add the solution to the vapor and actually send the thing
|
||||
var vaporComponent = IoCManager.Resolve<IEntityManager>().GetComponent<VaporComponent>(vapor);
|
||||
var vaporComponent = _entMan.GetComponent<VaporComponent>(vapor);
|
||||
var vaporSystem = EntitySystem.Get<VaporSystem>();
|
||||
vaporSystem.TryAddSolution(vaporComponent, solution);
|
||||
|
||||
// impulse direction is defined in world-coordinates, not local coordinates
|
||||
var impulseDirection = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(vapor).WorldRotation.ToVec();
|
||||
var impulseDirection = _entMan.GetComponent<TransformComponent>(vapor).WorldRotation.ToVec();
|
||||
vaporSystem.Start(vaporComponent, impulseDirection, _sprayVelocity, target, _sprayAliveTime);
|
||||
|
||||
if (_impulse > 0f && IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out IPhysBody? body))
|
||||
if (_impulse > 0f && _entMan.TryGetComponent(eventArgs.User, out IPhysBody? body))
|
||||
{
|
||||
body.ApplyLinearImpulse(-impulseDirection * _impulse);
|
||||
}
|
||||
@@ -163,7 +164,7 @@ namespace Content.Server.Fluids.Components
|
||||
_lastUseTime = curTime;
|
||||
_cooldownEnd = _lastUseTime + TimeSpan.FromSeconds(_cooldownTime);
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ItemCooldownComponent? cooldown))
|
||||
if (_entMan.TryGetComponent(Owner, out ItemCooldownComponent? cooldown))
|
||||
{
|
||||
cooldown.CooldownStart = _lastUseTime;
|
||||
cooldown.CooldownEnd = _cooldownEnd;
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace Content.Server.GameTicking
|
||||
if (mind.CharacterName != null)
|
||||
playerIcName = mind.CharacterName;
|
||||
else if (mind.CurrentEntity != null)
|
||||
playerIcName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(mind.CurrentEntity.Value).EntityName;
|
||||
playerIcName = EntityManager.GetComponent<MetaDataComponent>(mind.CurrentEntity.Value).EntityName;
|
||||
|
||||
var playerEndRoundInfo = new RoundEndMessageEvent.RoundEndPlayerInfo()
|
||||
{
|
||||
@@ -369,7 +369,7 @@ namespace Content.Server.GameTicking
|
||||
{
|
||||
// TODO: Maybe something less naive here?
|
||||
// FIXME: Actually, definitely.
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(entity);
|
||||
EntityManager.DeleteEntity(entity);
|
||||
}
|
||||
|
||||
_mapManager.Restart();
|
||||
|
||||
@@ -76,8 +76,7 @@ namespace Content.Server.GameTicking.Presets
|
||||
}
|
||||
}
|
||||
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var ghost = entityManager.SpawnEntity("MobObserver", position.ToMap(entityManager));
|
||||
var ghost = entities.SpawnEntity("MobObserver", position.ToMap(entities));
|
||||
|
||||
// Try setting the ghost entity name to either the character name or the player name.
|
||||
// If all else fails, it'll default to the default entity prototype name, "observer".
|
||||
@@ -87,7 +86,7 @@ namespace Content.Server.GameTicking.Presets
|
||||
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
|
||||
entities.GetComponent<MetaDataComponent>(ghost).EntityName = mind.Session.Name;
|
||||
|
||||
var ghostComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost);
|
||||
var ghostComponent = entities.GetComponent<GhostComponent>(ghost);
|
||||
|
||||
if (mind.TimeOfDeath.HasValue)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace Content.Server.Ghost.Components
|
||||
public class GhostRadioComponent : Component, IRadio
|
||||
{
|
||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "GhostRadio";
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace Content.Server.Ghost.Components
|
||||
|
||||
public void Receive(string message, int channel, EntityUid speaker)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(Owner, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
var playerChannel = actor.PlayerSession.ConnectedClient;
|
||||
@@ -35,7 +36,7 @@ namespace Content.Server.Ghost.Components
|
||||
msg.Channel = ChatChannel.Radio;
|
||||
msg.Message = message;
|
||||
//Square brackets are added here to avoid issues with escaping
|
||||
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(speaker).EntityName));
|
||||
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(speaker).EntityName));
|
||||
_netManager.ServerSendMessage(msg, playerChannel);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
[RegisterComponent, ComponentReference(typeof(GhostRoleComponent))]
|
||||
public class GhostRoleMobSpawnerComponent : GhostRoleComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "GhostRoleMobSpawner";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("deleteOnSpawn")]
|
||||
@@ -40,10 +42,10 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
if (string.IsNullOrEmpty(Prototype))
|
||||
throw new NullReferenceException("Prototype string cannot be null or empty!");
|
||||
|
||||
var mob = IoCManager.Resolve<IEntityManager>().SpawnEntity(Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
var mob = _entMan.SpawnEntity(Prototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
|
||||
if (MakeSentient)
|
||||
MakeSentientCommand.MakeSentient(mob, IoCManager.Resolve<IEntityManager>());
|
||||
MakeSentientCommand.MakeSentient(mob, _entMan);
|
||||
|
||||
mob.EnsureComponent<MindComponent>();
|
||||
|
||||
@@ -56,7 +58,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
Taken = true;
|
||||
|
||||
if (_deleteOnSpawn)
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
|
||||
_entMan.DeleteEntity(Owner);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Content.Server.Headset
|
||||
public class HeadsetComponent : Component, IListen, IRadio, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
||||
|
||||
public override string Name => "Headset";
|
||||
@@ -59,7 +60,7 @@ namespace Content.Server.Headset
|
||||
{
|
||||
if (Owner.TryGetContainer(out var container))
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(container.Owner, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(container.Owner, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
var playerChannel = actor.PlayerSession.ConnectedClient;
|
||||
@@ -69,7 +70,7 @@ namespace Content.Server.Headset
|
||||
msg.Channel = ChatChannel.Radio;
|
||||
msg.Message = message;
|
||||
//Square brackets are added here to avoid issues with escaping
|
||||
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(source).EntityName));
|
||||
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(source).EntityName));
|
||||
_netManager.ServerSendMessage(msg, playerChannel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Content.Server.Instruments;
|
||||
[RegisterComponent, ComponentReference(typeof(SharedInstrumentComponent))]
|
||||
public sealed class InstrumentComponent : SharedInstrumentComponent
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables]
|
||||
public float Timer = 0f;
|
||||
|
||||
@@ -23,9 +25,10 @@ public sealed class InstrumentComponent : SharedInstrumentComponent
|
||||
[ViewVariables]
|
||||
public int MidiEventCount = 0;
|
||||
|
||||
// TODO Instruments: Make this ECS
|
||||
public IPlayerSession? InstrumentPlayer =>
|
||||
IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActivatableUIComponent>(Owner)?.CurrentSingleUser
|
||||
?? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActorComponent>(Owner)?.PlayerSession;
|
||||
_entMan.GetComponentOrNull<ActivatableUIComponent>(Owner)?.CurrentSingleUser
|
||||
?? _entMan.GetComponentOrNull<ActorComponent>(Owner)?.PlayerSession;
|
||||
|
||||
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
||||
}
|
||||
|
||||
@@ -13,26 +13,28 @@ namespace Content.Server.Inventory.Components
|
||||
[RegisterComponent]
|
||||
public class DebugEquipComponent : Component, IEquipped, IEquippedHand, IUnequipped, IUnequippedHand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "DebugEquip";
|
||||
|
||||
void IEquipped.Equipped(EquippedEventArgs eventArgs)
|
||||
{
|
||||
eventArgs.User.PopupMessage("equipped " + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
eventArgs.User.PopupMessage("equipped " + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
}
|
||||
|
||||
void IEquippedHand.EquippedHand(EquippedHandEventArgs eventArgs)
|
||||
{
|
||||
eventArgs.User.PopupMessage("equipped hand " + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
eventArgs.User.PopupMessage("equipped hand " + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
}
|
||||
|
||||
void IUnequipped.Unequipped(UnequippedEventArgs eventArgs)
|
||||
{
|
||||
eventArgs.User.PopupMessage("unequipped " + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
eventArgs.User.PopupMessage("unequipped " + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
}
|
||||
|
||||
void IUnequippedHand.UnequippedHand(UnequippedHandEventArgs eventArgs)
|
||||
{
|
||||
eventArgs.User.PopupMessage("unequipped hand" + IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
eventArgs.User.PopupMessage("unequipped hand" + _entMan.GetComponent<MetaDataComponent>(Owner).EntityName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Server.Inventory
|
||||
var user = inventory.Owner;
|
||||
|
||||
// Let's do nothing if the owner of the inventory has been deleted.
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(user) ? EntityLifeStage.Deleted : IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(user).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
if ((!entityManager.EntityExists(user) ? EntityLifeStage.Deleted : entityManager.GetComponent<MetaDataComponent>(user).EntityLifeStage) >= EntityLifeStage.Deleted)
|
||||
return false;
|
||||
|
||||
// If we don't have that slot or there's already an item there, we do nothing.
|
||||
@@ -28,17 +28,17 @@ namespace Content.Server.Inventory
|
||||
return false;
|
||||
|
||||
// Let's spawn this first...
|
||||
var item = entityManager.SpawnEntity(prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(user).MapPosition);
|
||||
var item = entityManager.SpawnEntity(prototype, entityManager.GetComponent<TransformComponent>(user).MapPosition);
|
||||
|
||||
// Helper method that deletes the item and returns false.
|
||||
bool DeleteItem()
|
||||
{
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(item);
|
||||
entityManager.DeleteEntity(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this doesn't have an item component, then we can't do anything with it.
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out ItemComponent? itemComp))
|
||||
if (!entityManager.TryGetComponent(item, out ItemComponent? itemComp))
|
||||
return DeleteItem();
|
||||
|
||||
// We finally try to equip the item, otherwise we delete it.
|
||||
|
||||
@@ -29,9 +29,11 @@ namespace Content.Server.Jobs
|
||||
if (!EntitySystem.Get<HolidaySystem>().IsCurrentlyHoliday(Holiday))
|
||||
return;
|
||||
|
||||
var entity = IoCManager.Resolve<IEntityManager>().SpawnEntity(Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(mob).Coordinates);
|
||||
var entMan = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out ItemComponent? item) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(mob, out HandsComponent? hands))
|
||||
var entity = entMan.SpawnEntity(Prototype, entMan.GetComponent<TransformComponent>(mob).Coordinates);
|
||||
|
||||
if (!entMan.TryGetComponent(entity, out ItemComponent? item) || !entMan.TryGetComponent(mob, out HandsComponent? hands))
|
||||
return;
|
||||
|
||||
hands.PutInHand(item, false);
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Content.Server.Kitchen.Components
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class KitchenSpikeComponent : SharedKitchenSpikeComponent, IActivate, ISuicideAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
private int _meatParts;
|
||||
private string? _meatPrototype;
|
||||
private string _meatSource1p = "?";
|
||||
@@ -40,8 +42,8 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
if (!string.IsNullOrEmpty(_meatPrototype))
|
||||
{
|
||||
var meat = IoCManager.Resolve<IEntityManager>().SpawnEntity(_meatPrototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(meat).EntityName = _meatName;
|
||||
var meat = _entMan.SpawnEntity(_meatPrototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.GetComponent<MetaDataComponent>(meat).EntityName = _meatName;
|
||||
}
|
||||
|
||||
if (_meatParts != 0)
|
||||
@@ -67,7 +69,7 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(KitchenSpikeVisuals.Status, (_meatParts > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty);
|
||||
}
|
||||
@@ -83,7 +85,7 @@ namespace Content.Server.Kitchen.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(victim, out butcherable))
|
||||
if (!_entMan.TryGetComponent(victim, out butcherable))
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-butcher", ("victim", victim), ("this", Owner)));
|
||||
return false;
|
||||
@@ -106,7 +108,7 @@ namespace Content.Server.Kitchen.Components
|
||||
return;
|
||||
|
||||
// Prevent dead from being spiked TODO: Maybe remove when rounds can be played and DOT is implemented
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(victim, out var state) &&
|
||||
if (_entMan.TryGetComponent<MobStateComponent?>(victim, out var state) &&
|
||||
!state.IsDead())
|
||||
{
|
||||
Owner.PopupMessage(user, Loc.GetString("comp-kitchen-spike-deny-not-dead", ("victim", victim)));
|
||||
@@ -154,7 +156,7 @@ namespace Content.Server.Kitchen.Components
|
||||
|
||||
Owner.PopupMessageEveryone(Loc.GetString("comp-kitchen-spike-kill", ("user", user), ("victim", victim)));
|
||||
// TODO: Need to be able to leave them on the spike to do DoT, see ss13.
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity((EntityUid) victim);
|
||||
_entMan.DeleteEntity((EntityUid) victim);
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), SpikeSound.GetSound(), Owner);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace Content.Server.Lathe.Components
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class LatheComponent : SharedLatheComponent, IInteractUsing, IActivate
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public const int VolumePerSheet = 100;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -42,7 +44,7 @@ namespace Content.Server.Lathe.Components
|
||||
[ViewVariables]
|
||||
private LatheRecipePrototype? _producingRecipe;
|
||||
[ViewVariables]
|
||||
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 static readonly TimeSpan InsertionTime = TimeSpan.FromSeconds(0.9f);
|
||||
|
||||
@@ -75,20 +77,20 @@ namespace Content.Server.Lathe.Components
|
||||
}
|
||||
break;
|
||||
case LatheSyncRequestMessage _:
|
||||
if (!IoCManager.Resolve<IEntityManager>().HasComponent<MaterialStorageComponent>(Owner)) return;
|
||||
if (!_entMan.HasComponent<MaterialStorageComponent>(Owner)) return;
|
||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||
if (_producingRecipe != null)
|
||||
UserInterface?.SendMessage(new LatheProducingRecipeMessage(_producingRecipe.ID));
|
||||
break;
|
||||
|
||||
case LatheServerSelectionMessage _:
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ResearchClientComponent? researchClient)) return;
|
||||
if (!_entMan.TryGetComponent(Owner, out ResearchClientComponent? researchClient)) return;
|
||||
researchClient.OpenUserInterface(message.Session);
|
||||
break;
|
||||
|
||||
case LatheServerSyncMessage _:
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out TechnologyDatabaseComponent? database)
|
||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ProtolatheDatabaseComponent? protoDatabase)) return;
|
||||
if (!_entMan.TryGetComponent(Owner, out TechnologyDatabaseComponent? database)
|
||||
|| !_entMan.TryGetComponent(Owner, out ProtolatheDatabaseComponent? protoDatabase)) return;
|
||||
|
||||
if (database.SyncWithServer())
|
||||
protoDatabase.Sync();
|
||||
@@ -101,7 +103,7 @@ namespace Content.Server.Lathe.Components
|
||||
|
||||
internal bool Produce(LatheRecipePrototype recipe)
|
||||
{
|
||||
if (Producing || !Powered || !CanProduce(recipe) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MaterialStorageComponent? storage)) return false;
|
||||
if (Producing || !Powered || !CanProduce(recipe) || !_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)) return false;
|
||||
|
||||
UserInterface?.SendMessage(new LatheFullQueueMessage(GetIdQueue()));
|
||||
|
||||
@@ -123,7 +125,7 @@ namespace Content.Server.Lathe.Components
|
||||
{
|
||||
Producing = false;
|
||||
_producingRecipe = null;
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(recipe.Result, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.SpawnEntity(recipe.Result, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
UserInterface?.SendMessage(new LatheStoppedProducingRecipeMessage());
|
||||
State = LatheState.Base;
|
||||
SetAppearance(LatheVisualState.Idle);
|
||||
@@ -139,7 +141,7 @@ namespace Content.Server.Lathe.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)
|
||||
{
|
||||
@@ -151,12 +153,12 @@ namespace Content.Server.Lathe.Components
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out MaterialStorageComponent? storage)
|
||||
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out MaterialComponent? material)) return false;
|
||||
if (!_entMan.TryGetComponent(Owner, out MaterialStorageComponent? storage)
|
||||
|| !_entMan.TryGetComponent(eventArgs.Using, out MaterialComponent? material)) return false;
|
||||
|
||||
var multiplier = 1;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Using, out StackComponent? stack)) multiplier = stack.Count;
|
||||
if (_entMan.TryGetComponent(eventArgs.Using, out StackComponent? stack)) multiplier = stack.Count;
|
||||
|
||||
var totalAmount = 0;
|
||||
|
||||
@@ -202,14 +204,14 @@ namespace Content.Server.Lathe.Components
|
||||
SetAppearance(LatheVisualState.Idle);
|
||||
});
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(eventArgs.Using);
|
||||
_entMan.DeleteEntity(eventArgs.Using);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetAppearance(LatheVisualState state)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(PowerDeviceVisuals.VisualState, state);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Content.Server.Light.Components
|
||||
public class EmergencyLightComponent : SharedEmergencyLightComponent, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private EmergencyLightState State
|
||||
{
|
||||
@@ -31,7 +33,7 @@ namespace Content.Server.Light.Components
|
||||
return;
|
||||
|
||||
_state = value;
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ namespace Content.Server.Light.Components
|
||||
/// </summary>
|
||||
public void UpdateState()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
if (!_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -80,7 +82,7 @@ namespace Content.Server.Light.Components
|
||||
|
||||
public void OnUpdate(float frameTime)
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out BatteryComponent? battery) || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityPaused))
|
||||
if ((!_entMan.EntityExists(Owner) || !_entMan.TryGetComponent(Owner, out BatteryComponent? battery) || _entMan.GetComponent<MetaDataComponent>(Owner).EntityPaused))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -98,7 +100,7 @@ namespace Content.Server.Light.Components
|
||||
battery.CurrentCharge += _chargingWattage * frameTime * _chargingEfficiency;
|
||||
if (battery.IsFullyCharged)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
if (_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
receiver.Load = 1;
|
||||
}
|
||||
@@ -110,23 +112,23 @@ namespace Content.Server.Light.Components
|
||||
|
||||
private void TurnOff()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
||||
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = false;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
appearance.SetData(EmergencyLightVisuals.On, false);
|
||||
}
|
||||
|
||||
private void TurnOn()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
||||
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = true;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
appearance.SetData(EmergencyLightVisuals.On, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace Content.Server.Light.Components
|
||||
[RegisterComponent]
|
||||
public class ExpendableLightComponent : SharedExpendableLightComponent, IUse
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Status of light, whether or not it is emitting light.
|
||||
/// </summary>
|
||||
@@ -36,14 +38,14 @@ namespace Content.Server.Light.Components
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
{
|
||||
item.EquippedPrefix = "unlit";
|
||||
}
|
||||
|
||||
CurrentState = ExpendableLightState.BrandNew;
|
||||
Owner.EnsureComponent<PointLightComponent>();
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out _appearance);
|
||||
_entMan.TryGetComponent(Owner, out _appearance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,7 +55,7 @@ namespace Content.Server.Light.Components
|
||||
{
|
||||
if (!Activated && CurrentState == ExpendableLightState.BrandNew)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
{
|
||||
item.EquippedPrefix = "lit";
|
||||
}
|
||||
@@ -92,7 +94,7 @@ namespace Content.Server.Light.Components
|
||||
|
||||
private void UpdateSpriteAndSounds(bool on)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
{
|
||||
switch (CurrentState)
|
||||
{
|
||||
@@ -126,7 +128,7 @@ namespace Content.Server.Light.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
if (_entMan.TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
{
|
||||
clothing.ClothingEquippedPrefix = on ? "Activated" : string.Empty;
|
||||
}
|
||||
@@ -155,13 +157,13 @@ namespace Content.Server.Light.Components
|
||||
case ExpendableLightState.Fading:
|
||||
|
||||
CurrentState = ExpendableLightState.Dead;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName = SpentName;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityDescription = SpentDesc;
|
||||
_entMan.GetComponent<MetaDataComponent>(Owner).EntityName = SpentName;
|
||||
_entMan.GetComponent<MetaDataComponent>(Owner).EntityDescription = SpentDesc;
|
||||
|
||||
UpdateSpriteAndSounds(Activated);
|
||||
UpdateVisualizer();
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
{
|
||||
item.EquippedPrefix = "unlit";
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace Content.Server.Light.Components
|
||||
internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IInteractUsing
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("wattage")] public float Wattage { get; set; } = 3f;
|
||||
[ViewVariables] private PowerCellSlotComponent _cellSlot = default!;
|
||||
private PowerCellComponent? Cell => _cellSlot.Cell;
|
||||
@@ -70,7 +72,7 @@ namespace Content.Server.Light.Components
|
||||
protected override void OnRemove()
|
||||
{
|
||||
base.OnRemove();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
_entMan.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
}
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
@@ -118,7 +120,7 @@ namespace Content.Server.Light.Components
|
||||
SetState(false);
|
||||
Activated = false;
|
||||
UpdateLightAction();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
_entMan.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
|
||||
if (makeNoise)
|
||||
{
|
||||
@@ -157,7 +159,7 @@ namespace Content.Server.Light.Components
|
||||
Activated = true;
|
||||
UpdateLightAction();
|
||||
SetState(true);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
||||
_entMan.EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound.GetSound(), Owner);
|
||||
return true;
|
||||
@@ -165,22 +167,22 @@ namespace Content.Server.Light.Components
|
||||
|
||||
private void SetState(bool on)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
{
|
||||
sprite.LayerSetVisible(1, on);
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
||||
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = on;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
if (_entMan.TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
{
|
||||
clothing.ClothingEquippedPrefix = Loc.GetString(on ? "on" : "off");
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ItemComponent? item))
|
||||
if (_entMan.TryGetComponent(Owner, out ItemComponent? item))
|
||||
{
|
||||
item.EquippedPrefix = Loc.GetString(on ? "on" : "off");
|
||||
}
|
||||
@@ -199,7 +201,7 @@ namespace Content.Server.Light.Components
|
||||
return;
|
||||
}
|
||||
|
||||
var appearanceComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AppearanceComponent>(Owner);
|
||||
var appearanceComponent = _entMan.GetComponent<AppearanceComponent>(Owner);
|
||||
|
||||
if (Cell.MaxCharge - Cell.CurrentCharge < Cell.MaxCharge * 0.70)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace Content.Server.Medical.Components
|
||||
[RegisterComponent]
|
||||
public class HealingComponent : Component, IAfterInteract
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "Healing";
|
||||
|
||||
[DataField("damage", required: true)]
|
||||
@@ -40,7 +42,7 @@ namespace Content.Server.Medical.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.Target.Value, out DamageableComponent? targetDamage))
|
||||
if (!_entMan.TryGetComponent(eventArgs.Target.Value, out DamageableComponent? targetDamage))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -60,7 +62,7 @@ namespace Content.Server.Medical.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedStackComponent?>(Owner, out var stack) && !EntitySystem.Get<StackSystem>().Use(Owner, 1, stack))
|
||||
if (_entMan.TryGetComponent<SharedStackComponent?>(Owner, out var stack) && !EntitySystem.Get<StackSystem>().Use(Owner, 1, stack))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace Content.Server.Medical.Components
|
||||
[ComponentReference(typeof(SharedMedicalScannerComponent))]
|
||||
public class MedicalScannerComponent : SharedMedicalScannerComponent, IActivate, IDestroyAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IServerPreferencesManager _prefsManager = null!;
|
||||
|
||||
public static readonly TimeSpan InternalOpenAttemptDelay = TimeSpan.FromSeconds(0.5);
|
||||
@@ -36,7 +37,7 @@ namespace Content.Server.Medical.Components
|
||||
private ContainerSlot _bodyContainer = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
private bool Powered => !_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
[ViewVariables]
|
||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(MedicalScannerUiKey.Key);
|
||||
|
||||
@@ -71,7 +72,7 @@ namespace Content.Server.Medical.Components
|
||||
var body = _bodyContainer.ContainedEntity;
|
||||
if (body == null)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance?.SetData(MedicalScannerVisuals.Status, MedicalScannerStatus.Open);
|
||||
}
|
||||
@@ -79,7 +80,7 @@ namespace Content.Server.Medical.Components
|
||||
return EmptyUIState;
|
||||
}
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(body.Value, out DamageableComponent? damageable))
|
||||
if (!_entMan.TryGetComponent(body.Value, out DamageableComponent? damageable))
|
||||
{
|
||||
return EmptyUIState;
|
||||
}
|
||||
@@ -90,7 +91,7 @@ namespace Content.Server.Medical.Components
|
||||
}
|
||||
|
||||
var cloningSystem = EntitySystem.Get<CloningSystem>();
|
||||
var scanned = IoCManager.Resolve<IEntityManager>().TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComponent) &&
|
||||
var scanned = _entMan.TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComponent) &&
|
||||
mindComponent.Mind != null &&
|
||||
cloningSystem.HasDnaScan(mindComponent.Mind);
|
||||
|
||||
@@ -136,7 +137,7 @@ namespace Content.Server.Medical.Components
|
||||
if (body == null)
|
||||
return MedicalScannerStatus.Open;
|
||||
|
||||
var state = IoCManager.Resolve<IEntityManager>().GetComponentOrNull<MobStateComponent>(body.Value);
|
||||
var state = _entMan.GetComponentOrNull<MobStateComponent>(body.Value);
|
||||
|
||||
return state == null ? MedicalScannerStatus.Open : GetStatusFromDamageState(state);
|
||||
}
|
||||
@@ -146,7 +147,7 @@ namespace Content.Server.Medical.Components
|
||||
|
||||
private void UpdateAppearance()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(MedicalScannerVisuals.Status, GetStatus());
|
||||
}
|
||||
@@ -154,7 +155,7 @@ namespace Content.Server.Medical.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs args)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(args.User, out ActorComponent? actor))
|
||||
if (!_entMan.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -198,7 +199,7 @@ namespace Content.Server.Medical.Components
|
||||
{
|
||||
var cloningSystem = EntitySystem.Get<CloningSystem>();
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComp) || mindComp.Mind == null)
|
||||
if (!_entMan.TryGetComponent(_bodyContainer.ContainedEntity.Value, out MindComponent? mindComp) || mindComp.Mind == null)
|
||||
{
|
||||
obj.Session.AttachedEntity.Value.PopupMessageCursor(Loc.GetString("medical-scanner-component-msg-no-soul"));
|
||||
break;
|
||||
|
||||
@@ -22,6 +22,8 @@ namespace Content.Server.Mind.Components
|
||||
public class MindComponent : Component, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Name => "Mind";
|
||||
|
||||
@@ -59,7 +61,7 @@ namespace Content.Server.Mind.Components
|
||||
public void InternalEjectMind()
|
||||
{
|
||||
if (!Deleted)
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new MindRemovedMessage());
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new MindRemovedMessage());
|
||||
Mind = null;
|
||||
}
|
||||
|
||||
@@ -71,7 +73,7 @@ namespace Content.Server.Mind.Components
|
||||
public void InternalAssignMind(Mind value)
|
||||
{
|
||||
Mind = value;
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseLocalEvent(Owner, new MindAddedMessage());
|
||||
_entMan.EventBus.RaiseLocalEvent(Owner, new MindAddedMessage());
|
||||
}
|
||||
|
||||
protected override void Shutdown()
|
||||
@@ -86,7 +88,7 @@ namespace Content.Server.Mind.Components
|
||||
{
|
||||
if (Mind?.VisitingEntity is {Valid: true} visiting)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(visiting, out GhostComponent? ghost))
|
||||
if (_entMan.TryGetComponent(visiting, out GhostComponent? ghost))
|
||||
{
|
||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghost, false);
|
||||
}
|
||||
@@ -95,27 +97,27 @@ namespace Content.Server.Mind.Components
|
||||
}
|
||||
else if (GhostOnShutdown)
|
||||
{
|
||||
var spawnPosition = IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
var spawnPosition = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
|
||||
// Use a regular timer here because the entity has probably been deleted.
|
||||
Timer.Spawn(0, () =>
|
||||
{
|
||||
// Async this so that we don't throw if the grid we're on is being deleted.
|
||||
var mapMan = IoCManager.Resolve<IMapManager>();
|
||||
|
||||
var gridId = spawnPosition.GetGridId(IoCManager.Resolve<IEntityManager>());
|
||||
var gridId = spawnPosition.GetGridId(_entMan);
|
||||
if (gridId == GridId.Invalid || !mapMan.GridExists(gridId))
|
||||
{
|
||||
spawnPosition = EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
||||
}
|
||||
|
||||
var ghost = IoCManager.Resolve<IEntityManager>().SpawnEntity("MobObserver", spawnPosition);
|
||||
var ghostComponent = IoCManager.Resolve<IEntityManager>().GetComponent<GhostComponent>(ghost);
|
||||
var ghost = _entMan.SpawnEntity("MobObserver", spawnPosition);
|
||||
var ghostComponent = _entMan.GetComponent<GhostComponent>(ghost);
|
||||
EntitySystem.Get<SharedGhostSystem>().SetCanReturnToBody(ghostComponent, false);
|
||||
|
||||
if (Mind != null)
|
||||
{
|
||||
string? val = Mind.CharacterName ?? string.Empty;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(ghost).EntityName = val;
|
||||
_entMan.GetComponent<MetaDataComponent>(ghost).EntityName = val;
|
||||
Mind.TransferTo(ghost);
|
||||
}
|
||||
});
|
||||
@@ -131,7 +133,7 @@ namespace Content.Server.Mind.Components
|
||||
}
|
||||
|
||||
var dead =
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent<MobStateComponent?>(Owner, out var state) &&
|
||||
_entMan.TryGetComponent<MobStateComponent?>(Owner, out var state) &&
|
||||
state.IsDead();
|
||||
|
||||
if (!HasMind)
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Content.Server.Mining.Components
|
||||
[RegisterComponent]
|
||||
public class AsteroidRockComponent : Component, IInteractUsing
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override string Name => "AsteroidRock";
|
||||
@@ -25,7 +26,7 @@ namespace Content.Server.Mining.Components
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(AsteroidRockVisuals.State, _random.Pick(SpriteStates));
|
||||
}
|
||||
@@ -34,12 +35,12 @@ namespace Content.Server.Mining.Components
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
var item = eventArgs.Using;
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out MeleeWeaponComponent? meleeWeaponComponent))
|
||||
if (!_entMan.TryGetComponent(item, out MeleeWeaponComponent? meleeWeaponComponent))
|
||||
return false;
|
||||
|
||||
EntitySystem.Get<DamageableSystem>().TryChangeDamage(Owner, meleeWeaponComponent.Damage);
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(item, out PickaxeComponent? pickaxeComponent))
|
||||
if (!_entMan.TryGetComponent(item, out PickaxeComponent? pickaxeComponent))
|
||||
return true;
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), pickaxeComponent.MiningSound.GetSound(), Owner, AudioParams.Default);
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace Content.Server.Morgue.Components
|
||||
public class MorgueEntityStorageComponent : EntityStorageComponent, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
public override string Name => "MorgueEntityStorage";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -65,13 +67,13 @@ namespace Content.Server.Morgue.Components
|
||||
public override Vector2 ContentsDumpPosition()
|
||||
{
|
||||
if (_tray != null)
|
||||
return IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_tray).WorldPosition;
|
||||
return _entMan.GetComponent<TransformComponent>(_tray).WorldPosition;
|
||||
return base.ContentsDumpPosition();
|
||||
}
|
||||
|
||||
protected override bool AddToContents(EntityUid entity)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity))
|
||||
if (_entMan.HasComponent<SharedBodyComponent>(entity) && !EntitySystem.Get<StandingStateSystem>().IsDown(entity))
|
||||
return false;
|
||||
return base.AddToContents(entity);
|
||||
}
|
||||
@@ -79,7 +81,7 @@ namespace Content.Server.Morgue.Components
|
||||
public override bool CanOpen(EntityUid user, bool silent = false)
|
||||
{
|
||||
if (!Owner.InRangeUnobstructed(
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates.Offset(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).LocalRotation.GetCardinalDir()),
|
||||
_entMan.GetComponent<TransformComponent>(Owner).Coordinates.Offset(_entMan.GetComponent<TransformComponent>(Owner).LocalRotation.GetCardinalDir()),
|
||||
collisionMask: CollisionGroup.Impassable | CollisionGroup.VaultImpassable
|
||||
))
|
||||
{
|
||||
@@ -100,7 +102,7 @@ namespace Content.Server.Morgue.Components
|
||||
|
||||
if (_tray == null)
|
||||
{
|
||||
_tray = IoCManager.Resolve<IEntityManager>().SpawnEntity(_trayPrototypeId, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_tray = _entMan.SpawnEntity(_trayPrototypeId, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
var trayComp = _tray.EnsureComponent<MorgueTrayComponent>();
|
||||
trayComp.Morgue = Owner;
|
||||
}
|
||||
@@ -109,7 +111,7 @@ namespace Content.Server.Morgue.Components
|
||||
TrayContainer?.Remove(_tray);
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1);
|
||||
_entMan.GetComponent<TransformComponent>(_tray).Coordinates = new EntityCoordinates(Owner, 0, -1);
|
||||
|
||||
base.OpenStorage();
|
||||
}
|
||||
@@ -122,9 +124,9 @@ namespace Content.Server.Morgue.Components
|
||||
foreach (var entity in Contents.ContainedEntities)
|
||||
{
|
||||
count++;
|
||||
if (!hasMob && IoCManager.Resolve<IEntityManager>().HasComponent<SharedBodyComponent>(entity))
|
||||
if (!hasMob && _entMan.HasComponent<SharedBodyComponent>(entity))
|
||||
hasMob = true;
|
||||
if (!hasSoul && IoCManager.Resolve<IEntityManager>().TryGetComponent<ActorComponent?>(entity, out var actor) && actor.PlayerSession != null)
|
||||
if (!hasSoul && _entMan.TryGetComponent<ActorComponent?>(entity, out var actor) && actor.PlayerSession != null)
|
||||
hasSoul = true;
|
||||
}
|
||||
Appearance?.SetData(MorgueVisuals.HasContents, count > 0);
|
||||
|
||||
Reference in New Issue
Block a user