2021-02-03 22:07:13 +00:00
|
|
|
using Content.Client.Animations;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.DragDrop;
|
|
|
|
|
using Content.Shared.Storage;
|
2018-04-22 06:11:38 -05:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Storage
|
2018-04-22 06:11:38 -05:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Client version of item storage containers, contains a UI which displays stored entities and their size
|
|
|
|
|
/// </summary>
|
2019-07-31 15:02:36 +02:00
|
|
|
[RegisterComponent]
|
2022-05-03 23:00:22 -04:00
|
|
|
public sealed class ClientStorageComponent : SharedStorageComponent
|
2018-04-22 06:11:38 -05:00
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
|
|
|
private List<EntityUid> _storedEntities = new();
|
|
|
|
|
public override IReadOnlyList<EntityUid> StoredEntities => _storedEntities;
|
2020-10-14 15:24:07 +02:00
|
|
|
|
2021-02-03 22:07:13 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Animate the newly stored entities in <paramref name="msg"/> flying towards this storage's position
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="msg"></param>
|
2022-03-30 16:23:20 -07:00
|
|
|
public void HandleAnimatingInsertingEntities(AnimateInsertingEntitiesEvent msg)
|
2021-02-03 22:07:13 +00:00
|
|
|
{
|
|
|
|
|
for (var i = 0; msg.StoredEntities.Count > i; i++)
|
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
var entity = msg.StoredEntities[i];
|
2021-08-06 19:20:27 +02:00
|
|
|
var initialPosition = msg.EntityPositions[i];
|
2021-02-03 22:07:13 +00:00
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
if (_entityManager.EntityExists(entity))
|
2021-02-03 22:07:13 +00:00
|
|
|
{
|
2021-12-08 11:37:10 +01:00
|
|
|
ReusableAnimations.AnimateEntityPickup(entity, initialPosition, _entityManager.GetComponent<TransformComponent>(Owner).LocalPosition, _entityManager);
|
2021-02-03 22:07:13 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
public override bool Remove(EntityUid entity)
|
2020-10-14 15:24:07 +02:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-04-22 06:11:38 -05:00
|
|
|
}
|
|
|
|
|
}
|