Deprecate IActionBlocker in favour of cancellable events (#4193)
* Deprecate IActionBlocker in favour of cancellable events * Bring back old speech/emoting component restrictions * Rename action blocker listener methods * Use Entity System public methods instead of extension methods Co-authored-by: Vera Aguilera Puerto <gradientvera@outlook.com>
This commit is contained in:
@@ -397,8 +397,10 @@ namespace Content.Server.Disposal.Mailing
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(player) ||
|
||||
!ActionBlockerSystem.CanUse(player))
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
if (!actionBlocker.CanInteract(player) ||
|
||||
!actionBlocker.CanUse(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -659,7 +661,7 @@ namespace Content.Server.Disposal.Mailing
|
||||
|
||||
private bool IsValidInteraction(ITargetedInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't do that!"));
|
||||
return false;
|
||||
@@ -746,7 +748,7 @@ namespace Content.Server.Disposal.Mailing
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) ||
|
||||
component.ContainedEntities.Contains(user))
|
||||
{
|
||||
return;
|
||||
@@ -769,7 +771,7 @@ namespace Content.Server.Disposal.Mailing
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) ||
|
||||
component.ContainedEntities.Contains(user))
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -7,7 +7,7 @@ using Content.Server.Hands.Components;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.Console;
|
||||
@@ -108,9 +108,10 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
if (!Anchored)
|
||||
return false;
|
||||
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||
//Check if player can interact in their current state
|
||||
if (!groupController.CanAdminMenu(session) && (!ActionBlockerSystem.CanInteract(session.AttachedEntity) || !ActionBlockerSystem.CanUse(session.AttachedEntity)))
|
||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntity) || !actionBlocker.CanUse(session.AttachedEntity)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -4,7 +4,7 @@ using Content.Server.Hands.Components;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.Console;
|
||||
@@ -90,9 +90,10 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
if (!Anchored)
|
||||
return false;
|
||||
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||
//Check if player can interact in their current state
|
||||
if (!groupController.CanAdminMenu(session) && (!ActionBlockerSystem.CanInteract(session.AttachedEntity) || !ActionBlockerSystem.CanUse(session.AttachedEntity)))
|
||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntity) || !actionBlocker.CanUse(session.AttachedEntity)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -340,8 +340,10 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(player) ||
|
||||
!ActionBlockerSystem.CanUse(player))
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
if (!actionBlocker.CanInteract(player) ||
|
||||
!actionBlocker.CanUse(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -556,7 +558,7 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
|
||||
bool IsValidInteraction(ITargetedInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
{
|
||||
Owner.PopupMessage(eventArgs.User, Loc.GetString("You can't do that!"));
|
||||
return false;
|
||||
@@ -649,7 +651,7 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) ||
|
||||
component.ContainedEntities.Contains(user))
|
||||
{
|
||||
return;
|
||||
@@ -672,7 +674,7 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) ||
|
||||
component.ContainedEntities.Contains(user))
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user