Partial hand ECS (#5634)

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
Co-authored-by: Paul <ritter.paul1@googlemail.com>
This commit is contained in:
Leon Friedrich
2022-01-05 17:53:08 +13:00
committed by GitHub
parent 03ad20758e
commit adbc4ee5b0
34 changed files with 781 additions and 963 deletions

View File

@@ -139,7 +139,6 @@ namespace Content.Shared.Interaction
if (!TryComp(user, out SharedHandsComponent? hands))
return;
// TODO: Replace with body interaction range when we get something like arm length or telekinesis or something.
var inRangeUnobstructed = user.InRangeUnobstructed(coordinates, ignoreInsideBlocker: true);
if (target == null || !inRangeUnobstructed)
@@ -734,46 +733,6 @@ namespace Content.Shared.Interaction
}
#endregion
#region Equip Hand
/// <summary>
/// Calls EquippedHand on all components that implement the IEquippedHand interface
/// on an item.
/// </summary>
public void EquippedHandInteraction(EntityUid user, EntityUid item, HandState hand)
{
var equippedHandMessage = new EquippedHandEvent(user, item, hand);
RaiseLocalEvent(item, equippedHandMessage);
if (equippedHandMessage.Handled)
return;
var comps = AllComps<IEquippedHand>(item).ToList();
foreach (var comp in comps)
{
comp.EquippedHand(new EquippedHandEventArgs(user, hand));
}
}
/// <summary>
/// Calls UnequippedHand on all components that implement the IUnequippedHand interface
/// on an item.
/// </summary>
public void UnequippedHandInteraction(EntityUid user, EntityUid item, HandState hand)
{
var unequippedHandMessage = new UnequippedHandEvent(user, item, hand);
RaiseLocalEvent(item, unequippedHandMessage);
if (unequippedHandMessage.Handled)
return;
var comps = AllComps<IUnequippedHand>(item).ToList();
foreach (var comp in comps)
{
comp.UnequippedHand(new UnequippedHandEventArgs(user, hand));
}
}
#endregion
#region Drop
/// <summary>
/// Activates the Dropped behavior of an object
@@ -813,47 +772,6 @@ namespace Content.Shared.Interaction
_adminLogSystem.Add(LogType.Drop, LogImpact.Low, $"{ToPrettyString(user):user} dropped {ToPrettyString(item):entity}");
}
#endregion
#region Hand Selected
/// <summary>
/// Calls HandSelected on all components that implement the IHandSelected interface
/// on an item entity on a hand that has just been selected.
/// </summary>
public void HandSelectedInteraction(EntityUid user, EntityUid item)
{
var handSelectedMsg = new HandSelectedEvent(user, item);
RaiseLocalEvent(item, handSelectedMsg);
if (handSelectedMsg.Handled)
return;
var comps = AllComps<IHandSelected>(item).ToList();
// Call Land on all components that implement the interface
foreach (var comp in comps)
{
comp.HandSelected(new HandSelectedEventArgs(user));
}
}
/// <summary>
/// Calls HandDeselected on all components that implement the IHandDeselected interface
/// on an item entity on a hand that has just been deselected.
/// </summary>
public void HandDeselectedInteraction(EntityUid user, EntityUid item)
{
var handDeselectedMsg = new HandDeselectedEvent(user, item);
RaiseLocalEvent(item, handDeselectedMsg);
if (handDeselectedMsg.Handled)
return;
var comps = AllComps<IHandDeselected>(item).ToList();
// Call Land on all components that implement the interface
foreach (var comp in comps)
{
comp.HandDeselected(new HandDeselectedEventArgs(user));
}
}
#endregion
/// <summary>
@@ -891,8 +809,6 @@ namespace Content.Shared.Interaction
return true;
}
#endregion
}
/// <summary>