A bunch more resolves removed wooo
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Content.Client.Access.UI
|
||||
public class IdCardConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
public IdCardConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
@@ -22,7 +23,7 @@ namespace Content.Client.Access.UI
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager) {Title = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
|
||||
_window = new IdCardConsoleWindow(this, _prototypeManager) {Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
@@ -12,23 +12,24 @@ namespace Content.Client.Animations
|
||||
{
|
||||
public static class ReusableAnimations
|
||||
{
|
||||
public static void AnimateEntityPickup(EntityUid entity, EntityCoordinates initialPosition, Vector2 finalPosition)
|
||||
public static void AnimateEntityPickup(EntityUid entity, EntityCoordinates initialPosition, Vector2 finalPosition, IEntityManager? entMan = null)
|
||||
{
|
||||
var animatableClone = IoCManager.Resolve<IEntityManager>().SpawnEntity("clientsideclone", initialPosition);
|
||||
string val = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(animatableClone).EntityName = val;
|
||||
IoCManager.Resolve(ref entMan);
|
||||
var animatableClone = entMan.SpawnEntity("clientsideclone", initialPosition);
|
||||
string val = entMan.GetComponent<MetaDataComponent>(entity).EntityName;
|
||||
entMan.GetComponent<MetaDataComponent>(animatableClone).EntityName = val;
|
||||
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(entity, out SpriteComponent? sprite0))
|
||||
if (!entMan.TryGetComponent(entity, out SpriteComponent? sprite0))
|
||||
{
|
||||
Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(entity).EntityName, nameof(SpriteComponent));
|
||||
Logger.Error("Entity ({0}) couldn't be animated for pickup since it doesn't have a {1}!", entMan.GetComponent<MetaDataComponent>(entity).EntityName, nameof(SpriteComponent));
|
||||
return;
|
||||
}
|
||||
var sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(animatableClone);
|
||||
var sprite = entMan.GetComponent<SpriteComponent>(animatableClone);
|
||||
sprite.CopyFrom(sprite0);
|
||||
|
||||
var animations = IoCManager.Resolve<IEntityManager>().GetComponent<AnimationPlayerComponent>(animatableClone);
|
||||
var animations = entMan.GetComponent<AnimationPlayerComponent>(animatableClone);
|
||||
animations.AnimationCompleted += (_) => {
|
||||
IoCManager.Resolve<IEntityManager>().DeleteEntity(animatableClone);
|
||||
entMan.DeleteEntity(animatableClone);
|
||||
};
|
||||
|
||||
animations.Play(new Animation
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Content.Client.Hands
|
||||
if (!_gameTiming.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
ReusableAnimations.AnimateEntityPickup(msg.EntityUid, msg.InitialPosition, msg.FinalPosition);
|
||||
ReusableAnimations.AnimateEntityPickup(msg.EntityUid, msg.InitialPosition, msg.FinalPosition, EntityManager);
|
||||
}
|
||||
|
||||
public HandsGuiState GetGuiState()
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace Content.Client.Storage
|
||||
|
||||
if (_entityManager.EntityExists(entity))
|
||||
{
|
||||
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, _entityManager.GetComponent<TransformComponent>(Owner).LocalPosition);
|
||||
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, _entityManager.GetComponent<TransformComponent>(Owner).LocalPosition, _entityManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user