2017-09-30 16:56:19 +02:00
|
|
|
|
using Content.Server.Interfaces.GameObjects;
|
|
|
|
|
|
using SS14.Server.Interfaces.GameObjects;
|
2017-09-24 21:09:26 +02:00
|
|
|
|
using System;
|
2018-02-05 13:57:26 -06:00
|
|
|
|
using SS14.Shared.Interfaces.GameObjects;
|
2017-09-24 21:09:26 +02:00
|
|
|
|
|
2017-09-24 23:19:47 +02:00
|
|
|
|
namespace Content.Server.GameObjects
|
2017-09-24 21:09:26 +02:00
|
|
|
|
{
|
2018-04-25 06:42:35 -05:00
|
|
|
|
public class ItemComponent : StoreableComponent, EntitySystems.IAttackHand
|
2017-09-24 21:09:26 +02:00
|
|
|
|
{
|
|
|
|
|
|
public override string Name => "Item";
|
2018-05-10 19:21:15 +02:00
|
|
|
|
|
2017-09-24 21:09:26 +02:00
|
|
|
|
|
|
|
|
|
|
public void RemovedFromSlot()
|
|
|
|
|
|
{
|
2018-05-10 19:21:15 +02:00
|
|
|
|
foreach (var component in Owner.GetAllComponents<ISpriteRenderableComponent>())
|
2017-09-30 16:56:19 +02:00
|
|
|
|
{
|
|
|
|
|
|
component.Visible = true;
|
|
|
|
|
|
}
|
2017-09-24 21:09:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-11-11 11:32:05 -08:00
|
|
|
|
public void EquippedToSlot()
|
2017-09-24 21:09:26 +02:00
|
|
|
|
{
|
2018-05-10 19:21:15 +02:00
|
|
|
|
foreach (var component in Owner.GetAllComponents<ISpriteRenderableComponent>())
|
2017-09-30 16:56:19 +02:00
|
|
|
|
{
|
|
|
|
|
|
component.Visible = false;
|
|
|
|
|
|
}
|
2017-09-24 21:09:26 +02:00
|
|
|
|
}
|
2017-10-06 21:05:21 +02:00
|
|
|
|
|
2018-02-05 13:57:26 -06:00
|
|
|
|
public bool Attackhand(IEntity user)
|
2017-10-06 21:05:21 +02:00
|
|
|
|
{
|
2018-02-05 13:57:26 -06:00
|
|
|
|
var hands = user.GetComponent<IHandsComponent>();
|
|
|
|
|
|
hands.PutInHand(this, hands.ActiveIndex, fallback: false);
|
|
|
|
|
|
return true;
|
2017-10-06 21:05:21 +02:00
|
|
|
|
}
|
2017-09-24 21:09:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|