Files
tbd-station-14/Content.Server/Destructible/Thresholds/Behaviors/BurnBodyBehavior.cs
Tayrtahn bb864f2b56 Fix entities burning to ash not using identity, and bad formatting (#36268)
* Make burning to ash use identity

* CAPITALIZE(THE())
2025-04-03 04:02:09 +02:00

35 lines
1.3 KiB
C#

using Content.Shared.Body.Components;
using Content.Shared.IdentityManagement;
using Content.Shared.Inventory;
using Content.Shared.Popups;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
namespace Content.Server.Destructible.Thresholds.Behaviors;
[UsedImplicitly]
[DataDefinition]
public sealed partial class BurnBodyBehavior : IThresholdBehavior
{
public void Execute(EntityUid bodyId, DestructibleSystem system, EntityUid? cause = null)
{
var transformSystem = system.EntityManager.System<TransformSystem>();
var inventorySystem = system.EntityManager.System<InventorySystem>();
var sharedPopupSystem = system.EntityManager.System<SharedPopupSystem>();
if (system.EntityManager.TryGetComponent<InventoryComponent>(bodyId, out var comp))
{
foreach (var item in inventorySystem.GetHandOrInventoryEntities(bodyId))
{
transformSystem.DropNextTo(item, bodyId);
}
}
var bodyIdentity = Identity.Entity(bodyId, system.EntityManager);
sharedPopupSystem.PopupCoordinates(Loc.GetString("bodyburn-text-others", ("name", bodyIdentity)), transformSystem.GetMoverCoordinates(bodyId), PopupType.LargeCaution);
system.EntityManager.QueueDeleteEntity(bodyId);
}
}