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:
Whisper
2024-04-15 01:04:15 -04:00
committed by GitHub
parent 3d0fc10673
commit 4a6cf480cc
4 changed files with 58 additions and 3 deletions

View File

@@ -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<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);
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);
}