ActionBlocker CanInteract uses EntityUid exclusively
ActionBlockerSystem fully uses EntityUid now!
This commit is contained in:
@@ -415,7 +415,7 @@ namespace Content.Client.DragDrop
|
||||
/// <returns>null if the target doesn't support IDragDropOn</returns>
|
||||
private bool? ValidDragDrop(DragDropEvent eventArgs)
|
||||
{
|
||||
if (!_actionBlockerSystem.CanInteract(eventArgs.User))
|
||||
if (!_actionBlockerSystem.CanInteract(eventArgs.User.Uid))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Content.Server.AME.Components
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
//Check if player can interact in their current state
|
||||
if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity.Uid))
|
||||
if (!actionBlocker.CanInteract(playerEntity.Uid) || !actionBlocker.CanUse(playerEntity.Uid))
|
||||
return false;
|
||||
//Check if device is powered
|
||||
if (needsPower && !Powered)
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Content.Server.Actions.Spells
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(caster)) return;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(caster.Uid)) return;
|
||||
|
||||
// TODO: Nix when we get EntityPrototype serializers
|
||||
if (!IoCManager.Resolve<IPrototypeManager>().HasIndex<EntityPrototype>(ItemProto))
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Server.Alert.Click
|
||||
{
|
||||
public void AlertClicked(ClickAlertEventArgs args)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(args.Player))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(args.Player.Uid))
|
||||
return;
|
||||
|
||||
if (args.Player.TryGetComponent<SharedPullableComponent>(out var playerPullable))
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Content.Server.Arcade.Components
|
||||
if(!Powered || !eventArgs.User.TryGetComponent(out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
if(!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if(!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
return;
|
||||
|
||||
UserInterface?.Toggle(actor.PlayerSession);
|
||||
@@ -131,7 +131,7 @@ namespace Content.Server.Arcade.Components
|
||||
if (obj.Session != _player) break;
|
||||
|
||||
// TODO: Should this check if the Owner can interact...?
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(Owner))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(OwnerUid))
|
||||
{
|
||||
DeactivePlayer(obj.Session);
|
||||
break;
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.Server.Arcade.Components
|
||||
if (!Powered || !eventArgs.User.TryGetComponent(out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
return;
|
||||
|
||||
_game ??= new SpaceVillainGame(this);
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Content.Server.GameObjects.Components
|
||||
return; // Not powered, so this computer should probably do nothing.
|
||||
}
|
||||
// Can we interact?
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(sessionEntity))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(sessionEntity.Uid))
|
||||
{
|
||||
sessionEntity.PopupMessageCursor(Loc.GetString("base-computer-ui-component-cannot-interact"));
|
||||
return;
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
if (!Resolve(uid, ref flammable, ref alerts))
|
||||
return;
|
||||
|
||||
if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner) || flammable.Resisting)
|
||||
if (!flammable.OnFire || !_actionBlockerSystem.CanInteract(flammable.Owner.Uid) || flammable.Resisting)
|
||||
return;
|
||||
|
||||
flammable.Resisting = true;
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
private void OnActivate(EntityUid uid, GasValveComponent component, ActivateInWorldEvent args)
|
||||
{
|
||||
if (args.User.InRangeUnobstructed(args.Target) && Get<ActionBlockerSystem>().CanInteract(args.User))
|
||||
if (args.User.InRangeUnobstructed(args.Target) && Get<ActionBlockerSystem>().CanInteract(args.User.Uid))
|
||||
{
|
||||
Toggle(uid, component);
|
||||
SoundSystem.Play(Filter.Pvs(component.Owner), component._valveSound.GetSound(), component.Owner, AudioHelpers.WithVariation(0.25f));
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Content.Server.Body.Surgery.Components
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_actionBlockerSystem.CanInteract(tool.PerformerCache) ||
|
||||
if (!_actionBlockerSystem.CanInteract(tool.PerformerCache.Uid) ||
|
||||
!tool.PerformerCache.InRangeUnobstructed(tool.BodyCache))
|
||||
{
|
||||
tool.CloseAllSurgeryUIs();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Server.Botany.Components
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
return false;
|
||||
|
||||
if (eventArgs.Using.HasTag("BotanySharp"))
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace Content.Server.Botany.Components
|
||||
|
||||
public bool DoHarvest(IEntity user)
|
||||
{
|
||||
if (Seed == null || user.Deleted || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (Seed == null || user.Deleted || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
return false;
|
||||
|
||||
if (Harvest && !Dead)
|
||||
@@ -651,7 +651,7 @@ namespace Content.Server.Botany.Components
|
||||
var user = eventArgs.User;
|
||||
var usingItem = eventArgs.Using;
|
||||
|
||||
if (usingItem.Deleted || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (usingItem.Deleted || !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
return false;
|
||||
|
||||
if (usingItem.TryGetComponent(out SeedComponent? seeds))
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Content.Server.Buckle.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("buckle-component-cannot-do-that-message"));
|
||||
return false;
|
||||
@@ -303,7 +303,7 @@ namespace Content.Server.Buckle.Components
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
{
|
||||
user.PopupMessage(Loc.GetString("buckle-component-cannot-do-that-message"));
|
||||
return false;
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Content.Server.Chemistry.Components
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
//Check if player can interact in their current state
|
||||
if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity.Uid))
|
||||
if (!actionBlocker.CanInteract(playerEntity.Uid) || !actionBlocker.CanUse(playerEntity.Uid))
|
||||
return false;
|
||||
//Check if device is powered
|
||||
if (needsPower && !Powered)
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace Content.Server.Chemistry.Components
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
//Check if player can interact in their current state
|
||||
if (!actionBlocker.CanInteract(playerEntity) || !actionBlocker.CanUse(playerEntity.Uid))
|
||||
if (!actionBlocker.CanInteract(playerEntity.Uid) || !actionBlocker.CanUse(playerEntity.Uid))
|
||||
return false;
|
||||
//Check if device is powered
|
||||
if (needsPower && !Powered)
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Content.Server.Climbing.Components
|
||||
/// <returns></returns>
|
||||
private bool CanVault(IEntity user, IEntity target, out string reason)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
{
|
||||
reason = Loc.GetString("comp-climbable-cant-interact");
|
||||
return false;
|
||||
@@ -107,7 +107,7 @@ namespace Content.Server.Climbing.Components
|
||||
/// <returns></returns>
|
||||
private bool CanVault(IEntity user, IEntity dragged, IEntity target, out string reason)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
{
|
||||
reason = Loc.GetString("comp-climbable-cant-interact");
|
||||
return false;
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Content.Server.Construction
|
||||
|
||||
var user = args.SenderSession.AttachedEntity;
|
||||
|
||||
if (user == null || !Get<ActionBlockerSystem>().CanInteract(user)) return;
|
||||
if (user == null || !Get<ActionBlockerSystem>().CanInteract(user.Uid)) return;
|
||||
|
||||
if (!user.TryGetComponent(out HandsComponent? hands)) return;
|
||||
|
||||
@@ -398,7 +398,7 @@ namespace Content.Server.Construction
|
||||
}
|
||||
|
||||
if (user == null
|
||||
|| !Get<ActionBlockerSystem>().CanInteract(user)
|
||||
|| !Get<ActionBlockerSystem>().CanInteract(user.Uid)
|
||||
|| !user.TryGetComponent(out HandsComponent? hands) || hands.GetActiveHand == null
|
||||
|| !user.InRangeUnobstructed(ev.Location, ignoreInsideBlocker:constructionPrototype.CanBuildInImpassable))
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Content.Server.Cuffs
|
||||
else
|
||||
{
|
||||
// Check if the user can interact.
|
||||
if (!_actionBlockerSystem.CanInteract(userEntity))
|
||||
if (!_actionBlockerSystem.CanInteract(userEntity.Uid))
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||
//Check if player can interact in their current state
|
||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntity) || !actionBlocker.CanUse(session.AttachedEntityUid!.Value)))
|
||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntityUid!.Value) || !actionBlocker.CanUse(session.AttachedEntityUid!.Value)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Content.Server.Disposal.Tube.Components
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
var groupController = IoCManager.Resolve<IConGroupController>();
|
||||
//Check if player can interact in their current state
|
||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntity) || !actionBlocker.CanUse(session.AttachedEntityUid!.Value)))
|
||||
if (!groupController.CanAdminMenu(session) && (!actionBlocker.CanInteract(session.AttachedEntityUid!.Value) || !actionBlocker.CanUse(session.AttachedEntityUid!.Value)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Content.Server.Disposal.Unit.Components
|
||||
|
||||
var actionBlocker = EntitySystem.Get<ActionBlockerSystem>();
|
||||
|
||||
if (!actionBlocker.CanInteract(player) ||
|
||||
if (!actionBlocker.CanInteract(player.Uid) ||
|
||||
!actionBlocker.CanUse(player.Uid))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -379,7 +379,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
|
||||
private bool IsValidInteraction(ITargetedInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
{
|
||||
eventArgs.Target.PopupMessage(eventArgs.User, Loc.GetString("ui-disposal-unit-is-valid-interaction-cannot=interact"));
|
||||
return false;
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Content.Server.Extinguisher
|
||||
|
||||
private void SetSafety(IEntity user, bool state)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user) || !_hasSafety)
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid) || !_hasSafety)
|
||||
return;
|
||||
|
||||
_safety = state;
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Content.Server.Fluids.Components
|
||||
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
return false;
|
||||
|
||||
if (CurrentVolume <= 0)
|
||||
|
||||
@@ -80,9 +80,9 @@ namespace Content.Server.HandLabeler
|
||||
|
||||
private bool CheckInteract(ICommonSession session)
|
||||
{
|
||||
if (session.AttachedEntity is not { } entity
|
||||
|| !Get<ActionBlockerSystem>().CanInteract(entity)
|
||||
|| !Get<ActionBlockerSystem>().CanUse(entity.Uid))
|
||||
if (session.AttachedEntityUid is not { } uid
|
||||
|| !Get<ActionBlockerSystem>().CanInteract(uid)
|
||||
|| !Get<ActionBlockerSystem>().CanUse(uid))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace Content.Server.Instruments
|
||||
|
||||
if ((!Handheld && InstrumentPlayer != null)
|
||||
|| (Handheld && actor.PlayerSession != InstrumentPlayer)
|
||||
|| !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user)) return;
|
||||
|| !EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid)) return;
|
||||
|
||||
InstrumentPlayer = actor.PlayerSession;
|
||||
OpenUserInterface(InstrumentPlayer);
|
||||
@@ -351,8 +351,8 @@ namespace Content.Server.Instruments
|
||||
var maxMidiBatchDropped = _instrumentSystem.MaxMidiBatchesDropped;
|
||||
|
||||
if (_instrumentPlayer != null
|
||||
&& (_instrumentPlayer.AttachedEntity == null
|
||||
|| !EntitySystem.Get<ActionBlockerSystem>().CanInteract(_instrumentPlayer.AttachedEntity)))
|
||||
&& (_instrumentPlayer.AttachedEntityUid == null
|
||||
|| !EntitySystem.Get<ActionBlockerSystem>().CanInteract(_instrumentPlayer.AttachedEntityUid.Value)))
|
||||
{
|
||||
InstrumentPlayer = null;
|
||||
Clean();
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Content.Server.Interaction
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_actionBlockerSystem.CanInteract(userEntity))
|
||||
if (!_actionBlockerSystem.CanInteract(userEntity.Uid))
|
||||
return;
|
||||
|
||||
if (!EntityManager.TryGetEntity(msg.Dropped, out var dropped))
|
||||
@@ -293,7 +293,7 @@ namespace Content.Server.Interaction
|
||||
if (!ValidateInteractAndFace(user, coordinates))
|
||||
return;
|
||||
|
||||
if (!_actionBlockerSystem.CanInteract(user))
|
||||
if (!_actionBlockerSystem.CanInteract(user.Uid))
|
||||
return;
|
||||
|
||||
// Get entity clicked upon from UID if valid UID, if not assume no entity clicked upon and null
|
||||
@@ -367,7 +367,7 @@ namespace Content.Server.Interaction
|
||||
/// </summary>
|
||||
public void InteractHand(IEntity user, IEntity target)
|
||||
{
|
||||
if (!_actionBlockerSystem.CanInteract(user))
|
||||
if (!_actionBlockerSystem.CanInteract(user.Uid))
|
||||
return;
|
||||
|
||||
// all interactions should only happen when in range / unobstructed, so no range check is needed
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Content.Server.Light.Components
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User)) return false;
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid)) return false;
|
||||
if (!_cellSlot.InsertCell(eventArgs.Using)) return false;
|
||||
Dirty();
|
||||
return true;
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
return;
|
||||
|
||||
// standard interaction checks
|
||||
if (!_blocker.CanInteract(eventArgs.User)) return;
|
||||
if (!_blocker.CanInteract(eventArgs.User.Uid)) return;
|
||||
|
||||
if (eventArgs.Used != null)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Content.Server.Medical.Components
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Content.Server.Medical
|
||||
|
||||
private void OnRelayMovement(EntityUid uid, MedicalScannerComponent component, RelayMovementEntityEvent args)
|
||||
{
|
||||
if (_blocker.CanInteract(args.Entity))
|
||||
if (_blocker.CanInteract(args.Entity.Uid))
|
||||
{
|
||||
if (_gameTiming.CurTime <
|
||||
component.LastInternalOpenAttempt + MedicalScannerComponent.InternalOpenAttemptDelay)
|
||||
|
||||
@@ -153,8 +153,8 @@ namespace Content.Server.ParticleAccelerator.Components
|
||||
}
|
||||
|
||||
|
||||
if (obj.Session.AttachedEntity == null ||
|
||||
!EntitySystem.Get<ActionBlockerSystem>().CanInteract(obj.Session.AttachedEntity))
|
||||
if (obj.Session.AttachedEntityUid == null ||
|
||||
!EntitySystem.Get<ActionBlockerSystem>().CanInteract(obj.Session.AttachedEntityUid.Value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Content.Server.Power.Components
|
||||
/// <inheritdoc />
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
return false;
|
||||
|
||||
if (_cablePrototypeID == null)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.Shuttles
|
||||
{
|
||||
if (comp.Console == null) continue;
|
||||
|
||||
if (!_blocker.CanInteract(comp.Owner))
|
||||
if (!_blocker.CanInteract(comp.OwnerUid))
|
||||
{
|
||||
toRemove.Add(comp);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ namespace Content.Server.Shuttles
|
||||
|
||||
public void AddPilot(IEntity entity, ShuttleConsoleComponent component)
|
||||
{
|
||||
if (!_blocker.CanInteract(entity) ||
|
||||
if (!_blocker.CanInteract(entity.Uid) ||
|
||||
!entity.TryGetComponent(out PilotComponent? pilotComponent) ||
|
||||
component.SubscribedPilots.Contains(pilotComponent))
|
||||
{
|
||||
|
||||
@@ -160,7 +160,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
return false;
|
||||
|
||||
if (item == null)
|
||||
@@ -225,7 +225,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
return false;
|
||||
|
||||
if (item == null)
|
||||
@@ -290,7 +290,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
return false;
|
||||
|
||||
if (!inventory.HasSlot(slot))
|
||||
@@ -346,7 +346,7 @@ namespace Content.Server.Strip
|
||||
|
||||
bool Check()
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid))
|
||||
return false;
|
||||
|
||||
if (!hands.HasHand(hand))
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Content.Server.Stunnable
|
||||
|
||||
private void OnInteractUsing(EntityUid uid, StunbatonComponent comp, InteractUsingEvent args)
|
||||
{
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(args.User))
|
||||
if (!Get<ActionBlockerSystem>().CanInteract(args.User.Uid))
|
||||
return;
|
||||
|
||||
if (EntityManager.TryGetComponent<PowerCellSlotComponent>(uid, out var cellslot))
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Content.Server.Tabletop
|
||||
return;
|
||||
|
||||
// Check that the entity can interact with the game board.
|
||||
if(_actionBlockerSystem.CanInteract(args.User))
|
||||
if(_actionBlockerSystem.CanInteract(args.User.Uid))
|
||||
OpenSessionFor(actor.PlayerSession, uid);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Content.Server.Weapon.Ranged
|
||||
|
||||
private bool UserCanFire(IEntity user)
|
||||
{
|
||||
return (UserCanFireHandler == null || UserCanFireHandler(user)) && EntitySystem.Get<ActionBlockerSystem>().CanInteract(user);
|
||||
return (UserCanFireHandler == null || UserCanFireHandler(user)) && EntitySystem.Get<ActionBlockerSystem>().CanInteract(user.Uid);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -18,9 +18,6 @@ namespace Content.Shared.ActionBlocker
|
||||
[UsedImplicitly]
|
||||
public class ActionBlockerSystem : EntitySystem
|
||||
{
|
||||
// TODO: Make the EntityUid the main overload for all these methods.
|
||||
// TODO: Move each of these to their relevant EntitySystems?
|
||||
|
||||
public bool CanMove(EntityUid uid)
|
||||
{
|
||||
var ev = new MovementAttemptEvent(uid);
|
||||
@@ -29,18 +26,12 @@ namespace Content.Shared.ActionBlocker
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool CanInteract(IEntity entity)
|
||||
{
|
||||
var ev = new InteractionAttemptEvent(entity);
|
||||
|
||||
RaiseLocalEvent(entity.Uid, ev);
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool CanInteract(EntityUid uid)
|
||||
{
|
||||
return CanInteract(EntityManager.GetEntity(uid));
|
||||
var ev = new InteractionAttemptEvent(uid);
|
||||
RaiseLocalEvent(uid, ev);
|
||||
|
||||
return !ev.Cancelled;
|
||||
}
|
||||
|
||||
public bool CanUse(EntityUid uid)
|
||||
|
||||
@@ -4,11 +4,11 @@ namespace Content.Shared.Interaction.Events
|
||||
{
|
||||
public class InteractionAttemptEvent : CancellableEntityEventArgs
|
||||
{
|
||||
public InteractionAttemptEvent(IEntity entity)
|
||||
public InteractionAttemptEvent(EntityUid uid)
|
||||
{
|
||||
Entity = entity;
|
||||
Uid = uid;
|
||||
}
|
||||
|
||||
public IEntity Entity { get; }
|
||||
public EntityUid Uid { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace Content.Shared.Interaction
|
||||
/// </summary>
|
||||
public async Task InteractUsing(IEntity user, IEntity used, IEntity target, EntityCoordinates clickLocation)
|
||||
{
|
||||
if (!_actionBlockerSystem.CanInteract(user))
|
||||
if (!_actionBlockerSystem.CanInteract(user.Uid))
|
||||
return;
|
||||
|
||||
if (InteractDoBefore(user, used, target, clickLocation, true))
|
||||
@@ -444,7 +444,7 @@ namespace Content.Shared.Interaction
|
||||
delayComponent.BeginDelay();
|
||||
}
|
||||
|
||||
if (!_actionBlockerSystem.CanInteract(user) || !_actionBlockerSystem.CanUse(user.Uid))
|
||||
if (!_actionBlockerSystem.CanInteract(user.Uid) || !_actionBlockerSystem.CanUse(user.Uid))
|
||||
return;
|
||||
|
||||
// all activates should only fire when in range / unobstructed
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Content.Shared.Storage
|
||||
|
||||
bool IDraggable.Drop(DragDropEvent eventArgs)
|
||||
{
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User))
|
||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(eventArgs.User.Uid))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Shared.Strip.Components
|
||||
{
|
||||
return by != Owner
|
||||
&& by.HasComponent<SharedHandsComponent>()
|
||||
&& EntitySystem.Get<ActionBlockerSystem>().CanInteract(by);
|
||||
&& EntitySystem.Get<ActionBlockerSystem>().CanInteract(by.Uid);
|
||||
}
|
||||
|
||||
bool IDraggable.CanDrop(CanDropEvent args)
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace Content.Shared.Verbs
|
||||
// A large number of verbs need to check action blockers. Instead of repeatedly having each system individually
|
||||
// call ActionBlocker checks, just cache it for the verb request.
|
||||
var actionBlockerSystem = EntitySystem.Get<ActionBlockerSystem>();
|
||||
CanInteract = force || actionBlockerSystem.CanInteract(user);
|
||||
CanInteract = force || actionBlockerSystem.CanInteract(user.Uid);
|
||||
|
||||
if (!user.TryGetComponent(out Hands) ||
|
||||
!actionBlockerSystem.CanUse(user.Uid))
|
||||
|
||||
Reference in New Issue
Block a user