Remove hands component reference (#15197)
This commit is contained in:
@@ -16,7 +16,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
|
||||
protected event Action<SharedHandsComponent?>? OnHandSetActive;
|
||||
protected event Action<HandsComponent?>? OnHandSetActive;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -31,7 +31,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
CommandBinds.Unregister<SharedHandsSystem>();
|
||||
}
|
||||
|
||||
public virtual void AddHand(EntityUid uid, string handName, HandLocation handLocation, SharedHandsComponent? handsComp = null)
|
||||
public virtual void AddHand(EntityUid uid, string handName, HandLocation handLocation, HandsComponent? handsComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref handsComp, false))
|
||||
return;
|
||||
@@ -53,7 +53,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
Dirty(handsComp);
|
||||
}
|
||||
|
||||
public virtual void RemoveHand(EntityUid uid, string handName, SharedHandsComponent? handsComp = null)
|
||||
public virtual void RemoveHand(EntityUid uid, string handName, HandsComponent? handsComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref handsComp, false))
|
||||
return;
|
||||
@@ -83,7 +83,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Get any empty hand. Prioritizes the currently active hand.
|
||||
/// </summary>
|
||||
public bool TryGetEmptyHand(EntityUid uid, [NotNullWhen(true)] out Hand? emptyHand, SharedHandsComponent? handComp = null)
|
||||
public bool TryGetEmptyHand(EntityUid uid, [NotNullWhen(true)] out Hand? emptyHand, HandsComponent? handComp = null)
|
||||
{
|
||||
emptyHand = null;
|
||||
if (!Resolve(uid, ref handComp, false))
|
||||
@@ -104,7 +104,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Enumerate over hands, starting with the currently active hand.
|
||||
/// </summary>
|
||||
public IEnumerable<Hand> EnumerateHands(EntityUid uid, SharedHandsComponent? handsComp = null)
|
||||
public IEnumerable<Hand> EnumerateHands(EntityUid uid, HandsComponent? handsComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref handsComp, false))
|
||||
yield break;
|
||||
@@ -122,7 +122,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
/// <summary>
|
||||
/// Enumerate over held items, starting with the item in the currently active hand (if there is one).
|
||||
/// </summary>
|
||||
public IEnumerable<EntityUid> EnumerateHeld(EntityUid uid, SharedHandsComponent? handsComp = null)
|
||||
public IEnumerable<EntityUid> EnumerateHeld(EntityUid uid, HandsComponent? handsComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref handsComp, false))
|
||||
yield break;
|
||||
@@ -145,7 +145,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
/// </summary>
|
||||
/// <returns>True if the active hand was set to a NEW value. Setting it to the same value returns false and does
|
||||
/// not trigger interactions.</returns>
|
||||
public virtual bool TrySetActiveHand(EntityUid uid, string? name, SharedHandsComponent? handComp = null)
|
||||
public virtual bool TrySetActiveHand(EntityUid uid, string? name, HandsComponent? handComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref handComp))
|
||||
return false;
|
||||
@@ -164,7 +164,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
/// </summary>
|
||||
/// <returns>True if the active hand was set to a NEW value. Setting it to the same value returns false and does
|
||||
/// not trigger interactions.</returns>
|
||||
public bool SetActiveHand(EntityUid uid, Hand? hand, SharedHandsComponent? handComp = null)
|
||||
public bool SetActiveHand(EntityUid uid, Hand? hand, HandsComponent? handComp = null)
|
||||
{
|
||||
if (!Resolve(uid, ref handComp))
|
||||
return false;
|
||||
@@ -190,7 +190,7 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsHolding(EntityUid uid, EntityUid? entity, [NotNullWhen(true)] out Hand? inHand, SharedHandsComponent? handsComp = null)
|
||||
public bool IsHolding(EntityUid uid, EntityUid? entity, [NotNullWhen(true)] out Hand? inHand, HandsComponent? handsComp = null)
|
||||
{
|
||||
inHand = null;
|
||||
if (!Resolve(uid, ref handsComp, false))
|
||||
@@ -207,4 +207,15 @@ public abstract partial class SharedHandsSystem : EntitySystem
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryGetHand(EntityUid handsUid, string handId, [NotNullWhen(true)] out Hand? hand,
|
||||
HandsComponent? hands = null)
|
||||
{
|
||||
hand = null;
|
||||
|
||||
if (!Resolve(handsUid, ref hands))
|
||||
return false;
|
||||
|
||||
return hands.Hands.TryGetValue(handId, out hand);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user