using Content.Shared.Clothing.Components;
using Content.Shared.Item.ItemToggle.Components;
namespace Content.Shared.Clothing.EntitySystems;
///
/// On toggle handles the changes to ItemComponent.HeldPrefix. .
///
public sealed class ToggleClothingPrefixSystem : EntitySystem
{
[Dependency] private readonly ClothingSystem _clothing = default!;
///
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(OnToggled);
}
private void OnToggled(Entity ent, ref ItemToggledEvent args)
{
_clothing.SetEquippedPrefix(ent, args.Activated ? ent.Comp.PrefixOn : ent.Comp.PrefixOff);
}
}