diff --git a/Content.Server/Destructible/Thresholds/Behaviors/BurnBodyBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/BurnBodyBehavior.cs new file mode 100644 index 0000000000..28c4b2ef16 --- /dev/null +++ b/Content.Server/Destructible/Thresholds/Behaviors/BurnBodyBehavior.cs @@ -0,0 +1,32 @@ +using Content.Shared.Body.Components; +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(); + var inventorySystem = system.EntityManager.System(); + var sharedPopupSystem = system.EntityManager.System(); + + if (!system.EntityManager.TryGetComponent(bodyId, out var comp)) + return; + + foreach (var item in inventorySystem.GetHandOrInventoryEntities(bodyId)) + { + transformSystem.DropNextTo(item, bodyId); + } + + sharedPopupSystem.PopupCoordinates(Loc.GetString("bodyburn-text-others", ("name", bodyId)), transformSystem.GetMoverCoordinates(bodyId), PopupType.LargeCaution); + + system.EntityManager.QueueDeleteEntity(bodyId); + } +} diff --git a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs index ed5777c42a..0fa3c06c04 100644 --- a/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs +++ b/Content.Server/Destructible/Thresholds/Behaviors/SpawnEntitiesBehavior.cs @@ -23,7 +23,10 @@ namespace Content.Server.Destructible.Thresholds.Behaviors public float Offset { get; set; } = 0.5f; [DataField("transferForensics")] - public bool DoTransferForensics = false; + public bool DoTransferForensics; + + [DataField] + public bool SpawnInContainer; public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null) { @@ -49,7 +52,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors if (EntityPrototypeHelpers.HasComponent(entityId, system.PrototypeManager, system.ComponentFactory)) { - var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector())); + var spawned = SpawnInContainer + ? system.EntityManager.SpawnNextToOrDrop(entityId, owner) + : system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector())); system.StackSystem.SetCount(spawned, count); TransferForensics(spawned, system, owner); @@ -58,7 +63,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors { for (var i = 0; i < count; i++) { - var spawned = system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector())); + var spawned = SpawnInContainer + ? system.EntityManager.SpawnNextToOrDrop(entityId, owner) + : system.EntityManager.SpawnEntity(entityId, position.Offset(getRandomVector())); TransferForensics(spawned, system, owner); } diff --git a/Resources/Locale/en-US/burning/bodyburn.ftl b/Resources/Locale/en-US/burning/bodyburn.ftl new file mode 100644 index 0000000000..896a0b6d04 --- /dev/null +++ b/Resources/Locale/en-US/burning/bodyburn.ftl @@ -0,0 +1 @@ +bodyburn-text-others = {$name}'s body burns to ash! diff --git a/Resources/Prototypes/Entities/Mobs/base.yml b/Resources/Prototypes/Entities/Mobs/base.yml index ac9aabbead..065d62c748 100644 --- a/Resources/Prototypes/Entities/Mobs/base.yml +++ b/Resources/Prototypes/Entities/Mobs/base.yml @@ -60,6 +60,21 @@ damage: 400 behaviors: - !type:GibBehavior { } + - trigger: + !type:DamageTypeTrigger + damageType: Heat + damage: 1500 + behaviors: + - !type:SpawnEntitiesBehavior + spawnInContainer: true + spawn: + Ash: + min: 1 + max: 1 + - !type:BurnBodyBehavior { } + - !type:PlaySoundBehavior + sound: + collection: MeatLaserImpact - type: RadiationReceiver - type: Stamina - type: MobState