Mobs burn to ashes on excessive heat damage (#26971)
* mobs burn to ashes on excessive heat damage * remove comment, remove random lines I didn't mean to add * combine code into behavior * clean unused * fix namespace * drop next to * fix spawn entities behavior spawning entities outside container
This commit is contained in:
@@ -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<TransformSystem>();
|
||||||
|
var inventorySystem = system.EntityManager.System<InventorySystem>();
|
||||||
|
var sharedPopupSystem = system.EntityManager.System<SharedPopupSystem>();
|
||||||
|
|
||||||
|
if (!system.EntityManager.TryGetComponent<InventoryComponent>(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,10 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||||||
public float Offset { get; set; } = 0.5f;
|
public float Offset { get; set; } = 0.5f;
|
||||||
|
|
||||||
[DataField("transferForensics")]
|
[DataField("transferForensics")]
|
||||||
public bool DoTransferForensics = false;
|
public bool DoTransferForensics;
|
||||||
|
|
||||||
|
[DataField]
|
||||||
|
public bool SpawnInContainer;
|
||||||
|
|
||||||
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
public void Execute(EntityUid owner, DestructibleSystem system, EntityUid? cause = null)
|
||||||
{
|
{
|
||||||
@@ -49,7 +52,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||||||
|
|
||||||
if (EntityPrototypeHelpers.HasComponent<StackComponent>(entityId, system.PrototypeManager, system.ComponentFactory))
|
if (EntityPrototypeHelpers.HasComponent<StackComponent>(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);
|
system.StackSystem.SetCount(spawned, count);
|
||||||
|
|
||||||
TransferForensics(spawned, system, owner);
|
TransferForensics(spawned, system, owner);
|
||||||
@@ -58,7 +63,9 @@ namespace Content.Server.Destructible.Thresholds.Behaviors
|
|||||||
{
|
{
|
||||||
for (var i = 0; i < count; i++)
|
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);
|
TransferForensics(spawned, system, owner);
|
||||||
}
|
}
|
||||||
|
|||||||
1
Resources/Locale/en-US/burning/bodyburn.ftl
Normal file
1
Resources/Locale/en-US/burning/bodyburn.ftl
Normal file
@@ -0,0 +1 @@
|
|||||||
|
bodyburn-text-others = {$name}'s body burns to ash!
|
||||||
@@ -60,6 +60,21 @@
|
|||||||
damage: 400
|
damage: 400
|
||||||
behaviors:
|
behaviors:
|
||||||
- !type:GibBehavior { }
|
- !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: RadiationReceiver
|
||||||
- type: Stamina
|
- type: Stamina
|
||||||
- type: MobState
|
- type: MobState
|
||||||
|
|||||||
Reference in New Issue
Block a user