diff --git a/Content.Server/_WL/MetaData/Systems/RenameableSystem.cs b/Content.Server/_WL/MetaData/Systems/RenameableSystem.cs index 1d1e5df175..5eec3b487f 100644 --- a/Content.Server/_WL/MetaData/Systems/RenameableSystem.cs +++ b/Content.Server/_WL/MetaData/Systems/RenameableSystem.cs @@ -26,6 +26,7 @@ public sealed partial class RenameableSystem : EntitySystem private static readonly ResPath VerbTexturePath = new("/Textures/Interface/AdminActions/rename.png"); + // TODO: вынести в поле в компоненте private const int NewNameMaxLength = 40; public override void Initialize() @@ -73,9 +74,10 @@ public sealed partial class RenameableSystem : EntitySystem return true; } + // TODO: тоже заполнить компонент уточняющими свойствами. деспэйр public string FormatNewName(string str) { - return str.ToLower(); + return str; } public bool TryOpenDialog(ICommonSession session, Entity item) diff --git a/Content.Server/_WL/Security/Components/SecurityBadgeComponent.cs b/Content.Server/_WL/Security/Components/SecurityBadgeComponent.cs new file mode 100644 index 0000000000..fa0fb1f26f --- /dev/null +++ b/Content.Server/_WL/Security/Components/SecurityBadgeComponent.cs @@ -0,0 +1,12 @@ +using Content.Shared.Inventory; + +namespace Content.Server._WL.Security.Components; + +[RegisterComponent] +public sealed partial class SecurityBadgeComponent : Component, IClothingSlots +{ + [DataField(required: true)] + public LocId RankLoc { get; set; } + + public SlotFlags Slots => SlotFlags.NECK; +} diff --git a/Content.Server/_WL/Security/Systems/SecurityBadgeSystem.cs b/Content.Server/_WL/Security/Systems/SecurityBadgeSystem.cs new file mode 100644 index 0000000000..42c25d952a --- /dev/null +++ b/Content.Server/_WL/Security/Systems/SecurityBadgeSystem.cs @@ -0,0 +1,25 @@ +using Content.Server._WL.Security.Components; +using Content.Shared.Examine; +using Content.Shared.Inventory; + +namespace Content.Server._WL.Security.Systems; + +public sealed partial class SecurityBadgeSystem : EntitySystem +{ + [Dependency] private readonly InventorySystem _inventorySystem = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnExamine); + } + + private void OnExamine(EntityUid ent, InventoryComponent comp, ExaminedEvent ev) + { + if (!_inventorySystem.TryGetInventoryEntity((ent, comp), out var badgeEnt) || badgeEnt.Comp == null) + return; + + ev.PushMarkup(Loc.GetString("security-badge-component-rank-description", ("loc", Loc.GetString(badgeEnt.Comp.RankLoc))), -2); + } +} diff --git a/Resources/Locale/ru-RU/_WL/security/security_badges_component.ftl b/Resources/Locale/ru-RU/_WL/security/security_badges_component.ftl new file mode 100644 index 0000000000..89d6edbd1f --- /dev/null +++ b/Resources/Locale/ru-RU/_WL/security/security_badges_component.ftl @@ -0,0 +1,11 @@ +security-badge-component-rank-description = На груди висит значок со званием [bold]{$loc}[/bold]. +security-badge-rank-private = Рядовой +security-badge-rank-corporal = Капрал +security-badge-rank-sub-sergeant = Суб-сержант +security-badge-rank-sergeant = Сержант +security-badge-rank-chief-sergeant = Обер-сержант +security-badge-rank-sub-lieutenant = Суб-лейтенант +security-badge-rank-lieutenant = Лейтенант +security-badge-rank-chief-lieutenant = Обер-лейтенант +security-badge-rank-captain = Капитан +security-badge-rank-major = Майор diff --git a/Resources/Prototypes/_WL/Entities/Clothing/Neck/Pins/security_pins.yml b/Resources/Prototypes/_WL/Entities/Clothing/Neck/Pins/security_pins.yml index 84cc58c1c8..0fb229c3fd 100644 --- a/Resources/Prototypes/_WL/Entities/Clothing/Neck/Pins/security_pins.yml +++ b/Resources/Prototypes/_WL/Entities/Clothing/Neck/Pins/security_pins.yml @@ -6,6 +6,7 @@ - type: LimitedCharges maxCharges: 1 showExamineInfo: false + - type: SecurityBadge - type: RenameOnInteract - type: Sprite sprite: _WL/Clothing/Neck/Pins/security_badges.rsi @@ -24,6 +25,8 @@ components: - type: Sprite state: icon-yel + - type: SecurityBadge + rankLoc: security-badge-rank-private - type: Clothing equippedPrefix: yel @@ -33,6 +36,8 @@ components: - type: Sprite state: icon-oranyel + - type: SecurityBadge + rankLoc: security-badge-rank-corporal - type: Clothing equippedPrefix: oranyel @@ -41,6 +46,8 @@ parent: ClothingNeckSecurityPinBase id: ClothingNeckSecuritySubSergeantPin components: + - type: SecurityBadge + rankLoc: security-badge-rank-sub-sergeant - type: Sprite state: icon-oran - type: Clothing @@ -50,6 +57,8 @@ parent: ClothingNeckSecurityPinBase id: ClothingNeckSecuritySergeantPin components: + - type: SecurityBadge + rankLoc: security-badge-rank-sergeant - type: Sprite state: icon-greoran - type: Clothing @@ -61,6 +70,8 @@ components: - type: Sprite state: icon-gre + - type: SecurityBadge + rankLoc: security-badge-rank-chief-sergeant - type: Clothing equippedPrefix: gre @@ -70,6 +81,8 @@ components: - type: Sprite state: icon-blugre + - type: SecurityBadge + rankLoc: security-badge-rank-sub-lieutenant - type: Clothing equippedPrefix: blugre @@ -80,6 +93,8 @@ components: - type: Sprite state: icon-blu + - type: SecurityBadge + rankLoc: security-badge-rank-lieutenant - type: Clothing equippedPrefix: blu @@ -89,6 +104,8 @@ components: - type: Sprite state: icon-purblu + - type: SecurityBadge + rankLoc: security-badge-rank-chief-lieutenant - type: Clothing equippedPrefix: purblu @@ -99,6 +116,8 @@ components: - type: Sprite state: icon-pur + - type: SecurityBadge + rankLoc: security-badge-rank-captain - type: Clothing equippedPrefix: pur @@ -108,5 +127,7 @@ components: - type: Sprite state: icon-cya + - type: SecurityBadge + rankLoc: security-badge-rank-major - type: Clothing equippedPrefix: cya