Make gibbing drop items again (#21047)
LGTM, Just a warning that this will probably get overriden when medical refactor gets merged since it refactors gibbing.
This commit is contained in:
@@ -5,6 +5,8 @@ using Content.Shared.Body.Organ;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Body.Prototypes;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
|
||||
@@ -19,6 +21,8 @@ public partial class SharedBodySystem
|
||||
* - Each "connection" is a body part (e.g. arm, hand, etc.) and each part can also contain organs.
|
||||
*/
|
||||
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
|
||||
private void InitializeBody()
|
||||
{
|
||||
// Body here to handle root body parts.
|
||||
@@ -263,7 +267,7 @@ public partial class SharedBodySystem
|
||||
}
|
||||
|
||||
public virtual HashSet<EntityUid> GibBody(EntityUid bodyId, bool gibOrgans = false,
|
||||
BodyComponent? body = null, bool deleteItems = false)
|
||||
BodyComponent? body = null, bool deleteItems = false, bool deleteBrain = false)
|
||||
{
|
||||
var gibs = new HashSet<EntityUid>();
|
||||
|
||||
@@ -287,7 +291,14 @@ public partial class SharedBodySystem
|
||||
gibs.Add(organ.Id);
|
||||
}
|
||||
}
|
||||
|
||||
if(TryComp<InventoryComponent>(bodyId, out var inventory))
|
||||
{
|
||||
foreach (var item in _inventory.GetHandOrInventoryEntities(bodyId))
|
||||
{
|
||||
SharedTransform.AttachToGridOrMap(item);
|
||||
gibs.Add(item);
|
||||
}
|
||||
}
|
||||
return gibs;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user