Reduce action blocker uses and add target entity to CanInteract (#6655)

This commit is contained in:
Leon Friedrich
2022-02-15 17:06:52 +13:00
committed by GitHub
parent 334568dad2
commit ad9ddf1552
60 changed files with 286 additions and 402 deletions

View File

@@ -40,7 +40,6 @@ namespace Content.Server.Nutrition.EntitySystems
[Dependency] private readonly StomachSystem _stomachSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAdminLogSystem _logSystem = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly SpillableSystem _spillableSystem = default!;
public override void Initialize()
@@ -111,10 +110,6 @@ namespace Content.Server.Nutrition.EntitySystems
if (args.Handled || args.Target == null || !args.CanReach)
return;
// CanInteract already checked CanInteract
if (!_actionBlockerSystem.CanUse(args.User))
return;
args.Handled = TryDrink(args.User, args.Target.Value, component);
}
@@ -122,12 +117,6 @@ namespace Content.Server.Nutrition.EntitySystems
{
if (args.Handled) return;
if (!args.User.InRangeUnobstructed(uid, popup: true))
{
args.Handled = true;
return;
}
if (!component.Opened)
{
//Do the opening stuff like playing the sounds.
@@ -137,10 +126,6 @@ namespace Content.Server.Nutrition.EntitySystems
return;
}
// CanUse already checked; trying to keep it consistent if we interact with ourselves.
if (!_actionBlockerSystem.CanInteract(args.User))
return;
args.Handled = TryDrink(args.User, args.User, component);
}