diff --git a/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs b/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs index 0a5c4d5b01d..b3e5967dc3a 100644 --- a/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs +++ b/Content.Client/Silicons/Borgs/BorgSelectTypeMenu.xaml.cs @@ -23,8 +23,7 @@ public sealed partial class BorgSelectTypeMenu : FancyWindow private BorgTypePrototype? _selectedBorgType; - public event Action>? ConfirmedBorgType; - public event Action>? ConfirmedBorgSubtype; + public event Action? ConfirmedBorgType; // ADT-Tweak: тип и подтип одним событием private static readonly List> GuidebookEntries = new() { "Cyborgs", "Robotics" }; @@ -80,14 +79,8 @@ private void ConfirmButtonPressed(BaseButton.ButtonEventArgs obj) if (_selectedBorgType == null) return; - ConfirmedBorgType?.Invoke(_selectedBorgType); - - //Start ADT Tweak - if (ChassisSpriteSelection.SelectedBorgSubtype == null) - return; - - ConfirmedBorgSubtype?.Invoke(ChassisSpriteSelection.SelectedBorgSubtype); - //End ADT Tweak + // ADT-Tweak: тип и подтип одним событием + ConfirmedBorgType?.Invoke(_selectedBorgType, ChassisSpriteSelection.SelectedBorgSubtype); } private static string PrototypeName(BorgTypePrototype prototype) diff --git a/Content.Client/Silicons/Borgs/BorgSelectTypeUserInterface.cs b/Content.Client/Silicons/Borgs/BorgSelectTypeUserInterface.cs index 605bcc7b5f2..53f620626be 100644 --- a/Content.Client/Silicons/Borgs/BorgSelectTypeUserInterface.cs +++ b/Content.Client/Silicons/Borgs/BorgSelectTypeUserInterface.cs @@ -26,7 +26,8 @@ protected override void Open() base.Open(); _menu = this.CreateWindow(); - _menu.ConfirmedBorgType += prototype => SendMessage(new BorgSelectTypeMessage(prototype)); - _menu.ConfirmedBorgSubtype += subtype => SendMessage(new BorgSelectSubtypeMessage(subtype)); // ADT-Borg-Subtype + // ADT-Tweak: тип и подтип одним сообщением + _menu.ConfirmedBorgType += (prototype, subtype) => SendMessage( + new BorgSelectTypeMessage(prototype, subtype?.ID)); } } diff --git a/Content.Client/Silicons/Borgs/BorgSystem.cs b/Content.Client/Silicons/Borgs/BorgSystem.cs index 09e6e387f78..2c723abc847 100644 --- a/Content.Client/Silicons/Borgs/BorgSystem.cs +++ b/Content.Client/Silicons/Borgs/BorgSystem.cs @@ -1,4 +1,5 @@ -using Content.Shared.Alert; +using Content.Shared.ADT.Silicons.Borgs.Components; +using Content.Shared.Alert; using Content.Shared.Mobs; using Content.Shared.Power.EntitySystems; using Content.Shared.PowerCell; @@ -90,7 +91,9 @@ private void UpdateBorgAppearance(Entity(ent.Owner, out var subtype) || subtype.BorgSubtype == null) + _sprite.LayerSetRsiState((ent.Owner, ent.Comp3), BorgVisualLayers.Light, hasPlayer ? ent.Comp1.HasMindState : ent.Comp1.NoMindState); } private void OnMMIAppearanceChanged(EntityUid uid, MMIComponent component, ref AppearanceChangeEvent args) diff --git a/Content.Server/ADT/Silicons/Borgs/BorgSwitchableSubtypeSystem.cs b/Content.Server/ADT/Silicons/Borgs/BorgSwitchableSubtypeSystem.cs index 966062d7ba9..9b36fcf2eb2 100644 --- a/Content.Server/ADT/Silicons/Borgs/BorgSwitchableSubtypeSystem.cs +++ b/Content.Server/ADT/Silicons/Borgs/BorgSwitchableSubtypeSystem.cs @@ -1,5 +1,6 @@ using Content.Shared.ADT.Silicons.Borgs; using Content.Shared.ADT.Silicons.Borgs.Components; +using Content.Shared.Silicons.Borgs; using Content.Shared.Silicons.Borgs.Components; namespace Content.Server.ADT.Silicons.Borgs; @@ -7,16 +8,27 @@ namespace Content.Server.ADT.Silicons.Borgs; public sealed class BorgSwitchableSubtypeSystem : SharedBorgSwitchableSubtypeSystem { [Dependency] private readonly SharedUserInterfaceSystem _userInterface = default!; + public override void Initialize() { base.Initialize(); - SubscribeLocalEvent(OnSubtypeSelected); + SubscribeLocalEvent(OnTypeSelected); } - private void OnSubtypeSelected(Entity ent, ref BorgSelectSubtypeMessage args) + // ADT-Tweak: подтип выбирается тем же сообщением, что и тип, чтобы модули и скин применялись вместе + private void OnTypeSelected(Entity ent, ref BorgSelectTypeMessage args) { - ent.Comp.BorgSubtype = args.Subtype; + if (args.Subtype is not { } subtype) + return; + + // Тип уже выбран и не совпадает - отклоняем сообщение, чтобы не записать чужой подтип + if (TryComp(ent.Owner, out var typeComp) + && typeComp.SelectedBorgType is { } selected + && selected != args.Prototype) + return; + + ent.Comp.BorgSubtype = subtype; Dirty(ent); UpdateVisuals(ent); _userInterface.CloseUi((ent.Owner, null), BorgSwitchableTypeUiKey.SelectBorgType); diff --git a/Content.Shared/ADT/Silicons/Borgs/BorgSwitchableSubtypeComponent.cs b/Content.Shared/ADT/Silicons/Borgs/BorgSwitchableSubtypeComponent.cs index 665defde9a6..be9bce28b9c 100644 --- a/Content.Shared/ADT/Silicons/Borgs/BorgSwitchableSubtypeComponent.cs +++ b/Content.Shared/ADT/Silicons/Borgs/BorgSwitchableSubtypeComponent.cs @@ -1,6 +1,5 @@ using Robust.Shared.GameStates; using Robust.Shared.Prototypes; -using Robust.Shared.Serialization; namespace Content.Shared.ADT.Silicons.Borgs.Components; @@ -11,9 +10,3 @@ public sealed partial class BorgSwitchableSubtypeComponent : Component [DataField, AutoNetworkedField] public ProtoId? BorgSubtype; } - -[Serializable, NetSerializable] -public sealed class BorgSelectSubtypeMessage(ProtoId subtype) : BoundUserInterfaceMessage -{ - public ProtoId Subtype = subtype; -} diff --git a/Content.Shared/Silicons/Borgs/Components/BorgSwitchableTypeComponent.cs b/Content.Shared/Silicons/Borgs/Components/BorgSwitchableTypeComponent.cs index 9a783d19aa7..ba5feca2b85 100644 --- a/Content.Shared/Silicons/Borgs/Components/BorgSwitchableTypeComponent.cs +++ b/Content.Shared/Silicons/Borgs/Components/BorgSwitchableTypeComponent.cs @@ -1,4 +1,5 @@ using Content.Shared.Actions; +using Content.Shared.ADT.Silicons.Borgs; using Content.Shared.Radio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; @@ -56,10 +57,12 @@ public sealed partial class BorgToggleSelectTypeEvent : InstantActionEvent; /// UI message used by a borg to select their type with . /// /// The borg type prototype that the user selected. +// ADT-Tweak: подтип выбирается тем же сообщением [Serializable, NetSerializable] -public sealed class BorgSelectTypeMessage(ProtoId prototype) : BoundUserInterfaceMessage +public sealed class BorgSelectTypeMessage(ProtoId prototype, ProtoId? subtype = null) : BoundUserInterfaceMessage { public ProtoId Prototype = prototype; + public ProtoId? Subtype = subtype; } ///