35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using Content.Shared.Explosion;
|
|
using Content.Shared.Hands;
|
|
using Content.Shared.Storage;
|
|
using Content.Shared.Storage.Components;
|
|
using Content.Shared.Storage.EntitySystems;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
namespace Content.Server.Storage.EntitySystems;
|
|
|
|
public sealed partial class StorageSystem : SharedStorageSystem
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<StorageComponent, BeforeExplodeEvent>(OnExploded);
|
|
SubscribeLocalEvent<StorageFillComponent, MapInitEvent>(OnStorageFillMapInit);
|
|
}
|
|
|
|
private void OnExploded(Entity<StorageComponent> ent, ref BeforeExplodeEvent args)
|
|
{
|
|
args.Contents.AddRange(ent.Comp.Container.ContainedEntities);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override void PlayPickupAnimation(EntityUid uid, EntityCoordinates initialCoordinates, EntityCoordinates finalCoordinates,
|
|
Angle initialRotation, EntityUid? user = null)
|
|
{
|
|
var filter = Filter.Pvs(uid).RemoveWhereAttachedEntity(e => e == user);
|
|
RaiseNetworkEvent(new PickupAnimationEvent(GetNetEntity(uid), GetNetCoordinates(initialCoordinates), GetNetCoordinates(finalCoordinates), initialRotation), filter);
|
|
}
|
|
}
|