можно видеть звание если надет значок (#394)

This commit is contained in:
Pupchansky
2025-11-22 18:38:00 +05:00
committed by GitHub
parent 21bdbc5361
commit 578c48221f
5 changed files with 72 additions and 1 deletions

View File

@@ -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<RenameOnInteractComponent?> item)

View File

@@ -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;
}

View File

@@ -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<InventoryComponent, ExaminedEvent>(OnExamine);
}
private void OnExamine(EntityUid ent, InventoryComponent comp, ExaminedEvent ev)
{
if (!_inventorySystem.TryGetInventoryEntity<SecurityBadgeComponent>((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);
}
}

View File

@@ -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 = Майор

View File

@@ -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