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