CatStation/Content.Shared/ParcelWrap/Components/WrappedParcelComponent.cs
Centronias 9b31c2a929
Parcel wrap bugfix + multihandedness enhancement (#43956)
* parcel wrap enhancements:
- bugfix: can't wrap stuff that can't be picked up because it's static (ie. usually anchored, maybe other cases, idk)
- enhancement: multi-handedness is inherited by the parcel from its contents
- technical: migrate to `EntityQuery` dependencies for all component lookups.

* Apply suggestion from @Centronias

* Update Content.Shared/ParcelWrap/Systems/ParcelWrappingSystem.cs

* Update ParcelWrappingSystem.cs

---------

Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com>
2026-09-19 19:58:53 +00:00

77 lines
2.7 KiB
C#

using Content.Shared.Item;
using Content.Shared.ParcelWrap.Systems;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.ParcelWrap.Components;
/// <summary>
/// This component marks its owner as being a parcel created by wrapping another item up. It can be unwrapped,
/// destroying this entity and releasing <see cref="Contents"/>.
/// </summary>
/// <seealso cref="ParcelWrapComponent"/>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(ParcelWrappingSystem))]
public sealed partial class WrappedParcelComponent : Component
{
/// <summary>
/// The contents of this parcel.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public ContainerSlot Contents = default!;
/// <summary>
/// Specifies the entity to spawn when this parcel is unwrapped.
/// </summary>
[DataField, AutoNetworkedField]
public EntProtoId? UnwrapTrash;
/// <summary>
/// How long it takes to unwrap this parcel.
/// </summary>
[DataField(required: true), AutoNetworkedField]
public TimeSpan UnwrapDelay = TimeSpan.FromSeconds(1);
/// <summary>
/// Sound played when unwrapping this parcel.
/// </summary>
[DataField, AutoNetworkedField]
public SoundSpecifier? UnwrapSound;
/// <summary>
/// The ID of <see cref="Contents"/>.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadOnly)]
public string ContainerId = "contents";
/// <summary>
/// If true, the owner of this entity has its <see cref="ItemComponent.Size"/> set to the size of any item inserted
/// into <see cref="Container"/>. If the contents do not have a size,
/// <see cref="ParcelWrappingSystem._fallbackParcelSize"/> is used instead.
/// </summary>
[DataField, AutoNetworkedField]
public bool GetsSizeFromContent = true;
/// <summary>
/// If true, the owner of this entity has its <see cref="ItemComponent.Shape"/> set to the shape of any item
/// inserted into <see cref="Container"/>.
/// </summary>
[DataField, AutoNetworkedField]
public bool GetsShapeFromContent;
/// <summary>
/// If true, the owner of this entity has <see cref="MultiHandedItemComponent"/> added if any item inserted into
/// <see cref="Container"/> has that component.
/// </summary>
[DataField, AutoNetworkedField]
public bool GetsMultiHandednessFromContent = true;
/// <summary>
/// If a player trapped inside this parcel can escape from it by unwrapping it.
/// This is set by the <see cref="ParcelWrapComponent" /> used to create the parcel.
/// </summary>
[DataField, AutoNetworkedField]
public bool CanSelfUnwrap = true;
}