Reduce action blocker uses and add target entity to CanInteract (#6655)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!Resolve(uid, ref flammable))
|
||||
return;
|
||||
|
||||
if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner) || flammable.Resisting)
|
||||
if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner, null) || flammable.Resisting)
|
||||
return;
|
||||
|
||||
flammable.Resisting = true;
|
||||
|
||||
@@ -18,10 +18,8 @@ using Robust.Shared.Player;
|
||||
namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class GasValveSystem : EntitySystem
|
||||
public sealed class GasValveSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -51,11 +49,8 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
private void OnActivate(EntityUid uid, GasValveComponent component, ActivateInWorldEvent args)
|
||||
{
|
||||
if (args.User.InRangeUnobstructed(args.Target) && _actionBlockerSystem.CanInteract(args.User))
|
||||
{
|
||||
Toggle(uid, component);
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner), component.ValveSound.GetSound(), component.Owner, AudioHelpers.WithVariation(0.25f));
|
||||
}
|
||||
Toggle(uid, component);
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner), component.ValveSound.GetSound(), component.Owner, AudioHelpers.WithVariation(0.25f));
|
||||
}
|
||||
|
||||
public void Set(EntityUid uid, GasValveComponent component, bool value)
|
||||
|
||||
@@ -25,11 +25,10 @@ using Robust.Shared.Players;
|
||||
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class GasCanisterSystem : EntitySystem
|
||||
public sealed class GasCanisterSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
|
||||
[Dependency] private readonly AdminLogSystem _adminLogSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
|
||||
Reference in New Issue
Block a user