Adjust interaction ordering & interaction conditions (#6387)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -77,15 +77,6 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
if (ev.Handled)
|
||||
return;
|
||||
|
||||
if (!_actionBlockerSystem.CanInteract(ev.User) || !_actionBlockerSystem.CanUse(ev.User))
|
||||
return;
|
||||
|
||||
if (!ev.User.InRangeUnobstructed(uid, popup: true))
|
||||
{
|
||||
ev.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ev.Handled = TryUseFood(uid, ev.User);
|
||||
}
|
||||
|
||||
@@ -94,30 +85,15 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
/// </summary>
|
||||
private void OnFeedFood(EntityUid uid, FoodComponent foodComponent, 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 = TryUseFood(uid, args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.User.InRangeUnobstructed(args.Target.Value, popup: true))
|
||||
{
|
||||
args.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
args.Handled = TryForceFeed(uid, args.User, args.Target.Value);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
{
|
||||
var targetEntity = args.Target;
|
||||
if (targetEntity == null ||
|
||||
!args.CanReach ||
|
||||
!EntityManager.TryGetComponent(uid, out SmokableComponent? smokable) ||
|
||||
smokable.State == SmokableState.Lit)
|
||||
return;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Nutrition.EntitySystems
|
||||
/// </summary>
|
||||
private void OnAfterInteract(EntityUid uid, UtensilComponent component, AfterInteractEvent ev)
|
||||
{
|
||||
if (ev.Target == null)
|
||||
if (ev.Target == null || !ev.CanReach)
|
||||
return;
|
||||
|
||||
if (TryUseUtensil(ev.User, ev.Target.Value, component))
|
||||
|
||||
Reference in New Issue
Block a user