ActionBlocker CanPickup uses EntityUid exclusively
This commit is contained in:
@@ -53,7 +53,7 @@ namespace Content.Server.Access
|
|||||||
if (args.Hands == null ||
|
if (args.Hands == null ||
|
||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Can we eject a privileged ID?
|
// Can we eject a privileged ID?
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!component.HasBeaker ||
|
!component.HasBeaker ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!component.HasBeaker ||
|
!component.HasBeaker ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Content.Server.Power.EntitySystems
|
|||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!component.HasCell ||
|
!component.HasCell ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Content.Server.PowerCell
|
|||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!component.ShowVerb ||
|
!component.ShowVerb ||
|
||||||
!component.HasCell ||
|
!component.HasCell ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Content.Server.Weapon.Ranged.Barrels
|
|||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!component.PowerCellRemovable ||
|
!component.PowerCellRemovable ||
|
||||||
component.PowerCell == null ||
|
component.PowerCell == null ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Verb verb = new();
|
Verb verb = new();
|
||||||
@@ -104,7 +104,7 @@ namespace Content.Server.Weapon.Ranged.Barrels
|
|||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!component.HasMagazine ||
|
!component.HasMagazine ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (component.MagNeedsOpenBolt && !component.BoltOpen)
|
if (component.MagNeedsOpenBolt && !component.BoltOpen)
|
||||||
|
|||||||
@@ -75,18 +75,12 @@ namespace Content.Shared.ActionBlocker
|
|||||||
return !ev.Cancelled;
|
return !ev.Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanPickup(IEntity entity)
|
|
||||||
{
|
|
||||||
var ev = new PickupAttemptEvent(entity);
|
|
||||||
|
|
||||||
RaiseLocalEvent(entity.Uid, ev);
|
|
||||||
|
|
||||||
return !ev.Cancelled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanPickup(EntityUid uid)
|
public bool CanPickup(EntityUid uid)
|
||||||
{
|
{
|
||||||
return CanPickup(EntityManager.GetEntity(uid));
|
var ev = new PickupAttemptEvent(uid);
|
||||||
|
RaiseLocalEvent(uid, ev);
|
||||||
|
|
||||||
|
return !ev.Cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanEmote(EntityUid uid)
|
public bool CanEmote(EntityUid uid)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace Content.Shared.Containers.ItemSlots
|
|||||||
if (args.Hands == null ||
|
if (args.Hands == null ||
|
||||||
!args.CanAccess ||
|
!args.CanAccess ||
|
||||||
!args.CanInteract ||
|
!args.CanInteract ||
|
||||||
!_actionBlockerSystem.CanPickup(args.User))
|
!_actionBlockerSystem.CanPickup(args.User.Uid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var (slotName, slot) in component.Slots)
|
foreach (var (slotName, slot) in component.Slots)
|
||||||
|
|||||||
@@ -625,7 +625,7 @@ namespace Content.Shared.Hands.Components
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected bool PlayerCanPickup()
|
protected bool PlayerCanPickup()
|
||||||
{
|
{
|
||||||
if (!IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ActionBlockerSystem>().CanPickup(Owner))
|
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(Owner.Uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ namespace Content.Shared.Item
|
|||||||
{
|
{
|
||||||
public class PickupAttemptEvent : CancellableEntityEventArgs
|
public class PickupAttemptEvent : CancellableEntityEventArgs
|
||||||
{
|
{
|
||||||
public PickupAttemptEvent(IEntity entity)
|
public PickupAttemptEvent(EntityUid uid)
|
||||||
{
|
{
|
||||||
Entity = entity;
|
Uid = uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEntity Entity { get; }
|
public EntityUid Uid { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ namespace Content.Shared.Item
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CanPickup(IEntity user, bool popup = true)
|
public bool CanPickup(IEntity user, bool popup = true)
|
||||||
{
|
{
|
||||||
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(user))
|
if (!EntitySystem.Get<ActionBlockerSystem>().CanPickup(user.Uid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (user.Transform.MapID != Owner.Transform.MapID)
|
if (user.Transform.MapID != Owner.Transform.MapID)
|
||||||
|
|||||||
Reference in New Issue
Block a user