explosion minor rework + fix (#21718)

This commit is contained in:
deltanedas
2023-11-19 17:44:42 +00:00
committed by GitHub
parent db76d85f36
commit f25773ffec
10 changed files with 148 additions and 62 deletions

View File

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