Files
RobustToolbox/SS14.Client/GameObjects/Component/Item/BasicItemComponent.cs
Pieter-Jan Briers 36a5386a3d Remove IoCManager.ResolveEnumerable, ContentLoader (#236)
* Remove IoCManager.ResolveEnumerable, ContentLoader

IContentLoader has been replaced with IReflectionManager.
IoCManager.ResolveEnumerable<T> is now handled by
IReflectionManager.GetAllChildren<T>. IoC now solely handles services.

That was pretty bad API design on my part.

* Make ClientComponent have [Reflect(false)]

* Unit tests.
2017-06-17 17:33:51 +02:00

45 lines
1.2 KiB
C#

using SS14.Shared;
using SS14.Shared.GameObjects;
using SS14.Shared.GameObjects.Components.Item;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.IoC;
namespace SS14.Client.GameObjects
{
public class BasicItemComponent : ClientComponent
{
public override string Name => "BasicItem";
public IEntity Holder;
public InventoryLocation HoldingHand;
public BasicItemComponent()
{
Family = ComponentFamily.Item;
}
public override System.Type StateType
{
get { return typeof(ItemComponentState); }
}
public override void HandleComponentState(dynamic state)
{
SetNewState(state);
}
private void SetNewState(ItemComponentState state)
{
if (state.Holder != null && (Holder == null || Holder.Uid != state.Holder))
{
Holder = Owner.EntityManager.GetEntity((int)state.Holder);
HoldingHand = state.InventoryLocation;
}
if (Holder != null && state.Holder == null)
{
Holder = null;
HoldingHand = state.InventoryLocation;
}
}
}
}