using Content.Shared.Hands.Components; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; using Robust.Shared.Serialization; namespace Content.Shared.Item; /// /// Handles items which can be picked up to hands and placed in pockets, as well as storage containers /// like backpacks. /// [RegisterComponent] [NetworkedComponent] [Access(typeof(SharedItemSystem))] public sealed partial class ItemComponent : Component { [DataField, ViewVariables(VVAccess.ReadWrite)] [Access(typeof(SharedItemSystem))] public ProtoId Size = "Small"; [Access(typeof(SharedItemSystem))] [DataField] public Dictionary> InhandVisuals = new(); [Access(typeof(SharedItemSystem))] [ViewVariables(VVAccess.ReadWrite)] [DataField] public string? HeldPrefix; /// /// Rsi of the sprite shown on the player when this item is in their hands. Used to generate a default entry for /// [Access(typeof(SharedItemSystem))] [ViewVariables(VVAccess.ReadWrite)] [DataField("sprite")] public string? RsiPath; } [Serializable, NetSerializable] public sealed class ItemComponentState : ComponentState { public ProtoId Size { get; } public string? HeldPrefix { get; } public ItemComponentState(ProtoId size, string? heldPrefix) { Size = size; HeldPrefix = heldPrefix; } } /// /// Raised when an item's visual state is changed. The event is directed at the entity that contains this item, so /// that it can properly update its hands or inventory sprites and GUI. /// [Serializable, NetSerializable] public sealed class VisualsChangedEvent : EntityEventArgs { public readonly NetEntity Item; public readonly string ContainerId; public VisualsChangedEvent(NetEntity item, string containerId) { Item = item; ContainerId = containerId; } }