Fixes EatVerb interaction range (#5505)

This commit is contained in:
FoLoKe
2021-11-25 05:16:56 +03:00
committed by GitHub
parent 33cfc57e58
commit e94bd5698d

View File

@@ -126,7 +126,8 @@ namespace Content.Server.Nutrition.EntitySystems
} }
} }
if (userUid != targetUid && !userUid.InRangeUnobstructed(targetUid, popup: true)) if (!userUid.InRangeUnobstructed(uid, popup: true) ||
userUid != targetUid && !userUid.InRangeUnobstructed(targetUid, popup: true))
return false; return false;
var transferAmount = component.TransferAmount != null ? FixedPoint2.Min((FixedPoint2) component.TransferAmount, solution.CurrentVolume) : solution.CurrentVolume; var transferAmount = component.TransferAmount != null ? FixedPoint2.Min((FixedPoint2) component.TransferAmount, solution.CurrentVolume) : solution.CurrentVolume;
@@ -198,8 +199,8 @@ namespace Content.Server.Nutrition.EntitySystems
//TODO: DoAfter based on delay after food & drinks delay PR merged... //TODO: DoAfter based on delay after food & drinks delay PR merged...
private void AddEatVerb(EntityUid uid, FoodComponent component, GetInteractionVerbsEvent ev) private void AddEatVerb(EntityUid uid, FoodComponent component, GetInteractionVerbsEvent ev)
{ {
Logger.DebugS("action", "triggered");
if (!ev.CanInteract || if (!ev.CanInteract ||
!ev.CanAccess ||
!EntityManager.TryGetComponent(ev.User.Uid, out SharedBodyComponent? body) || !EntityManager.TryGetComponent(ev.User.Uid, out SharedBodyComponent? body) ||
!_bodySystem.TryGetComponentsOnMechanisms<StomachComponent>(ev.User.Uid, out var stomachs, body)) !_bodySystem.TryGetComponentsOnMechanisms<StomachComponent>(ev.User.Uid, out var stomachs, body))
return; return;