From d7ce599baaae92da7fdd9fef605243f354ff1028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aristophan=5F=20=7C=20=D0=98=D0=B2=D0=B0=D0=BD?= Date: Tue, 3 Sep 2024 09:56:51 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=20=D0=BF=D0=BE=D0=BD=D0=B8=D0=BC?= =?UTF-8?q?=D0=B0=D1=8E=20=D0=B4=D0=BE=20=D1=81=D0=B8=D1=85=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=80,=20=D0=B2=20=D1=87=D0=B5=D0=BC=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B1=D0=BB=D0=B5=D0=BC=D0=B0...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChameleonStamp/ChameleonStampSystem.cs | 34 ++++--------------- ...cs => ChameleonStampBoundUserInterface.cs} | 3 +- .../ChameleonStamp/ChameleonStampSystem.cs | 2 +- .../ChameleonStamp/ChameleonStampComponent.cs | 11 +----- .../SharedChameleonStampSystem.cs | 17 +--------- .../Stories/Entities/Objects/stamps.yml | 1 - 6 files changed, 11 insertions(+), 57 deletions(-) rename Content.Client/Stories/ChameleonStamp/UI/{ChameleonBoundUserInterface.cs => ChameleonStampBoundUserInterface.cs} (93%) diff --git a/Content.Client/Stories/ChameleonStamp/ChameleonStampSystem.cs b/Content.Client/Stories/ChameleonStamp/ChameleonStampSystem.cs index 2b4015bc33..ea7b263346 100644 --- a/Content.Client/Stories/ChameleonStamp/ChameleonStampSystem.cs +++ b/Content.Client/Stories/ChameleonStamp/ChameleonStampSystem.cs @@ -13,14 +13,7 @@ public sealed class ChameleonStampSystem : SharedChameleonStampSystem [Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IComponentFactory _factory = default!; - private static readonly SlotFlags[] IgnoredSlots = - { - SlotFlags.PREVENTEQUIP, - SlotFlags.NONE - }; - private static readonly SlotFlags[] Slots = Enum.GetValues().Except(IgnoredSlots).ToArray(); - - private readonly Dictionary> _data = new(); + private readonly List _data = new List(); public override void Initialize() { @@ -47,28 +40,22 @@ private void HandleState(EntityUid uid, ChameleonStampComponent component, ref A protected override void UpdateSprite(EntityUid uid, EntityPrototype proto) { base.UpdateSprite(uid, proto); - Logger.Info($"Обновление спрайта для сущности с UID: {uid}, используя прототип: {proto.ID}"); if (TryComp(uid, out SpriteComponent? sprite) && proto.TryGetComponent(out SpriteComponent? otherSprite, _factory)) { - Logger.Info($"Копирование спрайта из другого спрайт-компонента для UID: {uid}"); sprite.CopyFrom(otherSprite); } } - public IEnumerable GetValidTargets(SlotFlags slot) + public IEnumerable GetValidTargets() { var set = new HashSet(); - Logger.Info($"Получение допустимых целей для слота: {slot}"); - foreach (var availableSlot in _data.Keys) + foreach (var proto in _data) { - if (slot.HasFlag(availableSlot)) - { - Logger.Info($"Добавление целей для слота: {availableSlot}"); - set.UnionWith(_data[availableSlot]); - } + Logger.Info($"Добавление прототипа {proto} в список"); + set.UnionWith(_data); } return set; } @@ -89,15 +76,8 @@ private void PrepareAllVariants() { continue; } - foreach (var slot in Slots) - { - if (!_data.ContainsKey(slot)) - { - _data.Add(slot, new List()); - Logger.Info($"Создан новый слот: {slot}"); - } - _data[slot].Add(proto.ID); - } + _data.Add(proto.ID); + Logger.Info($"Добавлен прототип {proto.ID}"); } } } diff --git a/Content.Client/Stories/ChameleonStamp/UI/ChameleonBoundUserInterface.cs b/Content.Client/Stories/ChameleonStamp/UI/ChameleonStampBoundUserInterface.cs similarity index 93% rename from Content.Client/Stories/ChameleonStamp/UI/ChameleonBoundUserInterface.cs rename to Content.Client/Stories/ChameleonStamp/UI/ChameleonStampBoundUserInterface.cs index fad8f59ac8..395e3cace5 100644 --- a/Content.Client/Stories/ChameleonStamp/UI/ChameleonBoundUserInterface.cs +++ b/Content.Client/Stories/ChameleonStamp/UI/ChameleonStampBoundUserInterface.cs @@ -4,7 +4,6 @@ using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Client.UserInterface; -using Content.Client.Stories.ChameleonStamp; using Content.Shared.Stories.ChameleonStamp; namespace Content.Client.Stories.ChameleonStamp.UI; @@ -38,7 +37,7 @@ protected override void UpdateState(BoundUserInterfaceState state) return; } Logger.Info($"Проверка стейтов пройдена."); - var targets = _chameleon.GetValidTargets(st.Slot); + var targets = _chameleon.GetValidTargets(); _menu?.UpdateState(targets, st.SelectedId); } diff --git a/Content.Server/Stories/ChameleonStamp/ChameleonStampSystem.cs b/Content.Server/Stories/ChameleonStamp/ChameleonStampSystem.cs index ba754947ec..eda35b1d6c 100644 --- a/Content.Server/Stories/ChameleonStamp/ChameleonStampSystem.cs +++ b/Content.Server/Stories/ChameleonStamp/ChameleonStampSystem.cs @@ -62,7 +62,7 @@ private void UpdateUi(EntityUid uid, ChameleonStampComponent? component = null) if (!Resolve(uid, ref component)) return; - var state = new ChameleonStampBoundUserInterfaceState(component.Slot, component.Default); + var state = new ChameleonStampBoundUserInterfaceState(component.Default); _uiSystem.SetUiState(uid, ChameleonUiKey.Key, state); } diff --git a/Content.Shared/Stories/ChameleonStamp/ChameleonStampComponent.cs b/Content.Shared/Stories/ChameleonStamp/ChameleonStampComponent.cs index 653e3b6254..3d4b1c1068 100644 --- a/Content.Shared/Stories/ChameleonStamp/ChameleonStampComponent.cs +++ b/Content.Shared/Stories/ChameleonStamp/ChameleonStampComponent.cs @@ -13,13 +13,6 @@ namespace Content.Shared.Stories.ChameleonStamp; [Access(typeof(SharedChameleonStampSystem))] public sealed partial class ChameleonStampComponent : Component { - /// - /// Filter possible chameleon options by their slot flag. - /// - [ViewVariables(VVAccess.ReadOnly)] - [DataField(required: true)] - public SlotFlags Slot = SlotFlags.All; - /// /// EntityPrototype id that chameleon item is trying to mimic. /// @@ -37,12 +30,10 @@ public sealed partial class ChameleonStampComponent : Component [Serializable, NetSerializable] public sealed class ChameleonStampBoundUserInterfaceState : BoundUserInterfaceState { - public readonly SlotFlags Slot; public readonly string? SelectedId; - public ChameleonStampBoundUserInterfaceState(SlotFlags slot, string? selectedId) + public ChameleonStampBoundUserInterfaceState(string? selectedId) { - Slot = slot; SelectedId = selectedId; } } diff --git a/Content.Shared/Stories/ChameleonStamp/SharedChameleonStampSystem.cs b/Content.Shared/Stories/ChameleonStamp/SharedChameleonStampSystem.cs index 20629a4d1a..3da8f726d3 100644 --- a/Content.Shared/Stories/ChameleonStamp/SharedChameleonStampSystem.cs +++ b/Content.Shared/Stories/ChameleonStamp/SharedChameleonStampSystem.cs @@ -61,22 +61,7 @@ protected void UpdateVisuals(EntityUid uid, ChameleonStampComponent component) // world sprite icon UpdateSprite(uid, proto); - // copy name and description, unless its an ID card - if (!HasComp(uid)) - { - var meta = MetaData(uid); - _metaData.SetEntityName(uid, proto.Name, meta); - _metaData.SetEntityDescription(uid, proto.Description, meta); - } - - // item sprite logic - if (TryComp(uid, out ItemComponent? item) && - proto.TryGetComponent(out ItemComponent? otherItem, _factory)) - { - _itemSystem.CopyVisuals(uid, otherItem, item); - } - - // clothing sprite logic + // sta sprite logic if (TryComp(uid, out StampComponent? stamp) && proto.TryGetComponent("Stamp", out StampComponent? otherStamp)) { diff --git a/Resources/Prototypes/Stories/Entities/Objects/stamps.yml b/Resources/Prototypes/Stories/Entities/Objects/stamps.yml index 4d094061dc..8d272e43f8 100644 --- a/Resources/Prototypes/Stories/Entities/Objects/stamps.yml +++ b/Resources/Prototypes/Stories/Entities/Objects/stamps.yml @@ -25,7 +25,6 @@ components: - type: ChameleonStamp default: RubberStampBase - slot: [all] - type: UserInterface interfaces: enum.ChameleonUiKey.Key: