Files
tbd-station-14/Content.Server/GameObjects/Components/Items/Storage/ItemComponent.cs
Acruid 8038ebe37d Fix Hands Crash (#122)
* Fixed sprite issues with construction system (Thanks PJB!).

* Storage and Hands Systems now subscribe to Transform Parent changes, and will keep their containers in sync.

* Add check in Interaction System to prevent processing client-side entities on the server.
2018-11-11 20:32:05 +01:00

37 lines
993 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()
{
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;
}
}
}