Moved dropping items over PlaceableSurfaces from AfterAttack to AttackBy (#209)
Added ClickLocation variable to AttackByEventArgs
This commit is contained in:
committed by
Pieter-Jan Briers
parent
8655dcaaf6
commit
b16768fd0b
@@ -1,9 +1,10 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
public class PlaceableSurfaceComponent : Component
|
||||
public class PlaceableSurfaceComponent : Component, IAttackBy
|
||||
{
|
||||
public override string Name => "PlaceableSurface";
|
||||
|
||||
@@ -16,5 +17,15 @@ namespace Content.Server.GameObjects.Components
|
||||
|
||||
serializer.DataField(ref _isPlaceable, "IsPlaceable", true);
|
||||
}
|
||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||
{
|
||||
if(!eventArgs.User.TryGetComponent<HandsComponent>(out var handComponent))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
handComponent.Drop(eventArgs.AttackWith);
|
||||
eventArgs.AttackWith.Transform.WorldPosition = eventArgs.ClickLocation.Position;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user