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:
@@ -1,10 +1,9 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Physics.Controllers;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
namespace Content.Client.Physics.Controllers
|
||||
{
|
||||
|
||||
@@ -9,6 +9,8 @@ using Content.Shared.Body.Part;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Coordinates;
|
||||
using Content.Shared.EffectBlocker;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Movement;
|
||||
using NUnit.Framework;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -66,6 +68,7 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
{
|
||||
var mapManager = IoCManager.Resolve<IMapManager>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
var gridId = new GridId(1);
|
||||
var grid = mapManager.GetGrid(gridId);
|
||||
@@ -79,8 +82,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.NotNull(buckle);
|
||||
Assert.Null(buckle.BuckledTo);
|
||||
Assert.False(buckle.Buckled);
|
||||
Assert.True(ActionBlockerSystem.CanMove(human));
|
||||
Assert.True(ActionBlockerSystem.CanChangeDirection(human));
|
||||
Assert.True(actionBlocker.CanMove(human));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human));
|
||||
Assert.True(EffectBlockerSystem.CanFall(human));
|
||||
|
||||
// Default state, no buckled entities, strap
|
||||
@@ -96,8 +99,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
|
||||
var player = IoCManager.Resolve<IPlayerManager>().GetAllPlayers().Single();
|
||||
Assert.True(((BuckleComponentState) buckle.GetComponentState(player)).Buckled);
|
||||
Assert.False(ActionBlockerSystem.CanMove(human));
|
||||
Assert.False(ActionBlockerSystem.CanChangeDirection(human));
|
||||
Assert.False(actionBlocker.CanMove(human));
|
||||
Assert.False(actionBlocker.CanChangeDirection(human));
|
||||
Assert.False(EffectBlockerSystem.CanFall(human));
|
||||
Assert.That(human.Transform.WorldPosition, Is.EqualTo(chair.Transform.WorldPosition));
|
||||
|
||||
@@ -120,6 +123,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
// Still buckled
|
||||
Assert.True(buckle.Buckled);
|
||||
|
||||
@@ -127,8 +132,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
Assert.True(buckle.TryUnbuckle(human));
|
||||
Assert.Null(buckle.BuckledTo);
|
||||
Assert.False(buckle.Buckled);
|
||||
Assert.True(ActionBlockerSystem.CanMove(human));
|
||||
Assert.True(ActionBlockerSystem.CanChangeDirection(human));
|
||||
Assert.True(actionBlocker.CanMove(human));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human));
|
||||
Assert.True(EffectBlockerSystem.CanFall(human));
|
||||
|
||||
// Unbuckle, strap
|
||||
@@ -153,6 +158,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
// Still buckled
|
||||
Assert.True(buckle.Buckled);
|
||||
|
||||
@@ -182,8 +189,8 @@ namespace Content.IntegrationTests.Tests.Buckle
|
||||
// Force unbuckle
|
||||
Assert.True(buckle.TryUnbuckle(human, true));
|
||||
Assert.False(buckle.Buckled);
|
||||
Assert.True(ActionBlockerSystem.CanMove(human));
|
||||
Assert.True(ActionBlockerSystem.CanChangeDirection(human));
|
||||
Assert.True(actionBlocker.CanMove(human));
|
||||
Assert.True(actionBlocker.CanChangeDirection(human));
|
||||
Assert.True(EffectBlockerSystem.CanFall(human));
|
||||
|
||||
// Re-buckle
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Server.AI.Pathfinding.Pathfinders;
|
||||
using Content.Server.CPUJob.JobQueues;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Movement;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
@@ -249,7 +250,7 @@ namespace Content.Server.AI.Steering
|
||||
// Main optimisation to be done below is the redundant calls and adding more variables
|
||||
if (entity.Deleted ||
|
||||
!entity.TryGetComponent(out AiControllerComponent? controller) ||
|
||||
!ActionBlockerSystem.CanMove(entity) ||
|
||||
!EntitySystem.Get<ActionBlockerSystem>().CanMove(entity) ||
|
||||
!entity.Transform.GridID.IsValid())
|
||||
{
|
||||
return SteeringStatus.NoPath;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Server.AI.WorldState;
|
||||
using Content.Server.AI.WorldState.States;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Movement;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.AI.Utility.Considerations.ActionBlocker
|
||||
{
|
||||
@@ -10,7 +12,7 @@ namespace Content.Server.AI.Utility.Considerations.ActionBlocker
|
||||
{
|
||||
var self = context.GetState<SelfState>().GetValue();
|
||||
|
||||
if (self == null || !ActionBlockerSystem.CanMove(self))
|
||||
if (self == null || !EntitySystem.Get<ActionBlockerSystem>().CanMove(self))
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.AME;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -157,8 +157,11 @@ namespace Content.Server.AME.Components
|
||||
//Need player entity to check if they are still able to use the dispenser
|
||||
if (playerEntity == null)
|
||||
return false;
|
||||
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
//Check if player can interact in their current state
|
||||
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
||||
if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity))
|
||||
return false;
|
||||
//Check if device is powered
|
||||
if (needsPower && !Powered)
|
||||
|
||||
@@ -10,7 +10,7 @@ using Content.Shared.Access;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Acts;
|
||||
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.GameObjects;
|
||||
@@ -259,7 +259,7 @@ namespace Content.Server.Access.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, IdCardConsoleComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -284,7 +284,7 @@ namespace Content.Server.Access.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, IdCardConsoleComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -11,8 +11,8 @@ using Content.Shared.Actions.Behaviors;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Cooldown;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -57,7 +57,7 @@ namespace Content.Server.Actions.Actions
|
||||
}
|
||||
|
||||
if (!args.Performer.TryGetComponent<SharedActionsComponent>(out var actions)) return;
|
||||
if (args.Target == args.Performer || !args.Performer.CanAttack()) return;
|
||||
if (args.Target == args.Performer || !EntitySystem.Get<ActionBlockerSystem>().CanAttack(args.Performer)) return;
|
||||
|
||||
var random = IoCManager.Resolve<IRobustRandom>();
|
||||
var audio = EntitySystem.Get<AudioSystem>();
|
||||
|
||||
@@ -8,8 +8,10 @@ using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.CharacterAppearance;
|
||||
using Content.Shared.Cooldown;
|
||||
using Content.Shared.Speech;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Random;
|
||||
@@ -40,7 +42,7 @@ namespace Content.Server.Actions.Actions
|
||||
|
||||
public void DoInstantAction(InstantActionEventArgs args)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanSpeak(args.Performer)) return;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanSpeak(args.Performer)) return;
|
||||
if (!args.Performer.TryGetComponent<HumanoidAppearanceComponent>(out var humanoid)) return;
|
||||
if (!args.Performer.TryGetComponent<SharedActionsComponent>(out var actions)) return;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Actions.Prototypes;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameStates;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -186,7 +187,7 @@ namespace Content.Server.Actions
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanChangeDirection(player)) return true;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanChangeDirection(player)) return true;
|
||||
|
||||
// don't set facing unless they clicked far enough away
|
||||
var diff = targetWorldPos - player.Transform.WorldPosition;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Content.Server.Body.Surgery.Messages;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -52,7 +53,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(tool.PerformerCache) ||
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(tool.PerformerCache) ||
|
||||
!tool.PerformerCache.InRangeUnobstructed(tool.BodyCache))
|
||||
{
|
||||
tool.CloseAllSurgeryUIs();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -14,7 +15,7 @@ namespace Content.Server.Botany.Components
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
return false;
|
||||
|
||||
if (eventArgs.Using.HasTag("BotanySharp"))
|
||||
|
||||
@@ -15,7 +15,7 @@ using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Chemistry.Solution.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Tag;
|
||||
@@ -420,7 +420,7 @@ namespace Content.Server.Botany.Components
|
||||
|
||||
public bool DoHarvest(IEntity user)
|
||||
{
|
||||
if (Seed == null || user.Deleted || !ActionBlockerSystem.CanInteract(user))
|
||||
if (Seed == null || user.Deleted || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return false;
|
||||
|
||||
if (Harvest && !Dead)
|
||||
@@ -645,7 +645,7 @@ namespace Content.Server.Botany.Components
|
||||
var user = eventArgs.User;
|
||||
var usingItem = eventArgs.Using;
|
||||
|
||||
if (usingItem == null || usingItem.Deleted || !ActionBlockerSystem.CanInteract(user))
|
||||
if (usingItem == null || usingItem.Deleted || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return false;
|
||||
|
||||
if (usingItem.TryGetComponent(out SeedComponent? seeds))
|
||||
|
||||
@@ -10,8 +10,8 @@ using Content.Server.Stunnable.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -161,7 +161,7 @@ namespace Content.Server.Buckle.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("You can't do that!"));
|
||||
return false;
|
||||
@@ -314,7 +314,7 @@ namespace Content.Server.Buckle.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("You can't do that!"));
|
||||
return false;
|
||||
@@ -439,7 +439,7 @@ namespace Content.Server.Buckle.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, BuckleComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || !component.Buckled)
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !component.Buckled)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Content.Shared.Alert;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -179,7 +180,7 @@ namespace Content.Server.Buckle.Components
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(component.Owner) ||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(component.Owner) ||
|
||||
!user.TryGetComponent<BuckleComponent>(out var buckle) ||
|
||||
buckle.BuckledTo != null && buckle.BuckledTo != component ||
|
||||
user == component.Owner)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -54,7 +55,7 @@ namespace Content.Server.Cabinet
|
||||
{
|
||||
protected override void GetData(IEntity user, ItemCabinetComponent component, VerbData data)
|
||||
{
|
||||
if (component.ItemContainer.ContainedEntity == null || !component.Opened || !ActionBlockerSystem.CanInteract(user))
|
||||
if (component.ItemContainer.ContainedEntity == null || !component.Opened || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
else
|
||||
{
|
||||
@@ -75,7 +76,7 @@ namespace Content.Server.Cabinet
|
||||
{
|
||||
protected override void GetData(IEntity user, ItemCabinetComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -8,14 +8,14 @@ using Content.Server.Items;
|
||||
using Content.Server.MoMMI;
|
||||
using Content.Server.Preferences.Managers;
|
||||
using Content.Server.Radio.EntitySystems;
|
||||
using Content.Shared;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Emoting;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Speech;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
@@ -122,7 +122,7 @@ namespace Content.Server.Chat.Managers
|
||||
|
||||
public void EntitySay(IEntity source, string message)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanSpeak(source))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanSpeak(source))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ namespace Content.Server.Chat.Managers
|
||||
|
||||
public void EntityMe(IEntity source, string action)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanEmote(source))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanEmote(source))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Chemistry.Solution;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -144,8 +144,11 @@ namespace Content.Server.Chemistry.Components
|
||||
//Need player entity to check if they are still able to use the chem master
|
||||
if (playerEntity == null)
|
||||
return false;
|
||||
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
//Check if player can interact in their current state
|
||||
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
||||
if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity))
|
||||
return false;
|
||||
//Check if device is powered
|
||||
if (needsPower && !Powered)
|
||||
@@ -423,7 +426,7 @@ namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ChemMasterComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -13,7 +13,7 @@ using Content.Shared.Chemistry.Dispenser;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Chemistry.Solution;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
@@ -194,8 +194,11 @@ namespace Content.Server.Chemistry.Components
|
||||
//Need player entity to check if they are still able to use the dispenser
|
||||
if (playerEntity == null)
|
||||
return false;
|
||||
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
//Check if player can interact in their current state
|
||||
if (!ActionBlockerSystem.CanInteract(playerEntity) || !ActionBlockerSystem.CanUse(playerEntity))
|
||||
if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity))
|
||||
return false;
|
||||
//Check if device is powered
|
||||
if (needsPower && !Powered)
|
||||
@@ -365,7 +368,7 @@ namespace Content.Server.Chemistry.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ReagentDispenserComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -6,8 +6,8 @@ using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Climbing;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -68,7 +68,7 @@ namespace Content.Server.Climbing.Components
|
||||
/// <returns></returns>
|
||||
private bool CanVault(IEntity user, IEntity target, out string reason)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
reason = Loc.GetString("comp-climbable-cant-interact");
|
||||
return false;
|
||||
@@ -108,7 +108,7 @@ namespace Content.Server.Climbing.Components
|
||||
/// <returns></returns>
|
||||
private bool CanVault(IEntity user, IEntity dragged, IEntity target, out string reason)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
reason = Loc.GetString("comp-climbable-cant-interact");
|
||||
return false;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
@@ -125,7 +126,7 @@ namespace Content.Server.Clothing.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, MagbootsComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -14,7 +14,7 @@ namespace Content.Server.Construction.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ConstructionComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -15,8 +15,8 @@ using Content.Shared.Construction;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Content.Shared.Construction.Steps;
|
||||
using Content.Shared.Coordinates;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -305,7 +305,7 @@ namespace Content.Server.Construction
|
||||
|
||||
var user = args.SenderSession.AttachedEntity;
|
||||
|
||||
if (user == null || !ActionBlockerSystem.CanInteract(user)) return;
|
||||
if (user == null || !Get<ActionBlockerSystem>().CanInteract(user)) return;
|
||||
|
||||
if (!user.TryGetComponent(out HandsComponent? hands)) return;
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace Content.Server.Construction
|
||||
}
|
||||
|
||||
if (user == null
|
||||
|| !ActionBlockerSystem.CanInteract(user)
|
||||
|| !Get<ActionBlockerSystem>().CanInteract(user)
|
||||
|| !user.TryGetComponent(out HandsComponent? hands) || hands.GetActiveHand == null
|
||||
|| !user.InRangeUnobstructed(ev.Location, ignoreInsideBlocker:constructionPrototype.CanBuildInImpassable))
|
||||
{
|
||||
|
||||
@@ -8,8 +8,8 @@ using Content.Server.Hands.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -209,7 +209,7 @@ namespace Content.Server.Cuffs.Components
|
||||
}
|
||||
|
||||
// TODO: Make into an event and instead have a system check for owner.
|
||||
if (!isOwner && !ActionBlockerSystem.CanInteract(user))
|
||||
if (!isOwner && !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("You can't do that!"));
|
||||
return;
|
||||
@@ -322,7 +322,7 @@ namespace Content.Server.Cuffs.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, CuffableComponent component, VerbData data)
|
||||
{
|
||||
if ((user != component.Owner && !ActionBlockerSystem.CanInteract(user)) || component.CuffedHandCount == 0)
|
||||
if ((user != component.Owner && !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user)) || component.CuffedHandCount == 0)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -7,8 +7,8 @@ using Content.Server.Stunnable.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -146,7 +146,7 @@ namespace Content.Server.Cuffs.Components
|
||||
{
|
||||
if (_cuffing) return true;
|
||||
|
||||
if (eventArgs.Target == null || !ActionBlockerSystem.CanUse(eventArgs.User) || !eventArgs.Target.TryGetComponent<CuffableComponent>(out var cuffed))
|
||||
if (eventArgs.Target == null || !EntitySystem.Get<ActionBlockerSystem>().CanUse(eventArgs.User) || !eventArgs.Target.TryGetComponent<CuffableComponent>(out var cuffed))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Chemistry.Solution.Components;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -23,7 +23,7 @@ namespace Content.Server.Fluids.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, SpillableComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) ||
|
||||
!component.Owner.TryGetComponent(out ISolutionInteractionsComponent? solutionComponent) ||
|
||||
!solutionComponent.CanDrain)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ using Content.Shared.Cooldown;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Fluids;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Vapor;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -96,7 +96,7 @@ namespace Content.Server.Fluids.Components
|
||||
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
return false;
|
||||
|
||||
if (_hasSafety && _safety)
|
||||
@@ -207,7 +207,7 @@ namespace Content.Server.Fluids.Components
|
||||
|
||||
private void SetSafety(IEntity user, bool state)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || !_hasSafety)
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !_hasSafety)
|
||||
return;
|
||||
|
||||
_safety = state;
|
||||
|
||||
@@ -8,12 +8,11 @@ using Content.Server.Temperature.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Temperature;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -193,7 +192,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
// This needs some improvements...
|
||||
public void Resist()
|
||||
{
|
||||
if (!OnFire || !ActionBlockerSystem.CanInteract(Owner) || _resisting || !Owner.TryGetComponent(out StunnableComponent? stunnable)) return;
|
||||
if (!OnFire || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(Owner) || _resisting || !Owner.TryGetComponent(out StunnableComponent? stunnable)) return;
|
||||
|
||||
_resisting = true;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.Atmos.Piping;
|
||||
@@ -10,13 +9,14 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Physics;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -267,8 +267,10 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(player) ||
|
||||
!ActionBlockerSystem.CanUse(player))
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
if (!actionBlocker.CanInteract(player) ||
|
||||
!actionBlocker.CanUse(player))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ using Content.Shared.Audio;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.GameObjects.Components.Atmos.GasTank;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -218,7 +218,11 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
internal void ToggleInternals()
|
||||
{
|
||||
if (!ActionBlockerSystem.CanUse(GetInternalsComponent()?.Owner)) return;
|
||||
var user = GetInternalsComponent()?.Owner;
|
||||
|
||||
if (user == null || !EntitySystem.Get<ActionBlockerSystem>().CanUse(user))
|
||||
return;
|
||||
|
||||
if (IsConnected)
|
||||
{
|
||||
DisconnectFromInternals();
|
||||
|
||||
@@ -2,6 +2,7 @@ using Content.Server.Power.Components;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -63,7 +64,7 @@ namespace Content.Server.GameObjects.Components
|
||||
return; // Not powered, so this computer should probably do nothing.
|
||||
}
|
||||
// Can we interact?
|
||||
if (!ActionBlockerSystem.CanInteract(sessionEntity))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(sessionEntity))
|
||||
{
|
||||
sessionEntity.PopupMessageCursor(Loc.GetString("base-computer-ui-component-cannot-interact"));
|
||||
return;
|
||||
|
||||
@@ -11,8 +11,9 @@ using Content.Server.Pulling;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using Content.Shared.Pulling.Components;
|
||||
@@ -224,7 +225,7 @@ namespace Content.Server.Hands.Components
|
||||
|
||||
public bool CanPutInHand(ItemComponent item, bool mobCheck = true)
|
||||
{
|
||||
if (mobCheck && !ActionBlockerSystem.CanPickup(Owner))
|
||||
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanPickup(Owner))
|
||||
return false;
|
||||
|
||||
foreach (var handName in ActivePriorityEnumerable())
|
||||
@@ -241,7 +242,7 @@ namespace Content.Server.Hands.Components
|
||||
|
||||
public bool CanPutInHand(ItemComponent item, string index, bool mobCheck = true)
|
||||
{
|
||||
if (mobCheck && !ActionBlockerSystem.CanPickup(Owner))
|
||||
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanPickup(Owner))
|
||||
return false;
|
||||
|
||||
var hand = GetHand(index);
|
||||
@@ -445,7 +446,7 @@ namespace Content.Server.Hands.Components
|
||||
{
|
||||
var hand = GetHand(name);
|
||||
|
||||
if (mobCheck && !ActionBlockerSystem.CanDrop(Owner))
|
||||
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanDrop(Owner))
|
||||
return false;
|
||||
|
||||
if (hand?.Entity == null)
|
||||
|
||||
@@ -9,7 +9,7 @@ using Content.Shared.DragDrop;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Instruments;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -334,7 +334,9 @@ namespace Content.Server.Instruments
|
||||
var maxMidiLaggedBatches = _instrumentSystem.MaxMidiLaggedBatches;
|
||||
var maxMidiBatchDropped = _instrumentSystem.MaxMidiBatchesDropped;
|
||||
|
||||
if (_instrumentPlayer != null && !ActionBlockerSystem.CanInteract(_instrumentPlayer.AttachedEntity))
|
||||
if (_instrumentPlayer != null
|
||||
&& (_instrumentPlayer.AttachedEntity == null
|
||||
|| !EntitySystem.Get<ActionBlockerSystem>().CanInteract(_instrumentPlayer.AttachedEntity)))
|
||||
{
|
||||
InstrumentPlayer = null;
|
||||
Clean();
|
||||
|
||||
@@ -14,9 +14,9 @@ using Content.Shared.Hands;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Rotatable;
|
||||
using Content.Shared.Throwing;
|
||||
@@ -175,10 +175,12 @@ namespace Content.Server.Interaction
|
||||
|
||||
private void InteractionActivate(IEntity user, IEntity used)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || ! ActionBlockerSystem.CanUse(user))
|
||||
var actionBlocker = Get<ActionBlockerSystem>();
|
||||
|
||||
if (!actionBlocker.CanInteract(user) || ! actionBlocker.CanUse(user))
|
||||
return;
|
||||
|
||||
// all activates should only fire when in range / unbostructed
|
||||
// all activates should only fire when in range / unobstructed
|
||||
if (!InRangeUnobstructed(user, used, ignoreInsideBlocker: true, popup: true))
|
||||
return;
|
||||
|
||||
@@ -273,7 +275,7 @@ namespace Content.Server.Interaction
|
||||
if (!ValidateInteractAndFace(user, coordinates))
|
||||
return;
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return;
|
||||
|
||||
// Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null
|
||||
@@ -342,7 +344,7 @@ namespace Content.Server.Interaction
|
||||
if (diff.LengthSquared <= 0.01f)
|
||||
return;
|
||||
var diffAngle = Angle.FromWorldVec(diff);
|
||||
if (ActionBlockerSystem.CanChangeDirection(user))
|
||||
if (Get<ActionBlockerSystem>().CanChangeDirection(user))
|
||||
{
|
||||
user.Transform.WorldRotation = diffAngle;
|
||||
}
|
||||
@@ -392,7 +394,7 @@ namespace Content.Server.Interaction
|
||||
/// </summary>
|
||||
public async Task InteractUsing(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return;
|
||||
|
||||
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
||||
@@ -422,7 +424,7 @@ namespace Content.Server.Interaction
|
||||
/// </summary>
|
||||
public void InteractHand(IEntity user, IEntity target)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return;
|
||||
|
||||
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
||||
@@ -455,7 +457,7 @@ namespace Content.Server.Interaction
|
||||
/// <param name="used"></param>
|
||||
public void TryUseInteraction(IEntity user, IEntity used)
|
||||
{
|
||||
if (user != null && used != null && ActionBlockerSystem.CanUse(user))
|
||||
if (user != null && used != null && Get<ActionBlockerSystem>().CanUse(user))
|
||||
{
|
||||
UseInteraction(user, used);
|
||||
}
|
||||
@@ -499,7 +501,7 @@ namespace Content.Server.Interaction
|
||||
/// </summary>
|
||||
public bool TryThrowInteraction(IEntity user, IEntity item)
|
||||
{
|
||||
if (user == null || item == null || !ActionBlockerSystem.CanThrow(user)) return false;
|
||||
if (user == null || item == null || !Get<ActionBlockerSystem>().CanThrow(user)) return false;
|
||||
|
||||
ThrownInteraction(user, item);
|
||||
return true;
|
||||
@@ -616,7 +618,7 @@ namespace Content.Server.Interaction
|
||||
/// </summary>
|
||||
public bool TryDroppedInteraction(IEntity user, IEntity item, bool intentional)
|
||||
{
|
||||
if (user == null || item == null || !ActionBlockerSystem.CanDrop(user)) return false;
|
||||
if (user == null || item == null || !Get<ActionBlockerSystem>().CanDrop(user)) return false;
|
||||
|
||||
DroppedInteraction(user, item, intentional);
|
||||
return true;
|
||||
@@ -724,7 +726,7 @@ namespace Content.Server.Interaction
|
||||
if (!ValidateInteractAndFace(user, coordinates))
|
||||
return;
|
||||
|
||||
if (!ActionBlockerSystem.CanAttack(user))
|
||||
if (!Get<ActionBlockerSystem>().CanAttack(user))
|
||||
return;
|
||||
|
||||
IEntity? targetEnt = null;
|
||||
|
||||
@@ -13,8 +13,8 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Acts;
|
||||
using Content.Shared.EffectBlocker;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.Console;
|
||||
@@ -291,7 +291,7 @@ namespace Content.Server.Inventory.Components
|
||||
var pass = false;
|
||||
reason = null;
|
||||
|
||||
if (mobCheck && !ActionBlockerSystem.CanEquip(Owner))
|
||||
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanEquip(Owner))
|
||||
{
|
||||
reason = Loc.GetString("You can't equip this!");
|
||||
return false;
|
||||
@@ -417,7 +417,7 @@ namespace Content.Server.Inventory.Components
|
||||
/// </returns>
|
||||
public bool CanUnequip(Slots slot, bool mobCheck = true)
|
||||
{
|
||||
if (mobCheck && !ActionBlockerSystem.CanUnequip(Owner))
|
||||
if (mobCheck && !EntitySystem.Get<ActionBlockerSystem>().CanUnequip(Owner))
|
||||
return false;
|
||||
|
||||
var inventorySlot = _slotContainers[slot];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
using Content.Server.Hands.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -52,7 +53,7 @@ namespace Content.Server.Items
|
||||
{
|
||||
protected override void GetData(IEntity user, ItemComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) ||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) ||
|
||||
component.Owner.IsInContainer() ||
|
||||
!component.CanPickup(user))
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Items;
|
||||
using Content.Server.Sound;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Light.Component;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -192,7 +193,7 @@ namespace Content.Server.Light.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ExpendableLightComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -9,8 +9,8 @@ using Content.Shared.Actions.Behaviors.Item;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Light.Component;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Rounding;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -75,7 +75,7 @@ namespace Content.Server.Light.Components
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User)) return false;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User)) return false;
|
||||
if (!_cellSlot.InsertCell(eventArgs.Using)) return false;
|
||||
Dirty();
|
||||
return true;
|
||||
@@ -104,7 +104,7 @@ namespace Content.Server.Light.Components
|
||||
/// <returns>True if the light's status was toggled, false otherwise.</returns>
|
||||
public bool ToggleStatus(IEntity user)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanUse(user)) return false;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanUse(user)) return false;
|
||||
return Activated ? TurnOff() : TurnOn(user);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace Content.Server.Light.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, HandheldLightComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Content.Server.Light.Components;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
private void HandleAfterInteract(EntityUid uid, LightReplacerComponent component, AfterInteractEvent eventArgs)
|
||||
{
|
||||
// standard interaction checks
|
||||
if (!ActionBlockerSystem.CanUse(eventArgs.User)) return;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanUse(eventArgs.User)) return;
|
||||
if (!eventArgs.CanReach) return;
|
||||
|
||||
// behaviour will depends on target type
|
||||
@@ -40,7 +41,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
private void HandleInteract(EntityUid uid, LightReplacerComponent component, InteractUsingEvent eventArgs)
|
||||
{
|
||||
// standard interaction checks
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User)) return;
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(eventArgs.User)) return;
|
||||
|
||||
if (eventArgs.Used != null)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.MachineLinking;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -72,7 +72,7 @@ namespace Content.Server.MachineLinking.Components
|
||||
|
||||
protected override void GetData(IEntity user, SignalSwitchComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -31,7 +32,7 @@ namespace Content.Server.Medical.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Content.Server.Medical.Components
|
||||
{
|
||||
case RelayMovementEntityMessage msg:
|
||||
{
|
||||
if (ActionBlockerSystem.CanInteract(msg.Entity))
|
||||
if (EntitySystem.Get<ActionBlockerSystem>().CanInteract(msg.Entity))
|
||||
{
|
||||
if (_gameTiming.CurTime <
|
||||
_lastInternalOpenAttempt + InternalOpenAttemptDelay)
|
||||
@@ -210,7 +210,7 @@ namespace Content.Server.Medical.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, MedicalScannerComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -231,7 +231,7 @@ namespace Content.Server.Medical.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, MedicalScannerComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -13,8 +13,8 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Metabolism.Events;
|
||||
using Content.Shared.MobState;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -271,9 +271,11 @@ namespace Content.Server.Metabolism
|
||||
}
|
||||
|
||||
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
if (temperatureComponent.CurrentTemperature > NormalBodyTemperature)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanSweat(Owner)) return;
|
||||
if (!actionBlocker.CanSweat(Owner)) return;
|
||||
if (!_isSweating)
|
||||
{
|
||||
Owner.PopupMessage(Loc.GetString("You are sweating"));
|
||||
@@ -288,7 +290,7 @@ namespace Content.Server.Metabolism
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ActionBlockerSystem.CanShiver(Owner)) return;
|
||||
if (!actionBlocker.CanShiver(Owner)) return;
|
||||
if (!_isShivering)
|
||||
{
|
||||
Owner.PopupMessage(Loc.GetString("You are shivering"));
|
||||
|
||||
@@ -9,8 +9,8 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -107,7 +107,7 @@ namespace Content.Server.Morgue.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, BodyBagEntityStorageComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || component.LabelContainer?.ContainedEntity == null)
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || component.LabelContainer?.ContainedEntity == null)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -9,8 +9,8 @@ using Content.Server.Storage.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Morgue;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Standing;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -152,7 +152,7 @@ namespace Content.Server.Morgue.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, CrematoriumEntityStorageComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || component.Cooking || component.Open)
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || component.Cooking || component.Open)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -11,7 +11,7 @@ using Content.Server.PDA.Managers;
|
||||
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.PDA;
|
||||
using Content.Shared.Tag;
|
||||
@@ -370,7 +370,7 @@ namespace Content.Server.PDA
|
||||
{
|
||||
protected override void GetData(IEntity user, PDAComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -392,7 +392,7 @@ namespace Content.Server.PDA
|
||||
{
|
||||
protected override void GetData(IEntity user, PDAComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -414,7 +414,7 @@ namespace Content.Server.PDA
|
||||
{
|
||||
protected override void GetData(IEntity user, PDAComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -11,6 +11,7 @@ using Content.Server.VendingMachines;
|
||||
using Content.Server.Wires.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Singularity.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -150,7 +151,7 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
|
||||
|
||||
if (obj.Session.AttachedEntity == null ||
|
||||
!ActionBlockerSystem.CanInteract(obj.Session.AttachedEntity))
|
||||
!EntitySystem.Get<ActionBlockerSystem>().CanInteract(obj.Session.AttachedEntity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Actions;
|
||||
using Content.Server.Inventory.Components;
|
||||
using Content.Server.Items;
|
||||
using Content.Server.Movement.Components;
|
||||
@@ -8,8 +7,8 @@ using Content.Server.Shuttle;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Maps;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Physics.Controllers;
|
||||
using Content.Shared.Tag;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Audio;
|
||||
|
||||
@@ -7,8 +7,8 @@ using Content.Server.Pointing.Components;
|
||||
using Content.Server.Visible;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Input;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Interaction.Helpers;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -112,7 +112,7 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ActionBlockerSystem.CanChangeDirection(player))
|
||||
if (EntitySystem.Get<ActionBlockerSystem>().CanChangeDirection(player))
|
||||
{
|
||||
var diff = coords.ToMapPos(EntityManager) - player.Transform.MapPosition.Position;
|
||||
if (diff.LengthSquared > 0.01f)
|
||||
@@ -137,7 +137,7 @@ namespace Content.Server.Pointing.EntitySystems
|
||||
|
||||
if (ent is null || (!ent.TryGetComponent<EyeComponent>(out var eyeComp) || (eyeComp.VisibilityMask & layer) != 0))
|
||||
return false;
|
||||
|
||||
|
||||
return ent.Transform.MapPosition.InRange(player.Transform.MapPosition, PointingRange);
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Content.Server.Items;
|
||||
using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
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.Power;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -121,7 +121,7 @@ namespace Content.Server.Power.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, BaseCharger component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -166,7 +166,7 @@ namespace Content.Server.Power.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, BaseCharger component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.Items;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -180,7 +181,7 @@ namespace Content.Server.PowerCell.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, PowerCellSlotComponent component, VerbData data)
|
||||
{
|
||||
if (!component.ShowVerb || !ActionBlockerSystem.CanInteract(user))
|
||||
if (!component.ShowVerb || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#nullable enable
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.Rotation.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, FlippableComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#nullable enable
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Rotatable;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -34,7 +34,7 @@ namespace Content.Server.Rotation.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, RotatableComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || (!component.RotateWhileAnchored && component.Owner.TryGetComponent(out IPhysBody? physics) && physics.BodyType == BodyType.Static))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || (!component.RotateWhileAnchored && component.Owner.TryGetComponent(out IPhysBody? physics) && physics.BodyType == BodyType.Static))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -56,7 +56,7 @@ namespace Content.Server.Rotation.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, RotatableComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || (!component.RotateWhileAnchored && component.Owner.TryGetComponent(out IPhysBody? physics) && physics.BodyType == BodyType.Static))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || (!component.RotateWhileAnchored && component.Owner.TryGetComponent(out IPhysBody? physics) && physics.BodyType == BodyType.Static))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -447,7 +447,7 @@ namespace Content.Server.Storage.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, EntityStorageComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -465,7 +465,7 @@ namespace Content.Server.Storage.Components
|
||||
|
||||
protected virtual void OpenVerbGetData(IEntity user, EntityStorageComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Content.Server.Access.Components;
|
||||
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.Storage;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -130,7 +130,7 @@ namespace Content.Server.Storage.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, SecureEntityStorageComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || component.Open)
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || component.Open)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -9,7 +9,7 @@ using Content.Server.Items;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Strip.Components;
|
||||
using Content.Shared.Verbs;
|
||||
@@ -29,7 +29,7 @@ namespace Content.Server.Strip
|
||||
public const float StripDelay = 2f;
|
||||
|
||||
[ViewVariables]
|
||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(StrippingUiKey.Key);
|
||||
private BoundUserInterface? UserInterface => Owner.GetUIOrNull(StrippingUiKey.Key);
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -152,7 +152,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return false;
|
||||
|
||||
if (item == null)
|
||||
@@ -217,7 +217,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return false;
|
||||
|
||||
if (item == null)
|
||||
@@ -280,7 +280,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return false;
|
||||
|
||||
if (!inventory.HasSlot(slot))
|
||||
@@ -336,7 +336,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return false;
|
||||
|
||||
if (!hands.HasHand(hand))
|
||||
|
||||
@@ -7,7 +7,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -68,7 +68,9 @@ namespace Content.Server.Stunnable
|
||||
|
||||
private void OnUseInHand(EntityUid uid, StunbatonComponent comp, UseInHandEvent args)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanUse(args.User)) return;
|
||||
if (!Get<ActionBlockerSystem>().CanUse(args.User))
|
||||
return;
|
||||
|
||||
if (comp.Activated)
|
||||
{
|
||||
TurnOff(comp);
|
||||
@@ -97,7 +99,9 @@ namespace Content.Server.Stunnable
|
||||
|
||||
private void OnInteractUsing(EntityUid uid, StunbatonComponent comp, InteractUsingEvent args)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(args.User)) return;
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(args.User))
|
||||
return;
|
||||
|
||||
if (ComponentManager.TryGetComponent<PowerCellSlotComponent>(uid, out var cellslot))
|
||||
cellslot.InsertCell(args.Used);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Tool;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -67,7 +68,7 @@ namespace Content.Server.Tools.Components
|
||||
|
||||
public virtual async Task<bool> UseTool(IEntity user, IEntity? target, float doAfterDelay, ToolQuality toolQualityNeeded, Func<bool>? doAfterCheck = null)
|
||||
{
|
||||
if (!HasQuality(toolQualityNeeded) || !ActionBlockerSystem.CanInteract(user))
|
||||
if (!HasQuality(toolQualityNeeded) || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
return false;
|
||||
|
||||
if (doAfterDelay > 0f)
|
||||
|
||||
@@ -7,7 +7,7 @@ using Content.Server.Weapon.Ranged.Barrels.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
@@ -222,7 +222,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, AmmoBoxComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -4,8 +4,8 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.NetIDs;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
@@ -354,7 +354,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, BoltActionBarrelComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -375,7 +375,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, BoltActionBarrelComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Threading.Tasks;
|
||||
using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.NetIDs;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
@@ -283,7 +283,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, RevolverBarrelComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -8,6 +8,7 @@ using Content.Server.Projectiles.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.NetIDs;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged.Barrels.Components;
|
||||
@@ -295,7 +296,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ServerBatteryBarrelComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user) || !component._powerCellRemovable)
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !component._powerCellRemovable)
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -7,8 +7,8 @@ using Content.Server.Weapon.Ranged.Ammunition.Components;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.NetIDs;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Weapons.Ranged;
|
||||
@@ -453,7 +453,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ServerMagazineBarrelComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -483,7 +483,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ServerMagazineBarrelComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
@@ -504,7 +504,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
|
||||
{
|
||||
protected override void GetData(IEntity user, ServerMagazineBarrelComponent component, VerbData data)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
{
|
||||
data.Visibility = VerbVisibility.Invisible;
|
||||
return;
|
||||
|
||||
@@ -9,7 +9,7 @@ using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Components;
|
||||
using Content.Shared.Hands;
|
||||
using Content.Shared.Notification;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Notification.Managers;
|
||||
using Content.Shared.Weapons.Ranged.Components;
|
||||
using Robust.Shared.Audio;
|
||||
@@ -78,7 +78,7 @@ namespace Content.Server.Weapon.Ranged
|
||||
|
||||
private bool UserCanFire(IEntity user)
|
||||
{
|
||||
return (UserCanFireHandler == null || UserCanFireHandler(user)) && ActionBlockerSystem.CanAttack(user);
|
||||
return (UserCanFireHandler == null || UserCanFireHandler(user)) && EntitySystem.Get<ActionBlockerSystem>().CanInteract(user);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.ActionBlocker
|
||||
{
|
||||
public static class ActionBlockerExtensions
|
||||
{
|
||||
public static bool CanMove(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanMove(entity);
|
||||
}
|
||||
|
||||
public static bool CanInteract(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanInteract(entity);
|
||||
}
|
||||
|
||||
public static bool CanUse(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanUse(entity);
|
||||
}
|
||||
|
||||
public static bool CanThrow(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanThrow(entity);
|
||||
}
|
||||
|
||||
public static bool CanSpeak(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanSpeak(entity);
|
||||
}
|
||||
|
||||
public static bool CanDrop(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanDrop(entity);
|
||||
}
|
||||
|
||||
public static bool CanPickup(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanPickup(entity);
|
||||
}
|
||||
|
||||
public static bool CanEmote(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanEmote(entity);
|
||||
}
|
||||
|
||||
public static bool CanAttack(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanAttack(entity);
|
||||
}
|
||||
|
||||
public static bool CanEquip(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanEquip(entity);
|
||||
}
|
||||
|
||||
public static bool CanUnequip(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanUnequip(entity);
|
||||
}
|
||||
|
||||
public static bool CanChangeDirection(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanChangeDirection(entity);
|
||||
}
|
||||
|
||||
public static bool CanShiver(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanShiver(entity);
|
||||
}
|
||||
|
||||
public static bool CanSweat(this IEntity entity)
|
||||
{
|
||||
return ActionBlockerSystem.CanSweat(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,14 @@
|
||||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.EffectBlocker;
|
||||
using Content.Shared.Emoting;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Metabolism.Events;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Speech;
|
||||
using Content.Shared.Throwing;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -15,184 +21,254 @@ namespace Content.Shared.ActionBlocker
|
||||
[UsedImplicitly]
|
||||
public class ActionBlockerSystem : EntitySystem
|
||||
{
|
||||
public static bool CanMove(IEntity entity)
|
||||
public bool CanMove(IEntity entity)
|
||||
{
|
||||
var canMove = true;
|
||||
var ev = new MovementAttemptEvent(entity);
|
||||
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canMove &= blocker.CanMove(); // Sets var to false if false
|
||||
if (!blocker.CanMove())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canMove;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanInteract([NotNullWhen(true)] IEntity? entity)
|
||||
public bool CanInteract(IEntity entity)
|
||||
{
|
||||
if (entity == null)
|
||||
var ev = new InteractionAttemptEvent(entity);
|
||||
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
return false;
|
||||
if (!blocker.CanInteract())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var canInteract = true;
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canInteract &= blocker.CanInteract();
|
||||
}
|
||||
|
||||
return canInteract;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanUse([NotNullWhen(true)] IEntity? entity)
|
||||
public bool CanUse(IEntity entity)
|
||||
{
|
||||
if (entity == null)
|
||||
var ev = new UseAttemptEvent(entity);
|
||||
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
return false;
|
||||
if (!blocker.CanUse())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var canUse = true;
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canUse &= blocker.CanUse();
|
||||
}
|
||||
|
||||
return canUse;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanThrow(IEntity entity)
|
||||
public bool CanThrow(IEntity entity)
|
||||
{
|
||||
var canThrow = true;
|
||||
var ev = new ThrowAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canThrow &= blocker.CanThrow();
|
||||
if (!blocker.CanThrow())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canThrow;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanSpeak(IEntity entity)
|
||||
public bool CanSpeak(IEntity entity)
|
||||
{
|
||||
if (!entity.HasComponent<SharedSpeechComponent>())
|
||||
return false;
|
||||
var ev = new SpeakAttemptEvent(entity);
|
||||
|
||||
var canSpeak = true;
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canSpeak &= blocker.CanSpeak();
|
||||
if (!blocker.CanSpeak())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canSpeak;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanDrop(IEntity entity)
|
||||
public bool CanDrop(IEntity entity)
|
||||
{
|
||||
var canDrop = true;
|
||||
var ev = new DropAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canDrop &= blocker.CanDrop();
|
||||
if (!blocker.CanDrop())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canDrop;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanPickup(IEntity entity)
|
||||
public bool CanPickup(IEntity entity)
|
||||
{
|
||||
var canPickup = true;
|
||||
var ev = new PickupAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canPickup &= blocker.CanPickup();
|
||||
if (!blocker.CanPickup())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canPickup;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanEmote(IEntity entity)
|
||||
public bool CanEmote(IEntity entity)
|
||||
{
|
||||
if (!entity.HasComponent<SharedEmotingComponent>())
|
||||
return false;
|
||||
var ev = new EmoteAttemptEvent(entity);
|
||||
|
||||
var canEmote = true;
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canEmote &= blocker.CanEmote();
|
||||
if (!blocker.CanEmote())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canEmote;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanAttack(IEntity entity)
|
||||
public bool CanAttack(IEntity entity)
|
||||
{
|
||||
var canAttack = true;
|
||||
var ev = new AttackAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canAttack &= blocker.CanAttack();
|
||||
if (!blocker.CanAttack())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canAttack;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanEquip(IEntity entity)
|
||||
public bool CanEquip(IEntity entity)
|
||||
{
|
||||
var canEquip = true;
|
||||
var ev = new EquipAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canEquip &= blocker.CanEquip();
|
||||
if (!blocker.CanEquip())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canEquip;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanUnequip(IEntity entity)
|
||||
public bool CanUnequip(IEntity entity)
|
||||
{
|
||||
var canUnequip = true;
|
||||
var ev = new UnequipAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canUnequip &= blocker.CanUnequip();
|
||||
if (!blocker.CanUnequip())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canUnequip;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanChangeDirection(IEntity entity)
|
||||
public bool CanChangeDirection(IEntity entity)
|
||||
{
|
||||
var canChangeDirection = true;
|
||||
var ev = new ChangeDirectionAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in entity.GetAllComponents<IActionBlocker>())
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canChangeDirection &= blocker.CanChangeDirection();
|
||||
if (!blocker.CanChangeDirection())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return canChangeDirection;
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanShiver(IEntity entity)
|
||||
public bool CanShiver(IEntity entity)
|
||||
{
|
||||
var canShiver = true;
|
||||
foreach (var component in entity.GetAllComponents<IActionBlocker>())
|
||||
var ev = new ShiverAttemptEvent(entity);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canShiver &= component.CanShiver();
|
||||
if (!blocker.CanShiver())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return canShiver;
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public static bool CanSweat(IEntity entity)
|
||||
public bool CanSweat(IEntity entity)
|
||||
{
|
||||
var canSweat = true;
|
||||
foreach (var component in entity.GetAllComponents<IActionBlocker>())
|
||||
var ev = new SweatAttemptEvent(entity);
|
||||
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
foreach (var blocker in ev.Entity.GetAllComponents<IActionBlocker>())
|
||||
{
|
||||
canSweat &= component.CanSweat();
|
||||
if (!blocker.CanSweat())
|
||||
{
|
||||
ev.Cancel();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return canSweat;
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Shared.EffectBlocker;
|
||||
|
||||
namespace Content.Shared.ActionBlocker
|
||||
@@ -7,34 +8,49 @@ namespace Content.Shared.ActionBlocker
|
||||
/// This interface gives components the ability to block certain actions from
|
||||
/// being done by the owning entity. For effects see <see cref="IEffectBlocker"/>
|
||||
/// </summary>
|
||||
[Obsolete("Use events instead")]
|
||||
public interface IActionBlocker
|
||||
{
|
||||
[Obsolete("Use MoveAttemptEvent instead")]
|
||||
bool CanMove() => true;
|
||||
|
||||
[Obsolete("Use InteractAttemptEvent instead")]
|
||||
bool CanInteract() => true;
|
||||
|
||||
[Obsolete("Use UseAttemptEvent instead")]
|
||||
bool CanUse() => true;
|
||||
|
||||
[Obsolete("Use ThrowAttemptEvent instead")]
|
||||
bool CanThrow() => true;
|
||||
|
||||
[Obsolete("Use SpeakAttemptEvent instead")]
|
||||
bool CanSpeak() => true;
|
||||
|
||||
[Obsolete("Use DropAttemptEvent instead")]
|
||||
bool CanDrop() => true;
|
||||
|
||||
[Obsolete("Use PickupAttemptEvent instead")]
|
||||
bool CanPickup() => true;
|
||||
|
||||
[Obsolete("Use EmoteAttemptEvent instead")]
|
||||
bool CanEmote() => true;
|
||||
|
||||
[Obsolete("Use AttackAttemptEvent instead")]
|
||||
bool CanAttack() => true;
|
||||
|
||||
[Obsolete("Use EquipAttemptEvent instead")]
|
||||
bool CanEquip() => true;
|
||||
|
||||
[Obsolete("Use UnequipAttemptEvent instead")]
|
||||
bool CanUnequip() => true;
|
||||
|
||||
[Obsolete("Use ChangeDirectionAttemptEvent instead")]
|
||||
bool CanChangeDirection() => true;
|
||||
|
||||
[Obsolete("Use ShiverAttemptEvent instead")]
|
||||
bool CanShiver() => true;
|
||||
|
||||
[Obsolete("Use SweatAttemptEvent instead")]
|
||||
bool CanSweat() => true;
|
||||
}
|
||||
}
|
||||
|
||||
14
Content.Shared/DragDrop/DropAttemptEvent.cs
Normal file
14
Content.Shared/DragDrop/DropAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.DragDrop
|
||||
{
|
||||
public class DropAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public DropAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
14
Content.Shared/Emoting/EmoteAttemptEvent.cs
Normal file
14
Content.Shared/Emoting/EmoteAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Emoting
|
||||
{
|
||||
public class EmoteAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public EmoteAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
22
Content.Shared/Emoting/EmoteSystem.cs
Normal file
22
Content.Shared/Emoting/EmoteSystem.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Emoting
|
||||
{
|
||||
public class EmoteSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<EmoteAttemptEvent>(OnEmoteAttempt);
|
||||
}
|
||||
|
||||
private void OnEmoteAttempt(EmoteAttemptEvent ev)
|
||||
{
|
||||
if (!ev.Entity.HasComponent<SharedEmotingComponent>())
|
||||
{
|
||||
ev.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
using System;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Broadphase;
|
||||
using Robust.Shared.Physics.Controllers;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Content.Shared.Physics.Controllers
|
||||
namespace Content.Shared.Friction
|
||||
{
|
||||
public sealed class SharedTileFrictionController : VirtualController
|
||||
{
|
||||
@@ -8,7 +8,7 @@ using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Movement.Components
|
||||
namespace Content.Shared.Friction
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class SharedTileFrictionModifier : Component
|
||||
14
Content.Shared/Interaction/Events/AttackAttemptEvent.cs
Normal file
14
Content.Shared/Interaction/Events/AttackAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Interaction.Events
|
||||
{
|
||||
public class AttackAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public AttackAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Interaction.Events
|
||||
{
|
||||
public class ChangeDirectionAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public ChangeDirectionAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
14
Content.Shared/Interaction/Events/InteractionAttemptEvent.cs
Normal file
14
Content.Shared/Interaction/Events/InteractionAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Interaction.Events
|
||||
{
|
||||
public class InteractionAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public InteractionAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
14
Content.Shared/Interaction/Events/UseAttemptEvent.cs
Normal file
14
Content.Shared/Interaction/Events/UseAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Interaction.Events
|
||||
{
|
||||
public class UseAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public UseAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
14
Content.Shared/Inventory/Events/EquipAttemptEvent.cs
Normal file
14
Content.Shared/Inventory/Events/EquipAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Inventory.Events
|
||||
{
|
||||
public class EquipAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public EquipAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
14
Content.Shared/Inventory/Events/UnequipAttemptEvent.cs
Normal file
14
Content.Shared/Inventory/Events/UnequipAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Inventory.Events
|
||||
{
|
||||
public class UnequipAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public UnequipAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
14
Content.Shared/Item/PickupAttemptEvent.cs
Normal file
14
Content.Shared/Item/PickupAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Item
|
||||
{
|
||||
public class PickupAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public PickupAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace Content.Shared.Item
|
||||
/// </summary>
|
||||
public bool CanPickup(IEntity user)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanPickup(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(user))
|
||||
return false;
|
||||
|
||||
if (user.Transform.MapID != Owner.Transform.MapID)
|
||||
|
||||
14
Content.Shared/Metabolism/Events/ShiverAttemptEvent.cs
Normal file
14
Content.Shared/Metabolism/Events/ShiverAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Metabolism.Events
|
||||
{
|
||||
public class ShiverAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public ShiverAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
14
Content.Shared/Metabolism/Events/SweatAttemptEvent.cs
Normal file
14
Content.Shared/Metabolism/Events/SweatAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Metabolism.Events
|
||||
{
|
||||
public class SweatAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public SweatAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Collision;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
namespace Content.Shared.Movement
|
||||
namespace Content.Shared.Movement.EntitySystems
|
||||
{
|
||||
public sealed class SharedMobMoverSystem : EntitySystem
|
||||
{
|
||||
@@ -9,7 +9,7 @@ using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Shared.Movement
|
||||
namespace Content.Shared.Movement.EntitySystems
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles converting inputs into movement.
|
||||
14
Content.Shared/Movement/MovementAttemptEvent.cs
Normal file
14
Content.Shared/Movement/MovementAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Movement
|
||||
{
|
||||
public class MovementAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public MovementAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Broadphase;
|
||||
using Robust.Shared.Physics.Controllers;
|
||||
|
||||
namespace Content.Shared.Physics.Controllers
|
||||
namespace Content.Shared.Movement
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles player and NPC mob movement.
|
||||
@@ -105,7 +105,7 @@ namespace Content.Shared.Physics.Controllers
|
||||
{
|
||||
return (body.BodyStatus == BodyStatus.OnGround) &
|
||||
body.Owner.HasComponent<IMobStateComponent>() &&
|
||||
ActionBlockerSystem.CanMove(body.Owner) &&
|
||||
EntitySystem.Get<ActionBlockerSystem>().CanMove(body.Owner) &&
|
||||
(!body.Owner.IsWeightless(body, mapManager: mapManager) ||
|
||||
body.Owner.TryGetComponent(out SharedPlayerMobMoverComponent? mover) &&
|
||||
IsAroundCollider(broadPhaseSystem, body.Owner.Transform, mover, body));
|
||||
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.NetIDs;
|
||||
using Content.Shared.Physics.Pull;
|
||||
@@ -365,7 +366,7 @@ namespace Content.Shared.Pulling.Components
|
||||
void IRelayMoveInput.MoveInputPressed(ICommonSession session)
|
||||
{
|
||||
var entity = session.AttachedEntity;
|
||||
if (entity == null || !ActionBlockerSystem.CanMove(entity)) return;
|
||||
if (entity == null || !EntitySystem.Get<ActionBlockerSystem>().CanMove(entity)) return;
|
||||
TryStopPull();
|
||||
}
|
||||
}
|
||||
|
||||
14
Content.Shared/Speech/SpeakAttemptEvent.cs
Normal file
14
Content.Shared/Speech/SpeakAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Speech
|
||||
{
|
||||
public class SpeakAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public SpeakAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
22
Content.Shared/Speech/SpeechSystem.cs
Normal file
22
Content.Shared/Speech/SpeechSystem.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Speech
|
||||
{
|
||||
public class SpeechSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<SpeakAttemptEvent>(OnSpeakAttempt);
|
||||
}
|
||||
|
||||
private void OnSpeakAttempt(SpeakAttemptEvent ev)
|
||||
{
|
||||
if (!ev.Entity.HasComponent<SharedSpeechComponent>())
|
||||
{
|
||||
ev.Cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.NetIDs;
|
||||
using Content.Shared.Placeable;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -34,7 +35,7 @@ namespace Content.Shared.Storage
|
||||
|
||||
bool IDraggable.Drop(DragDropEvent eventArgs)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using static Content.Shared.Inventory.EquipmentSlotDefines;
|
||||
@@ -18,7 +19,7 @@ namespace Content.Shared.Strip.Components
|
||||
{
|
||||
return by != Owner
|
||||
&& by.HasComponent<ISharedHandsComponent>()
|
||||
&& ActionBlockerSystem.CanInteract(by);
|
||||
&& EntitySystem.Get<ActionBlockerSystem>().CanInteract(by);
|
||||
}
|
||||
|
||||
bool IDraggable.CanDrop(CanDropEvent args)
|
||||
|
||||
14
Content.Shared/Throwing/ThrowAttemptEvent.cs
Normal file
14
Content.Shared/Throwing/ThrowAttemptEvent.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Shared.Throwing
|
||||
{
|
||||
public class ThrowAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public ThrowAttemptEvent(IEntity entity)
|
||||
{
|
||||
Entity = entity;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,7 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lacunarity/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lerp/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=lerping/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Magboots/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=metabolizable/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mommi/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Monstermos/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
Reference in New Issue
Block a user