StorageSystem.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Content.Server.Administration.Managers;
  2. using Content.Shared.Administration;
  3. using Content.Shared.Explosion;
  4. using Content.Shared.Ghost;
  5. using Content.Shared.Hands;
  6. using Content.Shared.Lock;
  7. using Content.Shared.Storage;
  8. using Content.Shared.Storage.Components;
  9. using Content.Shared.Storage.EntitySystems;
  10. using Content.Shared.Verbs;
  11. using Robust.Server.GameObjects;
  12. using Robust.Shared.Map;
  13. using Robust.Shared.Player;
  14. using Robust.Shared.Prototypes;
  15. using Robust.Shared.Utility;
  16. namespace Content.Server.Storage.EntitySystems;
  17. public sealed partial class StorageSystem : SharedStorageSystem
  18. {
  19. [Dependency] private readonly IPrototypeManager _prototype = default!;
  20. public override void Initialize()
  21. {
  22. base.Initialize();
  23. SubscribeLocalEvent<StorageComponent, BeforeExplodeEvent>(OnExploded);
  24. SubscribeLocalEvent<StorageFillComponent, MapInitEvent>(OnStorageFillMapInit);
  25. }
  26. private void OnExploded(Entity<StorageComponent> ent, ref BeforeExplodeEvent args)
  27. {
  28. args.Contents.AddRange(ent.Comp.Container.ContainedEntities);
  29. }
  30. /// <inheritdoc />
  31. public override void PlayPickupAnimation(EntityUid uid, EntityCoordinates initialCoordinates, EntityCoordinates finalCoordinates,
  32. Angle initialRotation, EntityUid? user = null)
  33. {
  34. var filter = Filter.Pvs(uid).RemoveWhereAttachedEntity(e => e == user);
  35. RaiseNetworkEvent(new PickupAnimationEvent(GetNetEntity(uid), GetNetCoordinates(initialCoordinates), GetNetCoordinates(finalCoordinates), initialRotation), filter);
  36. }
  37. }