explosion minor rework + fix (#21718)
This commit is contained in:
@@ -8,6 +8,7 @@ using Content.Server.Stunnable;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.CombatMode;
|
||||
using Content.Shared.Explosion;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
@@ -54,6 +55,8 @@ namespace Content.Server.Hands.Systems
|
||||
|
||||
SubscribeLocalEvent<HandsComponent, ComponentGetState>(GetComponentState);
|
||||
|
||||
SubscribeLocalEvent<HandsComponent, BeforeExplodeEvent>(OnExploded);
|
||||
|
||||
CommandBinds.Builder
|
||||
.Bind(ContentKeyFunctions.ThrowItemInHand, new PointerInputCmdHandler(HandleThrowItem))
|
||||
.Bind(ContentKeyFunctions.SmartEquipBackpack, InputCmdHandler.FromDelegate(HandleSmartEquipBackpack))
|
||||
@@ -73,6 +76,15 @@ namespace Content.Server.Hands.Systems
|
||||
args.State = new HandsComponentState(hands);
|
||||
}
|
||||
|
||||
private void OnExploded(Entity<HandsComponent> ent, ref BeforeExplodeEvent args)
|
||||
{
|
||||
foreach (var hand in ent.Comp.Hands.Values)
|
||||
{
|
||||
if (hand.HeldEntity is {} uid)
|
||||
args.Contents.Add(uid);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisarmed(EntityUid uid, HandsComponent component, DisarmedEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
|
||||
Reference in New Issue
Block a user