Remove some functions from HandsComponent (#4937)

* remove wrapper functions

* Remove InteractionSystem wrapper functions

* remove two more functions

* add missing `using`

* clean diff
This commit is contained in:
Leon Friedrich
2021-10-25 20:06:12 +13:00
committed by GitHub
parent e621a82e65
commit 6e84e23ba1
10 changed files with 437 additions and 509 deletions

View File

@@ -15,7 +15,6 @@ using Content.Shared.Pulling.Components;
using Content.Shared.Sound;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -50,44 +49,6 @@ namespace Content.Server.Hands.Components
}
}
protected override void DoEquippedHandInteraction(IEntity entity, HandState handState)
{
_entitySystemManager.GetEntitySystem<InteractionSystem>().EquippedHandInteraction(Owner, entity, handState);
}
protected override void DoDroppedInteraction(IEntity heldEntity, bool intentionalDrop)
{
_entitySystemManager.GetEntitySystem<InteractionSystem>().DroppedInteraction(Owner, heldEntity, intentionalDrop);
}
protected override void DoHandSelectedInteraction(IEntity entity)
{
_entitySystemManager.GetEntitySystem<InteractionSystem>().HandSelectedInteraction(Owner, entity);
}
protected override void DoHandDeselectedInteraction(IEntity entity)
{
_entitySystemManager.GetEntitySystem<InteractionSystem>().HandDeselectedInteraction(Owner, entity);
}
protected override async void DoInteraction(IEntity activeHeldEntity, IEntity heldEntity)
{
await _entitySystemManager.GetEntitySystem<InteractionSystem>()
.InteractUsing(Owner, activeHeldEntity, heldEntity, EntityCoordinates.Invalid);
}
protected override void DoActivate(IEntity heldEntity)
{
_entitySystemManager.GetEntitySystem<InteractionSystem>()
.TryInteractionActivate(Owner, heldEntity);
}
protected override void DoUse(IEntity heldEntity, bool altInteract = false)
{
_entitySystemManager.GetEntitySystem<InteractionSystem>()
.TryUseInteraction(Owner, heldEntity, altInteract);
}
protected override void HandlePickupAnimation(IEntity entity)
{
var initialPosition = EntityCoordinates.FromMap(Owner.Transform.Parent?.Owner ?? Owner, entity.Transform.MapPosition);
@@ -194,38 +155,6 @@ namespace Content.Server.Hands.Components
}
}
/// <summary>
/// Attempts to use the active held item.
/// </summary>
public void ActivateItem()
{
UseActiveHeldEntity();
}
/// <summary>
/// Tries to drop the contents of a hand directly under the player.
/// </summary>
public bool Drop(string handName, bool checkActionBlocker = true, bool intentionalDrop = true)
{
return TryDropHandToFloor(handName, checkActionBlocker, intentionalDrop);
}
/// <summary>
/// Tries to drop an entity in a hand directly under the player.
/// </summary>
public bool Drop(IEntity entity, bool checkActionBlocker = true, bool intentionalDrop = true)
{
return TryDropEntityToFloor(entity, checkActionBlocker, intentionalDrop);
}
/// <summary>
/// Tries to unequip contents of a hand directly into a container.
/// </summary>
public bool Drop(IEntity entity, BaseContainer targetContainer, bool checkActionBlocker = true)
{
return TryPutEntityIntoContainer(entity, targetContainer, checkActionBlocker);
}
/// <summary>
/// Tries to get the ItemComponent on the entity held by a hand.
/// </summary>
@@ -292,26 +221,6 @@ namespace Content.Server.Hands.Components
}
return false;
}
/// <summary>
/// Attempts to put an item into the active hand, or any other hand if it cannot.
/// </summary>
public bool PutInHand(ItemComponent item, bool checkActionBlocker = true)
{
return TryPutInActiveHandOrAny(item.Owner, checkActionBlocker);
}
/// <summary>
/// Puts an item any hand, prefering the active hand, or puts it on the floor under the player.
/// </summary>
public void PutInHandOrDrop(ItemComponent item, bool checkActionBlocker = true)
{
var entity = item.Owner;
if (!TryPutInActiveHandOrAny(entity, checkActionBlocker))
entity.Transform.Coordinates = Owner.Transform.Coordinates;
}
#endregion
}
}