[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-09-14 13:41:42 -07:00
committed by GitHub
parent 9e204c3023
commit d8e818283c
4 changed files with 58 additions and 27 deletions

View File

@@ -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.