Skip to content

Commit

Permalink
Fix Item Transfer System (#524)
Browse files Browse the repository at this point in the history
# Description

Fixes #522

---

# Changelog

:cl:
- fix: Food and handcuffs can now be given
  • Loading branch information
Spatison authored Jul 9, 2024
1 parent eae8ea8 commit be6c214
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Content.Shared/OfferItem/SharedOfferItemSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ public abstract partial class SharedOfferItemSystem : EntitySystem

public override void Initialize()
{
SubscribeLocalEvent<OfferItemComponent, AfterInteractUsingEvent>(SetInReceiveMode);
SubscribeLocalEvent<OfferItemComponent, InteractUsingEvent>(SetInReceiveMode);
SubscribeLocalEvent<OfferItemComponent, MoveEvent>(OnMove);

InitializeInteractions();
}

private void SetInReceiveMode(EntityUid uid, OfferItemComponent component, AfterInteractUsingEvent args)
private void SetInReceiveMode(EntityUid uid, OfferItemComponent component, InteractUsingEvent args)
{
if (!TryComp<OfferItemComponent>(args.User, out var offerItem))
return;

if (args.User == uid || component.IsInReceiveMode ||
if (args.User == uid || component.IsInReceiveMode || !offerItem.IsInOfferMode ||
(offerItem.IsInReceiveMode && offerItem.Target != uid))
return;

Expand All @@ -44,6 +44,8 @@ private void SetInReceiveMode(EntityUid uid, OfferItemComponent component, After
_popup.PopupEntity(Loc.GetString("offer-item-try-give-target",
("user", Identity.Entity(component.Target.Value, EntityManager)),
("item", Identity.Entity(offerItem.Item.Value, EntityManager))), component.Target.Value, uid);

args.Handled = true;
}

private void OnMove(EntityUid uid, OfferItemComponent component, MoveEvent args)
Expand Down

0 comments on commit be6c214

Please sign in to comment.