QoL для ХоПа (#369)

* add: nice job icons ui for HoP console

* Ebanniy rot

* add: Changing id visuals with HoP console

* cleanup

* add: remove drop down list and replace it with icon-buttons

* add: colored and sorted by department buttons

* add: columns

* tweak: nicer colors

* cleanup
This commit is contained in:
ThereDrD0
2024-06-20 22:29:26 +03:00
committed by GitHub
parent 76e46de7e9
commit cb37ba5714
12 changed files with 332 additions and 122 deletions

View File

@@ -13,6 +13,7 @@ namespace Content.Client.Access.UI;
public sealed partial class AccessLevelControl : GridContainer public sealed partial class AccessLevelControl : GridContainer
{ {
public readonly Dictionary<ProtoId<AccessLevelPrototype>, Button> ButtonsList = new(); public readonly Dictionary<ProtoId<AccessLevelPrototype>, Button> ButtonsList = new();
public readonly List<Dictionary<ProtoId<AccessLevelPrototype>, Button>> ButtonGroups = new ();
public AccessLevelControl() public AccessLevelControl()
{ {
@@ -39,6 +40,61 @@ public sealed partial class AccessLevelControl : GridContainer
} }
} }
public void PopulateForConsole(List<List<ProtoId<AccessLevelPrototype>>> accessLevels, IPrototypeManager prototypeManager)
{
var departmentColors = new List<String> // Colors from StyleNano.cs
{
"ButtonColorCommandDepartment",
"ButtonColorSecurityDepartment",
"ButtonColorMedicalDepartment",
"ButtonColorEngineeringDepartment",
"ButtonColorResearchingDepartment",
"ButtonColorCargoDepartment",
"ButtonColorServiceDepartment"
};
var currentColorIndex = 0;
foreach (var department in accessLevels)
{
Dictionary<ProtoId<AccessLevelPrototype>, Button> buttons = new();
foreach (var access in department)
{
if (!prototypeManager.TryIndex(access, out var accessLevel))
{
Logger.Error($"Unable to find accesslevel for {access}");
continue;
}
var newButton = new Button
{
Text = accessLevel.GetAccessLevelName(),
ToggleMode = true,
};
newButton.AddStyleClass(departmentColors[currentColorIndex]);
buttons.Add(accessLevel.ID, newButton);
}
ButtonGroups.Add(buttons);
currentColorIndex++;
}
}
public void UpdateStateConsole(
List<ProtoId<AccessLevelPrototype>> pressedList,
List<ProtoId<AccessLevelPrototype>>? enabledList = null)
{
foreach (var department in ButtonGroups)
{
foreach (var (accessName, button) in department)
{
button.Pressed = pressedList.Contains(accessName);
button.Disabled = !(enabledList?.Contains(accessName) ?? true);
}
}
}
public void UpdateState( public void UpdateState(
List<ProtoId<AccessLevelPrototype>> pressedList, List<ProtoId<AccessLevelPrototype>> pressedList,
List<ProtoId<AccessLevelPrototype>>? enabledList = null) List<ProtoId<AccessLevelPrototype>>? enabledList = null)

View File

@@ -23,15 +23,15 @@ namespace Content.Client.Access.UI
protected override void Open() protected override void Open()
{ {
base.Open(); base.Open();
List<ProtoId<AccessLevelPrototype>> accessLevels; List<List<ProtoId<AccessLevelPrototype>>> accessLevels;
if (EntMan.TryGetComponent<IdCardConsoleComponent>(Owner, out var idCard)) if (EntMan.TryGetComponent<IdCardConsoleComponent>(Owner, out var idCard))
{ {
accessLevels = idCard.AccessLevels; accessLevels = idCard.AccessLevelsConsole;
} }
else else
{ {
accessLevels = new List<ProtoId<AccessLevelPrototype>>(); accessLevels = new List<List<ProtoId<AccessLevelPrototype>>>();
_idCardConsoleSystem.Log.Error($"No IdCardConsole component found for {EntMan.ToPrettyString(Owner)}!"); _idCardConsoleSystem.Log.Error($"No IdCardConsole component found for {EntMan.ToPrettyString(Owner)}!");
} }

View File

@@ -26,16 +26,13 @@
<Button Name="JobTitleSaveButton" Text="{Loc 'id-card-console-window-save-button'}" Disabled="True" /> <Button Name="JobTitleSaveButton" Text="{Loc 'id-card-console-window-save-button'}" Disabled="True" />
</GridContainer> </GridContainer>
<Control MinSize="0 8" /> <Control MinSize="0 8" />
<GridContainer Columns="2"> <GridContainer Name="AccessLevelControlContainer" Columns="7" HorizontalExpand="True" HorizontalAlignment="Center" >
<Label Text="{Loc 'id-card-console-window-job-selection-label'}" />
<OptionButton Name="JobPresetOptionButton" />
</GridContainer>
<Control Name="AccessLevelControlContainer" />
<!-- WD EDIT --> <!-- WD EDIT -->
</GridContainer>
<GridContainer Name="CurrentJobIcon" Columns="2"> <GridContainer Name="CurrentJobIcon" Columns="2">
<Label Text="Текущая выбранная иконка для роли: " /> <Label Text="Текущая выбранная иконка для роли: " />
</GridContainer> </GridContainer>
<GridContainer Name="JobIconsGrid" Columns="10" HorizontalAlignment="Center"> <GridContainer Name="JobIconsGrid" HorizontalAlignment="Center">
<!-- Job icon buttons are generated in the code --> <!-- Job icon buttons are generated in the code -->
</GridContainer> </GridContainer>
<!-- WD EDIT END --> <!-- WD EDIT END -->

View File

@@ -24,9 +24,11 @@ namespace Content.Client.Access.UI
private readonly IdCardConsoleBoundUserInterface _owner; private readonly IdCardConsoleBoundUserInterface _owner;
private AccessLevelControl _accessButtons = new(); private GridContainer _grid = default!;
private readonly AccessLevelControl _groupAccessButtons = new();
private readonly Dictionary<string, TextureButton> _jobIconButtons = new(); //WD-EDIT private readonly Dictionary<string, TextureButton> _jobIconButtons = new(); //WD-EDIT
private readonly List<string> _jobPrototypeIds = new(); private string _newJob = "";
private string? _lastFullName; private string? _lastFullName;
private string? _lastJobTitle; private string? _lastJobTitle;
@@ -36,7 +38,7 @@ namespace Content.Client.Access.UI
public IdCardConsoleWindow( public IdCardConsoleWindow(
IdCardConsoleBoundUserInterface owner, IdCardConsoleBoundUserInterface owner,
IPrototypeManager prototypeManager, IPrototypeManager prototypeManager,
List<ProtoId<AccessLevelPrototype>> accessLevels) List<List<ProtoId<AccessLevelPrototype>>> accessLevels)
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
@@ -59,26 +61,20 @@ namespace Content.Client.Access.UI
JobTitleSaveButton.OnPressed += _ => SubmitData(); JobTitleSaveButton.OnPressed += _ => SubmitData();
var jobs = _prototypeManager.EnumeratePrototypes<JobPrototype>().ToList(); _groupAccessButtons.PopulateForConsole(accessLevels, prototypeManager);
jobs.Sort((x, y) => string.Compare(x.LocalizedName, y.LocalizedName, StringComparison.CurrentCulture));
foreach (var job in jobs) foreach (var department in _groupAccessButtons.ButtonGroups)
{ {
if (!job.OverrideConsoleVisibility.GetValueOrDefault(job.SetPreference)) var departmentGrid = new GridContainer {};
foreach (var button in department.Values)
{ {
continue; departmentGrid.AddChild(button);
} }
AccessLevelControlContainer.AddChild(departmentGrid);
_jobPrototypeIds.Add(job.ID);
JobPresetOptionButton.AddItem(Loc.GetString(job.Name), _jobPrototypeIds.Count - 1);
} }
JobPresetOptionButton.OnItemSelected += SelectJobPreset;
_accessButtons.Populate(accessLevels, prototypeManager); foreach (var (id, button) in _groupAccessButtons.ButtonsList)
AccessLevelControlContainer.AddChild(_accessButtons);
foreach (var (id, button) in _accessButtons.ButtonsList)
{ {
button.OnPressed += _ => SubmitData(); button.OnPressed += _ => SubmitData();
} }
@@ -92,72 +88,89 @@ namespace Content.Client.Access.UI
if (rsi == null) if (rsi == null)
return; return;
foreach (var jobIcon in idConsoleComponent.JobIcons) foreach (var department in idConsoleComponent.JobIcons)
{ {
var newButton = new TextureButton _grid = new GridContainer
{ {
TextureNormal = rsi.RSI.TryGetState(jobIcon, out var state) ? state.Frame0 Columns = department.Count
: rsi.RSI.TryGetState("CustomId", out var customState) ? customState.Frame0
: null,
Scale = new Vector2(5, 5)
}; };
foreach (var jobIcon in department)
_jobIconButtons.Add(jobIcon, newButton);
newButton.OnPressed += _ =>
{ {
_lastJobIcon = "JobIcon" + jobIcon; var newButton = new TextureButton
SubmitData(); {
}; TextureNormal = rsi.RSI.TryGetState(jobIcon, out var state) ? state.Frame0
: rsi.RSI.TryGetState("CustomId", out var customState) ? customState.Frame0
: null,
Scale = new Vector2(5, 5)
};
JobIconsGrid.AddChild(newButton); _jobIconButtons.TryAdd(jobIcon, newButton);
newButton.OnPressed += _ =>
{
SelectJobPreset(jobIcon);
_newJob = jobIcon;
_lastJobIcon = "JobIcon" + jobIcon;
SubmitData();
};
_grid.AddChild(newButton);
}
JobIconsGrid.AddChild(_grid);
} }
//WD-EDIT //WD-EDIT
} }
private void ClearAllAccess() private void ClearAllAccess()
{ {
foreach (var button in _accessButtons.ButtonsList.Values) foreach (var group in _groupAccessButtons.ButtonGroups)
{ {
if (button.Pressed) foreach (var button in group.Values)
{ {
button.Pressed = false; if (button.Pressed)
{
button.Pressed = false;
}
} }
} }
} }
private void SelectJobPreset(OptionButton.ItemSelectedEventArgs args) private void SelectJobPreset(string jobName)
{ {
if (!_prototypeManager.TryIndex(_jobPrototypeIds[args.Id], out JobPrototype? job)) if (!_prototypeManager.TryIndex(jobName, out JobPrototype? job))
{ {
return; return;
} }
JobTitleLineEdit.Text = Loc.GetString(job.Name); JobTitleLineEdit.Text = Loc.GetString(job.Name);
args.Button.SelectId(args.Id);
ClearAllAccess(); ClearAllAccess();
// this is a sussy way to do this // this is a sussy way to do this
foreach (var access in job.Access) foreach (var access in job.Access)
{ {
if (_accessButtons.ButtonsList.TryGetValue(access, out var button) && !button.Disabled) foreach (var group in _groupAccessButtons.ButtonGroups)
{ {
button.Pressed = true; if (group.TryGetValue(access, out var button) && !button.Disabled)
{
button.Pressed = true;
}
} }
} }
foreach (var group in job.AccessGroups) foreach (var group in job.AccessGroups)
{ {
if (!_prototypeManager.TryIndex(group, out AccessGroupPrototype? groupPrototype)) if (!_prototypeManager.TryIndex(group, out AccessGroupPrototype? groupPrototype))
{
continue; continue;
}
foreach (var access in groupPrototype.Tags) foreach (var access in groupPrototype.Tags)
{ {
if (_accessButtons.ButtonsList.TryGetValue(access, out var button) && !button.Disabled) foreach (var buttonGroup in _groupAccessButtons.ButtonGroups)
{ {
button.Pressed = true; if (buttonGroup.TryGetValue(access, out var button) && !button.Disabled)
button.Pressed = true;
} }
} }
} }
@@ -204,19 +217,12 @@ namespace Content.Client.Access.UI
JobTitleSaveButton.Disabled = !interfaceEnabled || !jobTitleDirty; JobTitleSaveButton.Disabled = !interfaceEnabled || !jobTitleDirty;
JobPresetOptionButton.Disabled = !interfaceEnabled;
_accessButtons.UpdateState(state.TargetIdAccessList?.ToList() ?? _groupAccessButtons.UpdateStateConsole(state.TargetIdAccessList?.ToList() ??
new List<ProtoId<AccessLevelPrototype>>(), new List<ProtoId<AccessLevelPrototype>>(),
state.AllowedModifyAccessList?.ToList() ?? state.AllowedModifyAccessList?.ToList() ??
new List<ProtoId<AccessLevelPrototype>>()); new List<ProtoId<AccessLevelPrototype>>());
var jobIndex = _jobPrototypeIds.IndexOf(state.TargetIdJobPrototype);
if (jobIndex >= 0)
{
JobPresetOptionButton.SelectId(jobIndex);
}
//WD-EDIT //WD-EDIT
if (_resource.TryGetResource(new ResPath("/Textures/Interface/Misc/job_icons.rsi"), out RSIResource? rsi)) if (_resource.TryGetResource(new ResPath("/Textures/Interface/Misc/job_icons.rsi"), out RSIResource? rsi))
{ {
@@ -234,7 +240,6 @@ namespace Content.Client.Access.UI
: rsi.RSI.TryGetState("CustomId", out var customState) : rsi.RSI.TryGetState("CustomId", out var customState)
? customState.Frame0 ? customState.Frame0
: null, : null,
TextureScale = new Vector2(4, 4) TextureScale = new Vector2(4, 4)
}; };
@@ -256,15 +261,18 @@ namespace Content.Client.Access.UI
private void SubmitData() private void SubmitData()
{ {
// Don't send this if it isn't dirty. // Don't send this if it isn't dirty.
var jobProtoDirty = _lastJobProto != null && var jobProtoDirty = _lastJobProto != null && _newJob != _lastJobProto;
_jobPrototypeIds[JobPresetOptionButton.SelectedId] != _lastJobProto;
_owner.SubmitData( _owner.SubmitData(
FullNameLineEdit.Text, FullNameLineEdit.Text,
JobTitleLineEdit.Text, JobTitleLineEdit.Text,
// Iterate over the buttons dictionary, filter by `Pressed`, only get key from the key/value pair // Iterate over the buttons dictionary, filter by `Pressed`, only get key from the key/value pair
_accessButtons.ButtonsList.Where(x => x.Value.Pressed).Select(x => x.Key).ToList(), _groupAccessButtons.ButtonGroups
jobProtoDirty ? _jobPrototypeIds[JobPresetOptionButton.SelectedId] : string.Empty, .SelectMany(dict => dict)
.Where(x => x.Value.Pressed)
.Select(x => x.Key)
.ToList(),
jobProtoDirty ? _newJob : string.Empty,
_lastJobIcon); _lastJobIcon);
} }
} }

View File

@@ -158,6 +158,16 @@ namespace Content.Client.Stylesheets
public const string StyleClassButtonColorGreen = "ButtonColorGreen"; public const string StyleClassButtonColorGreen = "ButtonColorGreen";
public const string StyleClassButtonColorPurple = "ButtonColorPurple"; public const string StyleClassButtonColorPurple = "ButtonColorPurple";
// WD - HoP console
public static readonly Color ButtonColorCommand = Color.FromHex("#436BAD");
public static readonly Color ButtonColorSecurity = Color.FromHex("#BF5454");
public static readonly Color ButtonColorMedical = Color.FromHex("#4494C8");
public static readonly Color ButtonColorEngineering = Color.FromHex("#FDA55E");
public static readonly Color ButtonColorCargo = Color.FromHex("#9E6A34");
public static readonly Color ButtonColorResearching = Color.FromHex("#984EB4");
public static readonly Color ButtonColorService = Color.FromHex("#40A166");
public override Stylesheet Stylesheet { get; } public override Stylesheet Stylesheet { get; }
public StyleNano(IResourceCache resCache) : base(resCache) public StyleNano(IResourceCache resCache) : base(resCache)
@@ -1340,6 +1350,55 @@ namespace Content.Client.Stylesheets
{ {
new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14), new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14),
}), }),
// WD - HoP conlose
new StyleRule(
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
new[]
{
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorCommand),
}),
new StyleRule(
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
new[]
{
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorSecurity),
}),
new StyleRule(
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
new[]
{
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorMedical),
}),
new StyleRule(
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
new[]
{
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorEngineering),
}),
new StyleRule(
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
new[]
{
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorService),
}),
new StyleRule(
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
new[]
{
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorResearching),
}),
new StyleRule(
new SelectorElement(typeof(MenuButton), new[] {MenuButton.StyleClassRedTopButton}, null, new[] {Button.StylePseudoClassNormal}),
new[]
{
new StyleProperty(Button.StylePropertyModulateSelf, ButtonColorCargo),
}),
// NanoHeading // NanoHeading
@@ -1576,6 +1635,44 @@ namespace Content.Client.Stylesheets
.Prop(Control.StylePropertyModulateSelf, ButtonColorHoveredRed), .Prop(Control.StylePropertyModulateSelf, ButtonColorHoveredRed),
// --- // ---
// WD - HoP console
Element<Button>().Class("ButtonColorCommandDepartment")
.Prop(Control.StylePropertyModulateSelf, ButtonColorCommand),
Element<Button>().Class("ButtonColorCommandDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorCommand),
Element<Button>().Class("ButtonColorSecurityDepartment")
.Prop(Control.StylePropertyModulateSelf, ButtonColorSecurity),
Element<Button>().Class("ButtonColorSecurityDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorSecurity),
Element<Button>().Class("ButtonColorMedicalDepartment")
.Prop(Control.StylePropertyModulateSelf, ButtonColorMedical),
Element<Button>().Class("ButtonColorMedicalDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorMedical),
Element<Button>().Class("ButtonColorEngineeringDepartment")
.Prop(Control.StylePropertyModulateSelf, ButtonColorEngineering),
Element<Button>().Class("ButtonColorEngineeringDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorEngineering),
Element<Button>().Class("ButtonColorResearchingDepartment")
.Prop(Control.StylePropertyModulateSelf, ButtonColorResearching),
Element<Button>().Class("ButtonColorResearchingDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorResearching),
Element<Button>().Class("ButtonColorServiceDepartment")
.Prop(Control.StylePropertyModulateSelf, ButtonColorService),
Element<Button>().Class("ButtonColorServiceDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorService),
Element<Button>().Class("ButtonColorCargoDepartment")
.Prop(Control.StylePropertyModulateSelf, ButtonColorCargo),
Element<Button>().Class("ButtonColorCargoDepartment").Pseudo(ContainerButton.StylePseudoClassNormal)
.Prop(Control.StylePropertyModulateSelf, ButtonColorCargo),
// ---
// Green Button --- // Green Button ---
Element<Button>().Class("ButtonColorGreen") Element<Button>().Class("ButtonColorGreen")
.Prop(Control.StylePropertyModulateSelf, ButtonColorGoodDefault), .Prop(Control.StylePropertyModulateSelf, ButtonColorGoodDefault),

View File

@@ -145,7 +145,12 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
if (newJobIcon != null && _prototype.TryIndex<StatusIconPrototype>(newJobIcon, out var jobIcon)) // WD EDIT END if (newJobIcon != null && _prototype.TryIndex<StatusIconPrototype>(newJobIcon, out var jobIcon)) // WD EDIT END
{ {
_idCard.TryChangeJobIcon(targetId, jobIcon, player: player); _idCard.TryChangeJobIcon(targetId, jobIcon, player: player);
_idCard.TryChangeJobDepartment(targetId, job!); _idCard.TryChangeVisuals(targetId, newJobIcon);
}
if (job != null)
{
_idCard.TryChangeJobDepartment(targetId, job);
} }
if (!newAccessList.TrueForAll(x => component.AccessLevels.Contains(x))) if (!newAccessList.TrueForAll(x => component.AccessLevels.Contains(x)))

View File

@@ -2,6 +2,7 @@ using System.Linq;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Kitchen.Components; using Content.Server.Kitchen.Components;
using Content.Server.Popups; using Content.Server.Popups;
using Content.Shared._White.NiceIdCards;
using Content.Shared.Access; using Content.Shared.Access;
using Content.Shared.Access.Components; using Content.Shared.Access.Components;
using Content.Shared.Access.Systems; using Content.Shared.Access.Systems;
@@ -9,6 +10,7 @@ using Content.Shared.Database;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Roles; using Content.Shared.Roles;
using Content.Shared.StatusIcon; using Content.Shared.StatusIcon;
using Robust.Server.GameObjects;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Random; using Robust.Shared.Random;
@@ -21,6 +23,7 @@ public sealed class IdCardSystem : SharedIdCardSystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly MetaDataSystem _metaSystem = default!; [Dependency] private readonly MetaDataSystem _metaSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _sharedAppearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -144,6 +147,17 @@ public sealed class IdCardSystem : SharedIdCardSystem
return true; return true;
} }
public bool TryChangeVisuals(EntityUid uid, string jobIconName, IdCardComponent? id = null)
{
if (!Resolve(uid, ref id))
return false;
var name = jobIconName.Replace("JobIcon", "");
_sharedAppearance.SetData(uid, IdVisuals.State, name);
return true;
}
public bool TryChangeJobDepartment(EntityUid uid, JobPrototype job, IdCardComponent? id = null) public bool TryChangeJobDepartment(EntityUid uid, JobPrototype job, IdCardComponent? id = null)
{ {
if (!Resolve(uid, ref id)) if (!Resolve(uid, ref id))

View File

@@ -30,7 +30,7 @@ public sealed partial class IdCardConsoleComponent : Component
public readonly List<ProtoId<AccessLevelPrototype>> AccessList; public readonly List<ProtoId<AccessLevelPrototype>> AccessList;
public readonly ProtoId<AccessLevelPrototype> JobPrototype; public readonly ProtoId<AccessLevelPrototype> JobPrototype;
public readonly string? SelectedIcon; //WD-EDIT public readonly string? SelectedIcon; //WD-EDIT
public WriteToTargetIdMessage(string fullName, string jobTitle, List<ProtoId<AccessLevelPrototype>> accessList, ProtoId<AccessLevelPrototype> jobPrototype, public WriteToTargetIdMessage(string fullName, string jobTitle, List<ProtoId<AccessLevelPrototype>> accessList, ProtoId<AccessLevelPrototype> jobPrototype,
string? selectedIcon) string? selectedIcon)
{ {
@@ -79,63 +79,35 @@ public sealed partial class IdCardConsoleComponent : Component
"Theatre" "Theatre"
}; };
//WD-EDIT // WD edit
[DataField("jobIcons")] [DataField, AutoNetworkedField]
public List<string> JobIcons = new() public List<List<ProtoId<AccessLevelPrototype>>> AccessLevelsConsole = new()
{ {
"AtmosphericTechnician", new List<ProtoId<AccessLevelPrototype>> {"Captain", "HeadOfPersonnel", "HeadOfSecurity", "ChiefMedicalOfficer", "ChiefEngineer", "ResearchDirector", "Command"}, // Command
"Bartender", new List<ProtoId<AccessLevelPrototype>> {"Armory", "Brig", "Security","Detective", "Lawyer"}, // Security
"Borg", new List<ProtoId<AccessLevelPrototype>> {"Chemistry", "Cryogenics", "Medical"}, // Medical
"Botanist", new List<ProtoId<AccessLevelPrototype>> {"Atmospherics", "Engineering", "External", "Maintenance"}, // Engineering
"Boxer", new List<ProtoId<AccessLevelPrototype>> {"Research"}, // Researching
"Brigmedic", new List<ProtoId<AccessLevelPrototype>> {"Cargo", "Salvage"}, // Cargo
"Captain", new List<ProtoId<AccessLevelPrototype>> { "Service", "Theatre", "Bar", "Chapel", "Hydroponics", "Janitor", "Kitchen"} // Service
"CargoTechnician", };
"Chaplain",
"Chef", //WD-EDIT
"Chemist", // Command, Service, Security, Medical, Engineering, Researching, Cargo,
"ChiefEngineer", [DataField("jobIcons")]
"ChiefMedicalOfficer", public List<List<string>> JobIcons = new()
"Clown", {
"CustomId", new List<string> {"Captain", "HeadOfPersonnel", "HeadOfSecurity", "ChiefMedicalOfficer", "ChiefEngineer", "ResearchDirector", "QuarterMaster", "Inspector"},
"Detective", new List<string> {"HeadOfPersonnel", "Lawyer", "Clown", "Bartender", "Reporter", "Chef", "Botanist", "ServiceWorker", "Zookeeper", "Musician", "Librarian", "Janitor", "Chaplain", "Mime", "Boxer", "Passenger", "Visitor", "Borg", "CustomId"},
"Geneticist", new List<string> {"HeadOfSecurity", "Warden", "SeniorOfficer", "SecurityOfficer", "Detective", "SecurityCadet", "Brigmedic", "Lawyer"},
"HeadOfPersonnel", new List<string> {"ChiefMedicalOfficer", "SeniorPhysician", "Paramedic", "Chemist", "MedicalDoctor", "Virologist", "Geneticist", "MedicalIntern", "Psychologist"},
"HeadOfSecurity", new List<string> {"ChiefEngineer", "SeniorEngineer", "AtmosphericTechnician", "StationEngineer", "TechnicalAssistant"},
"Inspector", new List<string> {"ResearchDirector", "SeniorResearcher", "Scientist", "Roboticist", "ResearchAssistant"},
"Janitor", new List<string> {"QuarterMaster", "ShaftMiner", "CargoTechnician"},
"Lawyer",
"Librarian",
"MedicalDoctor",
"MedicalIntern",
"Mime",
"Musician",
"Paramedic",
"Passenger",
"Psychologist",
"QuarterMaster",
"Reporter",
"ResearchAssistant",
"ResearchDirector",
"Roboticist",
"Scientist",
"SecurityCadet",
"SecurityOfficer",
"SeniorEngineer",
"SeniorOfficer",
"SeniorPhysician",
"SeniorResearcher",
"ServiceWorker",
"ShaftMiner",
"StationEngineer",
"TechnicalAssistant",
"Virologist",
"Visitor",
"Warden",
"Zookeeper"
}; };
// WD EDIT END // WD EDIT END
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class IdCardConsoleBoundUserInterfaceState : BoundUserInterfaceState public sealed class IdCardConsoleBoundUserInterfaceState : BoundUserInterfaceState
{ {
@@ -150,7 +122,7 @@ public sealed partial class IdCardConsoleComponent : Component
public readonly List<ProtoId<AccessLevelPrototype>>? AllowedModifyAccessList; public readonly List<ProtoId<AccessLevelPrototype>>? AllowedModifyAccessList;
public readonly ProtoId<AccessLevelPrototype> TargetIdJobPrototype; public readonly ProtoId<AccessLevelPrototype> TargetIdJobPrototype;
public readonly string? TargetIdJobIcon; //WD-EDIT public readonly string? TargetIdJobIcon; //WD-EDIT
public IdCardConsoleBoundUserInterfaceState( public IdCardConsoleBoundUserInterfaceState(
bool isPrivilegedIdPresent, bool isPrivilegedIdPresent,
bool isPrivilegedIdAuthorized, bool isPrivilegedIdAuthorized,

View File

@@ -0,0 +1,9 @@
using Robust.Shared.Serialization;
namespace Content.Shared._White.NiceIdCards;
[Serializable, NetSerializable]
public enum IdVisuals : byte
{
State
}

View File

@@ -5,7 +5,6 @@ id-card-console-window-save-button = Save
id-card-console-window-job-title-label = Job title: id-card-console-window-job-title-label = Job title:
id-card-console-window-eject-button = Eject id-card-console-window-eject-button = Eject
id-card-console-window-insert-button = Insert id-card-console-window-insert-button = Insert
id-card-console-window-job-selection-label = Job presets (sets department and job icon):
access-id-card-console-component-no-hands-error = You have no hands. access-id-card-console-component-no-hands-error = You have no hands.
id-card-console-privileged-id = Privileged ID id-card-console-privileged-id = Privileged ID

View File

@@ -5,7 +5,6 @@ id-card-console-window-save-button = Сохранить
id-card-console-window-job-title-label = Должность: id-card-console-window-job-title-label = Должность:
id-card-console-window-eject-button = Извлечь id-card-console-window-eject-button = Извлечь
id-card-console-window-insert-button = Вставить id-card-console-window-insert-button = Вставить
id-card-console-window-job-selection-label = Предустановки должностей (задает иконку отдела и должности):
access-id-card-console-component-no-hands-error = У вас нет рук. access-id-card-console-component-no-hands-error = У вас нет рук.
id-card-console-privileged-id = Основной ID id-card-console-privileged-id = Основной ID
id-card-console-target-id = Целевой ID id-card-console-target-id = Целевой ID

View File

@@ -24,6 +24,60 @@
- WhitelistChameleon - WhitelistChameleon
- type: StealTarget - type: StealTarget
stealGroup: IDCard stealGroup: IDCard
- type: Appearance
- type: GenericVisualizer
visuals:
enum.IdVisuals.State:
base:
Captain: { state: idcaptain }
HeadOfPersonnel: { state: idheadofpersonnel }
HeadOfSecurity: { state: idheadofsecurity }
ChiefMedicalOfficer: { state: idchiefmedicalofficer }
ChiefEngineer: { state: idchiefengineer }
ResearchDirector: { state: idresearchdirector }
QuarterMaster: { state: idquartermaster }
Lawyer: { state: idlawyer }
Clown: { state: idclown }
Bartender: { state: idbartender }
Reporter: { state: idreporter }
Chef: { state: idcook }
Botanist: { state: idbotanist }
ServiceWorker: { state: idintern-service }
Zookeeper: { state: idzookeeper }
Musician: { state: idmusician }
Librarian: { state: idcurator }
Janitor: { state: idjanitor }
Chaplain: { state: idchaplain }
Mime: { state: idmime }
Boxer: { state: idboxer }
Passenger: { state: idpassenger }
Visitor: { state: idpassenger }
Borg: { state: idunknown }
CustomId: { state: idunknown }
Warden: { state: idwarden }
SeniorOfficer: { state: idseniorofficer }
SecurityOfficer: { state: idsecurityofficer }
Detective: { state: iddetective }
SecurityCadet: { state: idintern-cadet }
Brigmedic: { state: idbrigmedic }
SeniorPhysician: { state: idseniorphysician }
Paramedic: { state: idparamedic }
Chemist: { state: idchemist }
MedicalDoctor: { state: idmedicaldoctor }
Virologist: { state: idvirologist }
Geneticist: { state: idgeneticist }
MedicalIntern: { state: idintern-med }
Psychologist: { state: idpsychologist }
SeniorEngineer: { state: idseniorengineer }
AtmosphericTechnician: { state: idatmospherictechnician }
StationEngineer: { state: idstationengineer }
TechnicalAssistant: { state: idintern-tech }
SeniorResearcher: { state: idseniorresearcher }
Scientist: { state: idscientist }
Roboticist: { state: idroboticist }
ResearchAssistant: { state: idintern-sci }
ShaftMiner: { state: idshaftminer }
CargoTechnician: { state: idcargotechnician }
#IDs with layers #IDs with layers