[STAGING/HOTFIX] Butcher entities in containers. (#40299)

* Kitchen spike and sharp system

* Use transform and parent

* A

* Works

* A

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Princess Cheeseballs
2025-12-29 11:39:07 -06:00
committed by Vanessa
co-authored by Princess Cheeseballs
parent 4f995c8dce
commit 21038e13e2
4 changed files with 59 additions and 27 deletions
@@ -102,19 +102,25 @@ public sealed class SharpSystem : EntitySystem
component.Butchering.Remove(args.Args.Target.Value);
if (_containerSystem.IsEntityInContainer(args.Args.Target.Value))
{
args.Handled = true;
return;
}
var spawnEntities = EntitySpawnCollection.GetSpawns(butcher.SpawnedEntities, _robustRandom);
var coords = _transform.GetMapCoordinates(args.Args.Target.Value);
EntityUid popupEnt = default!;
foreach (var proto in spawnEntities)
if (_containerSystem.TryGetContainingContainer(args.Args.Target.Value, out var container))
{
// distribute the spawned items randomly in a small radius around the origin
popupEnt = Spawn(proto, coords.Offset(_robustRandom.NextVector2(0.25f)));
foreach (var proto in spawnEntities)
{
// distribute the spawned items randomly in a small radius around the origin
popupEnt = SpawnInContainerOrDrop(proto, container.Owner, container.ID);
}
}
else
{
foreach (var proto in spawnEntities)
{
// distribute the spawned items randomly in a small radius around the origin
popupEnt = Spawn(proto, coords.Offset(_robustRandom.NextVector2(0.25f)));
}
}
// only show a big popup when butchering living things.