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:
@@ -7,6 +7,7 @@ using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Arcade;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.NetIDs;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
@@ -49,15 +50,11 @@ namespace Content.Server.Arcade.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if(!eventArgs.User.TryGetComponent(out ActorComponent? actor))
|
||||
{
|
||||
if(!Powered || !eventArgs.User.TryGetComponent(out ActorComponent? actor))
|
||||
return;
|
||||
}
|
||||
if (!Powered)
|
||||
{
|
||||
|
||||
if(!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
return;
|
||||
}
|
||||
if(!ActionBlockerSystem.CanInteract(actor.PlayerSession.AttachedEntity)) return;
|
||||
|
||||
UserInterface?.Toggle(actor.PlayerSession);
|
||||
RegisterPlayerSession(actor.PlayerSession);
|
||||
@@ -134,7 +131,8 @@ namespace Content.Server.Arcade.Components
|
||||
case BlockGameMessages.BlockGamePlayerActionMessage playerActionMessage:
|
||||
if (obj.Session != _player) break;
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(Owner))
|
||||
// TODO: Should this check if the Owner can interact...?
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(Owner))
|
||||
{
|
||||
DeactivePlayer(obj.Session);
|
||||
break;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Server.Wires.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Arcade;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Wires;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -58,15 +59,11 @@ namespace Content.Server.Arcade.Components
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if(!eventArgs.User.TryGetComponent(out ActorComponent? actor))
|
||||
{
|
||||
if(!Powered || !eventArgs.User.TryGetComponent(out ActorComponent? actor))
|
||||
return;
|
||||
}
|
||||
if (!Powered)
|
||||
{
|
||||
|
||||
if(!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
return;
|
||||
}
|
||||
if(!ActionBlockerSystem.CanInteract(actor.PlayerSession.AttachedEntity)) return;
|
||||
|
||||
_game ??= new SpaceVillainGame(this);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user