30 lines
518 B
C#
30 lines
518 B
C#
using Sandbox.Gravity;
|
|
using Sasalka;
|
|
|
|
namespace Sandbox.UI;
|
|
|
|
[Icon( "skip_next" )]
|
|
public sealed class PickupItem : InteractionButton
|
|
{
|
|
[Property] public override string Label { get; set; } = "E";
|
|
|
|
public override bool Press( IPressable.Event e )
|
|
{
|
|
base.Press( e );
|
|
|
|
if ( e.Source.Components.TryGet<Dedugan>( out var dedugan ) )
|
|
{
|
|
dedugan.Inventory.AddItem( Components.Get<InventoryItem>() );
|
|
RpcDestroy();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
[Rpc.Broadcast]
|
|
void RpcDestroy()
|
|
{
|
|
GameObject.Destroy();
|
|
}
|
|
}
|