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

@@ -207,11 +207,6 @@ namespace Content.Server.Atmos.Components
internal void ToggleInternals()
{
var user = GetInternalsComponent()?.Owner;
if (user == null || !EntitySystem.Get<ActionBlockerSystem>().CanUse(user.Value))
return;
if (IsConnected)
{
DisconnectFromInternals();
@@ -321,6 +316,9 @@ namespace Content.Server.Atmos.Components
{
public bool DoToggleAction(ToggleItemActionEventArgs args)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(args.Performer, args.Item))
return false;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent<GasTankComponent?>(args.Item, out var gasTankComponent)) return false;
// no change
if (gasTankComponent.IsConnected == args.ToggledOn) return false;