using Content.Shared.Charges.Systems; using Content.Shared.DoAfter; using Content.Shared.Item; using Content.Shared.ParcelWrap.Components; using Content.Shared.Popups; using Content.Shared.Whitelist; using JetBrains.Annotations; using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Physics; using Robust.Shared.Physics.Components; namespace Content.Shared.ParcelWrap.Systems; /// /// This system handles things related to package wrap, both wrapping items to create parcels, and unwrapping existing /// parcels. /// /// /// public sealed partial class ParcelWrappingSystem : EntitySystem { [Dependency] private SharedAppearanceSystem _appearance = default!; [Dependency] private SharedAudioSystem _audio = default!; [Dependency] private SharedChargesSystem _charges = default!; [Dependency] private SharedContainerSystem _container = default!; [Dependency] private SharedDoAfterSystem _doAfter = default!; [Dependency] private SharedItemSystem _item = default!; [Dependency] private SharedPopupSystem _popup = default!; [Dependency] private SharedTransformSystem _transform = default!; [Dependency] private EntityWhitelistSystem _whitelist = default!; [Dependency] private EntityQuery _itemQuery = default!; [Dependency] private EntityQuery _multiHandedItemQuery = default!; [Dependency] private EntityQuery _parcelWrapOverrideQuery = default!; [Dependency] private EntityQuery _physicsQuery = default!; [Dependency] private EntityQuery _wrappedParcelQuery = default!; /// public override void Initialize() { base.Initialize(); InitializeParcelWrap(); InitializeWrappedParcel(); } /// /// Returns whether or not can be used to wrap . /// /// The entity doing the wrapping. /// The entity to be wrapped. /// True if can be used to wrap , false otherwise. [PublicAPI] public bool IsWrappable(Entity wrapper, EntityUid target) { return // Wrapping cannot wrap itself wrapper.Owner != target && // Wrapper should never be empty, but may as well make sure. !_charges.IsEmpty(wrapper.Owner) && _whitelist.CheckBoth(target, wrapper.Comp.Blacklist, wrapper.Comp.Whitelist) && // If it can't be moved, it shouldn't be able to go into a parcel and picked up. _physicsQuery.TryComp(target, out var physics) && physics.BodyType != BodyType.Static; } }