BurnBodyBehavior.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. 
  2. using Content.Shared.Body.Part; // Shitmed Change
  3. using Content.Shared.Body.Components;
  4. using Content.Shared.Inventory;
  5. using Content.Shared.Popups;
  6. using JetBrains.Annotations;
  7. using Robust.Server.GameObjects;
  8. namespace Content.Server.Destructible.Thresholds.Behaviors;
  9. [UsedImplicitly]
  10. [DataDefinition]
  11. public sealed partial class BurnBodyBehavior : IThresholdBehavior
  12. {
  13. public void Execute(EntityUid bodyId, DestructibleSystem system, EntityUid? cause = null)
  14. {
  15. var transformSystem = system.EntityManager.System<TransformSystem>();
  16. var inventorySystem = system.EntityManager.System<InventorySystem>();
  17. var sharedPopupSystem = system.EntityManager.System<SharedPopupSystem>();
  18. if (system.EntityManager.TryGetComponent<InventoryComponent>(bodyId, out var comp))
  19. {
  20. foreach (var item in inventorySystem.GetHandOrInventoryEntities(bodyId))
  21. {
  22. transformSystem.DropNextTo(item, bodyId);
  23. }
  24. }
  25. sharedPopupSystem.PopupCoordinates(Loc.GetString("bodyburn-text-others", ("name", bodyId)), transformSystem.GetMoverCoordinates(bodyId), PopupType.LargeCaution);
  26. system.EntityManager.QueueDeleteEntity(bodyId);
  27. }
  28. }