Stunprod fixes & add new sprites (#334)

* - tweak: Cleanup snatcherprod and tentacle gun.

* - fix: Cleanup StunprodSystem.

* - add: Snatcherprod on inhand sprites.
This commit is contained in:
Aviu00
2024-06-06 11:30:00 +00:00
committed by GitHub
parent 19b3d5bcc9
commit e72db9d701
9 changed files with 70 additions and 50 deletions

View File

@@ -10,6 +10,7 @@ public sealed class SnatcherprodSystem : EntitySystem
{
[Dependency] private readonly SharedHandsSystem _hands = default!;
[Dependency] private readonly SharedItemToggleSystem _itemToggle = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
public override void Initialize()
{
@@ -18,7 +19,6 @@ public sealed class SnatcherprodSystem : EntitySystem
SubscribeLocalEvent<SnatcherprodComponent, StaminaMeleeHitEvent>(OnHit);
}
private void OnHit(EntityUid uid, SnatcherprodComponent component, StaminaMeleeHitEvent args)
{
if (!_itemToggle.IsActivated(uid) || args.HitList.Count == 0)
@@ -29,28 +29,13 @@ public sealed class SnatcherprodSystem : EntitySystem
if (entity == uid || !TryComp(entity, out HandsComponent? hands))
return;
EntityUid? heldEntity = null;
if (hands.ActiveHandEntity != null)
heldEntity = hands.ActiveHandEntity;
else
foreach (var heldEntity in _handsSystem.EnumerateHeld(entity, hands))
{
foreach (var hand in hands.Hands)
{
if (hand.Value.HeldEntity == null)
continue;
if (!_hands.TryDrop(entity, heldEntity, null, false, false, handsComp: hands))
continue;
heldEntity = hand.Value.HeldEntity;
break;
}
if (heldEntity == null)
return;
_hands.PickupOrDrop(args.User, heldEntity, false);
break;
}
if (!_hands.TryDrop(entity, heldEntity.Value, null, false, false, handsComp: hands))
return;
_hands.PickupOrDrop(args.User, heldEntity.Value, false);
}
}