mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-02-15 03:31:38 +01:00
можно видеть звание если надет значок (#394)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
25
Content.Server/_WL/Security/Systems/SecurityBadgeSystem.cs
Normal file
25
Content.Server/_WL/Security/Systems/SecurityBadgeSystem.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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 = Майор
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user