using Content.Server.Interfaces.GameObjects; using SS14.Server.Interfaces.GameObjects; using Content.Shared.GameObjects; using SS14.Shared.Interfaces.GameObjects; using Content.Server.GameObjects.EntitySystems; namespace Content.Server.GameObjects { public class ItemComponent : StoreableComponent, IAttackHand { public override string Name => "Item"; public void RemovedFromSlot() { foreach (var component in Owner.GetAllComponents()) { component.Visible = true; } } public void EquippedToSlot() { foreach (var component in Owner.GetAllComponents()) { component.Visible = false; } } public bool AttackHand(AttackHandEventArgs eventArgs) { var hands = eventArgs.User.GetComponent(); hands.PutInHand(this, hands.ActiveIndex, fallback: false); return true; } [Verb] public sealed class PickUpVerb : Verb { protected override string GetText(IEntity user, ItemComponent component) { if (user.TryGetComponent(out HandsComponent hands) && hands.IsHolding(component.Owner)) { return "Pick Up (Already Holding)"; } return "Pick Up"; } protected override bool IsDisabled(IEntity user, ItemComponent component) { if (user.TryGetComponent(out HandsComponent hands) && hands.IsHolding(component.Owner)) { return true; } return false; } protected override void Activate(IEntity user, ItemComponent component) { if (user.TryGetComponent(out HandsComponent hands) && !hands.IsHolding(component.Owner)) { hands.PutInHand(component); } } } } }