Adjust interaction ordering & interaction conditions (#6387)

This commit is contained in:
Leon Friedrich
2022-02-05 15:39:01 +13:00
committed by GitHub
parent 442d7dbf8e
commit dd61fb46ea
28 changed files with 88 additions and 167 deletions

View File

@@ -130,30 +130,15 @@ namespace Content.Server.Nutrition.EntitySystems
private void AfterInteract(EntityUid uid, DrinkComponent component, AfterInteractEvent args)
{
if (args.Handled || args.Target == null)
if (args.Handled || args.Target == null || !args.CanReach)
return;
if (!_actionBlockerSystem.CanInteract(args.User) || !_actionBlockerSystem.CanUse(args.User))
return;
if (!args.User.InRangeUnobstructed(uid, popup: true))
{
args.Handled = true;
return;
}
if (args.User == args.Target)
{
args.Handled = TryUseDrink(uid, args.User);
return;
}
if (!args.User.InRangeUnobstructed(args.Target.Value, popup: true))
{
args.Handled = true;
return;
}
if (args.User == args.Target)
args.Handled = TryUseDrink(uid, args.User, component);
else
@@ -164,15 +149,6 @@ namespace Content.Server.Nutrition.EntitySystems
{
if (args.Handled) return;
if (!_actionBlockerSystem.CanInteract(args.User) || !_actionBlockerSystem.CanUse(args.User))
return;
if (!args.User.InRangeUnobstructed(uid, popup: true))
{
args.Handled = true;
return;
}
if (!component.Opened)
{
//Do the opening stuff like playing the sounds.