gotta hand it to em

This commit is contained in:
Janet Blackquill
2026-05-30 12:24:00 -04:00
parent 01dff7455f
commit 6df39ef08b
8 changed files with 69 additions and 4 deletions
@@ -172,6 +172,11 @@ public abstract partial class SharedHandsSystem : EntitySystem
if (!CanPickupToHand(uid, entity.Value, handsComp.ActiveHandId, checkActionBlocker: checkActionBlocker, handsComp: handsComp))
return false;
// Offbrand
if (!BeforeDoPickup((uid, handsComp), entity.Value, handName))
return false;
// End Offbrand
DoDrop(uid, handName, false, log: false);
DoPickup(uid, handsComp.ActiveHandId, entity.Value, handsComp, log: false);
return true;
@@ -90,7 +90,7 @@ public abstract partial class SharedHandsSystem
if (!CanPickupToHand(uid, entity, handId, checkActionBlocker: checkActionBlocker, showPopup: true, handsComp: handsComp, item: item))
return false;
if (!BeforeDoPickup((uid, handsComp), entity))
if (!BeforeDoPickup((uid, handsComp), entity, handId)) // Offbrand - useless hands
return false;
if (animate)
@@ -252,12 +252,12 @@ public abstract partial class SharedHandsSystem
/// is called. Used to run a cancelable before pickup event that can have
/// side effects, unlike the side effect free <see cref="GettingPickedUpAttemptEvent"/>.
/// </summary>
private bool BeforeDoPickup(Entity<HandsComponent?> user, EntityUid item)
private bool BeforeDoPickup(Entity<HandsComponent?> user, EntityUid item, string handId)
{
if (!Resolve(user, ref user.Comp))
return false;
var userEv = new BeforeEquippingHandEvent(item);
var userEv = new BeforeEquippingHandEvent(item, handId); // Offbrand - useless hands
RaiseLocalEvent(user, ref userEv);
if (userEv.Cancelled)
+1 -1
View File
@@ -181,7 +181,7 @@ namespace Content.Shared.Hands
/// If true, the item will not be equipped into the user's hand.
/// </param>
[ByRefEvent]
public record struct BeforeEquippingHandEvent(EntityUid Item, bool Cancelled = false);
public record struct BeforeEquippingHandEvent(EntityUid Item, string HandId = "", bool Cancelled = false); // Offbrand - useless hands
/// <summary>
/// Raised when putting an entity into a hand slot
@@ -73,6 +73,7 @@ public sealed partial class StatusEffectsSystem
SubscribeLocalEvent<StatusEffectContainerComponent, DamageChangedEvent>(RelayStatusEffectEvent); // Offbrand
SubscribeLocalEvent<StatusEffectContainerComponent, Content.Shared.Examine.ExaminedEvent>(RelayStatusEffectEvent); // Offbrand
SubscribeLocalEvent<StatusEffectContainerComponent, Content.Shared.Verbs.GetVerbsEvent<Content.Shared.Verbs.AlternativeVerb>>(RelayStatusEffectEvent); // Offbrand
SubscribeLocalEvent<StatusEffectContainerComponent, Content.Shared.Hands.BeforeEquippingHandEvent>(RefRelayStatusEffectEvent); // Offbrand
}
private void RefRelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, ref T args) where T : struct
@@ -1,5 +1,6 @@
using Content.Shared._Offbrand.Wounds;
using Content.Shared.Body;
using Content.Shared.Hands;
namespace Content.Shared._Offbrand.Organs;
@@ -15,6 +16,7 @@ public sealed partial class WoundableOrganSystem : EntitySystem
SubscribeLocalEvent<WoundableOrganComponent, BodyRelayedEvent<HealWoundsEvent>>(UnwrapRelay);
SubscribeLocalEvent<WoundableOrganComponent, BodyRelayedEvent<GetBleedLevelEvent>>(UnwrapRelay);
SubscribeLocalEvent<WoundableOrganComponent, BodyRelayedEvent<ClampWoundsEvent>>(UnwrapRelay);
SubscribeLocalEvent<WoundableOrganComponent, BodyRelayedEvent<BeforeEquippingHandEvent>>(UnwrapRelay);
}
private void OnGetWeights(Entity<WoundableOrganComponent> ent, ref BodyRelayedEvent<WoundableOrganWeightsEvent> args)
@@ -0,0 +1,5 @@
namespace Content.Shared._Offbrand.StatusEffects;
[RegisterComponent]
[Access(typeof(HandIncapacitationStatusEffectSystem))]
public sealed partial class HandIncapacitationStatusEffectComponent : Component;
@@ -0,0 +1,50 @@
using Content.Shared.Body;
using Content.Shared.Hands;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.StatusEffectNew;
using Content.Shared.StatusEffectNew.Components;
namespace Content.Shared._Offbrand.StatusEffects;
public sealed partial class HandIncapacitationStatusEffectSystem : EntitySystem
{
[Dependency] private BodySystem _body = default!;
[Dependency] private SharedHandsSystem _hands = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BodyComponent, BeforeEquippingHandEvent>(_body.RelayEvent);
SubscribeLocalEvent<HandIncapacitationStatusEffectComponent, StatusEffectAppliedEvent>(OnStatusEffectApplied);
SubscribeLocalEvent<HandIncapacitationStatusEffectComponent, StatusEffectRelayedEvent<BeforeEquippingHandEvent>>(OnBeforeEquippingHand);
}
private void OnStatusEffectApplied(Entity<HandIncapacitationStatusEffectComponent> ent, ref StatusEffectAppliedEvent args)
{
if (!TryComp<StatusEffectComponent>(ent, out var status) || status.AppliedTo is not { } organ)
return;
if (!TryComp<HandOrganComponent>(organ, out var handOrgan))
return;
if (!TryComp<OrganComponent>(organ, out var organComp) || organComp.Body is not { } body)
return;
_hands.TryDrop((body, null), handOrgan.HandID);
}
private void OnBeforeEquippingHand(Entity<HandIncapacitationStatusEffectComponent> ent, ref StatusEffectRelayedEvent<BeforeEquippingHandEvent> args)
{
if (!TryComp<StatusEffectComponent>(ent, out var status) || status.AppliedTo is not { } organ)
return;
if (!TryComp<HandOrganComponent>(organ, out var handOrgan))
return;
if (args.Args.HandId != handOrgan.HandID)
return;
args.Args = args.Args with { Cancelled = true };
}
}
@@ -23,6 +23,7 @@
visualType: MediumCaution
- type: ExaminableStatusEffect
message: fracture-examine
- type: HandIncapacitationStatusEffect
- type: entity
parent: WoundInternalBase
@@ -39,6 +40,7 @@
visualType: MediumCaution
- type: ExaminableStatusEffect
message: cut-tendon-examine
- type: HandIncapacitationStatusEffect
- type: entity
parent: WoundInternalBase