Files
tbd-station-14/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs
Pieter-Jan Briers 20cf3a6a9b Rename IEntity.GetComponents to GetAllComponents. (#68)
* Rename IEntity.GetComponents to GetAllComponents.

This is to avoid confusion.
A single s to distinguish it from GetComponent() is quite hard to miss.

* Update submodule.
2018-05-10 19:21:15 +02:00

37 lines
1011 B
C#

using Content.Server.Interfaces.GameObjects;
using SS14.Server.Interfaces.GameObjects;
using System;
using SS14.Shared.Interfaces.GameObjects;
namespace Content.Server.GameObjects
{
public class ItemComponent : StoreableComponent, EntitySystems.IAttackHand
{
public override string Name => "Item";
public void RemovedFromSlot()
{
foreach (var component in Owner.GetAllComponents<ISpriteRenderableComponent>())
{
component.Visible = true;
}
}
public void EquippedToSlot(ContainerSlot slot)
{
foreach (var component in Owner.GetAllComponents<ISpriteRenderableComponent>())
{
component.Visible = false;
}
}
public bool Attackhand(IEntity user)
{
var hands = user.GetComponent<IHandsComponent>();
hands.PutInHand(this, hands.ActiveIndex, fallback: false);
return true;
}
}
}