Make more uids nullable (#5794)
This commit is contained in:
@@ -52,7 +52,7 @@ namespace Content.Shared.DoAfter
|
||||
|
||||
public EntityCoordinates TargetGrid { get; }
|
||||
|
||||
public EntityUid TargetUid { get; }
|
||||
public EntityUid? Target { get; }
|
||||
|
||||
public float Delay { get; }
|
||||
|
||||
@@ -63,7 +63,8 @@ namespace Content.Shared.DoAfter
|
||||
|
||||
public float MovementThreshold { get; }
|
||||
|
||||
public ClientDoAfter(byte id, EntityCoordinates userGrid, EntityCoordinates targetGrid, TimeSpan startTime, float delay, bool breakOnUserMove, bool breakOnTargetMove, float movementThreshold, EntityUid targetUid = default)
|
||||
public ClientDoAfter(byte id, EntityCoordinates userGrid, EntityCoordinates targetGrid, TimeSpan startTime,
|
||||
float delay, bool breakOnUserMove, bool breakOnTargetMove, float movementThreshold, EntityUid? target = null)
|
||||
{
|
||||
ID = id;
|
||||
UserGrid = userGrid;
|
||||
@@ -73,7 +74,7 @@ namespace Content.Shared.DoAfter
|
||||
BreakOnUserMove = breakOnUserMove;
|
||||
BreakOnTargetMove = breakOnTargetMove;
|
||||
MovementThreshold = movementThreshold;
|
||||
TargetUid = targetUid;
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ namespace Content.Shared.Interaction
|
||||
/// <param name="used"></param>
|
||||
public void TryUseInteraction(EntityUid user, EntityUid used, bool altInteract = false)
|
||||
{
|
||||
if (user != null && used != null && _actionBlockerSystem.CanUse(user))
|
||||
if (_actionBlockerSystem.CanUse(user))
|
||||
{
|
||||
if (altInteract)
|
||||
AltInteract(user, used);
|
||||
@@ -820,7 +820,7 @@ namespace Content.Shared.Interaction
|
||||
/// </summary>
|
||||
public bool TryDroppedInteraction(EntityUid user, EntityUid item)
|
||||
{
|
||||
if (user == null || item == null || !_actionBlockerSystem.CanDrop(user)) return false;
|
||||
if (!_actionBlockerSystem.CanDrop(user)) return false;
|
||||
|
||||
DroppedInteraction(user, item);
|
||||
return true;
|
||||
|
||||
@@ -64,15 +64,17 @@ namespace Content.Shared.Verbs
|
||||
// call ActionBlocker checks, just cache it for the verb request.
|
||||
var canInteract = force || _actionBlockerSystem.CanInteract(user);
|
||||
|
||||
EntityUid @using = default;
|
||||
if (EntityManager.TryGetComponent(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user)))
|
||||
EntityUid? @using = null;
|
||||
if (TryComp(user, out SharedHandsComponent? hands) && (force || _actionBlockerSystem.CanUse(user)))
|
||||
{
|
||||
hands.TryGetActiveHeldEntity(out @using);
|
||||
// TODO Hands remove nullable (#5634)
|
||||
hands.TryGetActiveHeldEntity(out var nonNullableUsing);
|
||||
@using = nonNullableUsing;
|
||||
|
||||
// Check whether the "Held" entity is a virtual pull entity. If yes, set that as the entity being "Used".
|
||||
// This allows you to do things like buckle a dragged person onto a surgery table, without click-dragging
|
||||
// their sprite.
|
||||
if (@using != default && EntityManager.TryGetComponent<HandVirtualItemComponent?>(@using, out var pull))
|
||||
if (@using != null && TryComp(@using, out HandVirtualItemComponent? pull))
|
||||
{
|
||||
@using = pull.BlockingEntity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user