Moved dropping items over PlaceableSurfaces from AfterAttack to AttackBy (#209)

Added ClickLocation variable to AttackByEventArgs
This commit is contained in:
DamianX
2019-04-25 22:22:51 +01:00
committed by Pieter-Jan Briers
parent 8655dcaaf6
commit b16768fd0b
3 changed files with 16 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ using Robust.Shared.Maths;
namespace Content.Server.GameObjects
{
public class ItemComponent : StoreableComponent, IAttackHand, IAfterAttack
public class ItemComponent : StoreableComponent, IAttackHand
{
public override string Name => "Item";
public override uint? NetID => ContentNetIDs.ITEM;
@@ -91,21 +91,6 @@ namespace Content.Server.GameObjects
return new ItemComponentState(EquippedPrefix);
}
public void AfterAttack(AfterAttackEventArgs eventArgs)
{
if (!eventArgs.User.TryGetComponent<HandsComponent>(out var handComponent))
{
return;
}
if (eventArgs.Attacked == null || !eventArgs.Attacked.TryGetComponent<PlaceableSurfaceComponent>(out var placeableSurfaceComponent))
{
return;
}
handComponent.Drop(handComponent.ActiveIndex);
Owner.Transform.WorldPosition = eventArgs.ClickLocation.Position;
return;
}
public void Fumble()
{
if (Owner.TryGetComponent<PhysicsComponent>(out var physicsComponent))