using System; using Content.Server.GameObjects; using Robust.Shared.Interfaces.GameObjects; using System.Collections.Generic; using Robust.Server.GameObjects.Components.Container; using Robust.Server.GameObjects.EntitySystemMessages; using Robust.Shared.Map; namespace Content.Server.Interfaces.GameObjects { public interface IHandsComponent : IComponent { /// /// The hand index of the currently active hand. /// string ActiveIndex { get; set; } /// /// Enumerates over every held item. /// IEnumerable GetAllHeldItems(); /// /// Gets the item held by a hand. /// /// The index of the hand to get. /// The item in the held, null if no item is held ItemComponent GetHand(string index); /// /// Gets item held by the current active hand /// ItemComponent GetActiveHand { get; } /// /// Puts an item into any empty hand, preferring the active hand. /// /// The item to put in a hand. /// True if the item was inserted, false otherwise. bool PutInHand(ItemComponent item); /// /// Puts an item into a specific hand. /// /// The item to put in the hand. /// The index of the hand to put the item into. /// /// If true and the provided hand is full, the method will fall back to /// /// True if the item was inserted into a hand, false otherwise. bool PutInHand(ItemComponent item, string index, bool fallback=true); /// /// Checks to see if an item can be put in any hand. /// /// The item to check for. /// True if the item can be inserted, false otherwise. bool CanPutInHand(ItemComponent item); /// /// Checks to see if an item can be put in the specified hand. /// /// The item to check for. /// The index for the hand to check for. /// True if the item can be inserted, false otherwise. bool CanPutInHand(ItemComponent item, string index); /// /// Finds the hand slot holding the specified entity, if any. /// /// /// The entity to look for in our hands. /// /// /// The index of the hand slot if the entity is indeed held, otherwise. /// string FindHand(IEntity entity); /// /// Drops the item contained in the slot to the same position as our entity. /// /// The slot of which to drop to drop the item. /// True on success, false if something blocked the drop. bool Drop(string slot); /// /// Drops an item held by one of our hand slots to the same position as our owning entity. /// /// The item to drop. /// True on success, false if something blocked the drop. /// /// Thrown if is null. /// /// /// Thrown if is not actually held in any hand. /// bool Drop(IEntity entity); /// /// Drops the item in a slot. /// /// The slot to drop the item from. /// /// True if an item was dropped, false otherwise. bool Drop(string slot, GridCoordinates coords); /// /// Drop the specified entity in our hands to a certain position. /// /// /// There are no checks whether or not the user is within interaction range of the drop location /// or whether the drop location is occupied. /// /// The entity to drop, must be held in one of the hands. /// The coordinates to drop the entity at. /// /// True if the drop succeeded, /// false if it failed (due to failing to eject from our hand slot, etc...) /// /// /// Thrown if is null. /// /// /// Thrown if is not actually held in any hand. /// bool Drop(IEntity entity, GridCoordinates coords); /// /// Drop the item contained in a slot into another container. /// /// The slot of which to drop the entity. /// The container to drop into. /// True on success, false if something was blocked (insertion or removal). /// /// Thrown if dry-run checks reported OK to remove and insert, /// but practical remove or insert returned false anyways. /// This is an edge-case that is currently unhandled. /// bool Drop(string slot, BaseContainer targetContainer); /// /// Drops an item in one of the hands into a container. /// /// The item to drop. /// The container to drop into. /// True on success, false if something was blocked (insertion or removal). /// /// Thrown if dry-run checks reported OK to remove and insert, /// but practical remove or insert returned false anyways. /// This is an edge-case that is currently unhandled. /// /// /// Thrown if is null. /// /// /// Thrown if is not actually held in any hand. /// bool Drop(IEntity entity, BaseContainer targetContainer); /// /// Checks whether the item in the specified hand can be dropped. /// /// The hand to check for. /// /// True if the item can be dropped, false if the hand is empty or the item in the hand cannot be dropped. /// bool CanDrop(string index); /// /// Adds a new hand to this hands component. /// /// The name of the hand to add. /// /// Thrown if a hand with specified name already exists. /// void AddHand(string index); /// /// Removes a hand from this hands component. /// /// /// If the hand contains an item, the item is dropped. /// /// The name of the hand to remove. void RemoveHand(string index); /// /// Checks whether a hand with the specified name exists. /// /// The hand name to check. /// True if the hand exists, false otherwise. bool HasHand(string index); void HandleSlotModifiedMaybe(ContainerModifiedMessage message); } }