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:
@@ -13,6 +13,7 @@ namespace Content.Client.Access.UI;
|
||||
public sealed partial class AccessLevelControl : GridContainer
|
||||
{
|
||||
public readonly Dictionary<ProtoId<AccessLevelPrototype>, Button> ButtonsList = new();
|
||||
public readonly List<Dictionary<ProtoId<AccessLevelPrototype>, Button>> ButtonGroups = new ();
|
||||
|
||||
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(
|
||||
List<ProtoId<AccessLevelPrototype>> pressedList,
|
||||
List<ProtoId<AccessLevelPrototype>>? enabledList = null)
|
||||
|
||||
@@ -23,15 +23,15 @@ namespace Content.Client.Access.UI
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
List<ProtoId<AccessLevelPrototype>> accessLevels;
|
||||
List<List<ProtoId<AccessLevelPrototype>>> accessLevels;
|
||||
|
||||
if (EntMan.TryGetComponent<IdCardConsoleComponent>(Owner, out var idCard))
|
||||
{
|
||||
accessLevels = idCard.AccessLevels;
|
||||
accessLevels = idCard.AccessLevelsConsole;
|
||||
}
|
||||
else
|
||||
{
|
||||
accessLevels = new List<ProtoId<AccessLevelPrototype>>();
|
||||
accessLevels = new List<List<ProtoId<AccessLevelPrototype>>>();
|
||||
_idCardConsoleSystem.Log.Error($"No IdCardConsole component found for {EntMan.ToPrettyString(Owner)}!");
|
||||
}
|
||||
|
||||
|
||||
@@ -26,16 +26,13 @@
|
||||
<Button Name="JobTitleSaveButton" Text="{Loc 'id-card-console-window-save-button'}" Disabled="True" />
|
||||
</GridContainer>
|
||||
<Control MinSize="0 8" />
|
||||
<GridContainer Columns="2">
|
||||
<Label Text="{Loc 'id-card-console-window-job-selection-label'}" />
|
||||
<OptionButton Name="JobPresetOptionButton" />
|
||||
</GridContainer>
|
||||
<Control Name="AccessLevelControlContainer" />
|
||||
<GridContainer Name="AccessLevelControlContainer" Columns="7" HorizontalExpand="True" HorizontalAlignment="Center" >
|
||||
<!-- WD EDIT -->
|
||||
</GridContainer>
|
||||
<GridContainer Name="CurrentJobIcon" Columns="2">
|
||||
<Label Text="Текущая выбранная иконка для роли: " />
|
||||
</GridContainer>
|
||||
<GridContainer Name="JobIconsGrid" Columns="10" HorizontalAlignment="Center">
|
||||
<GridContainer Name="JobIconsGrid" HorizontalAlignment="Center">
|
||||
<!-- Job icon buttons are generated in the code -->
|
||||
</GridContainer>
|
||||
<!-- WD EDIT END -->
|
||||
|
||||
@@ -24,9 +24,11 @@ namespace Content.Client.Access.UI
|
||||
|
||||
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 List<string> _jobPrototypeIds = new();
|
||||
private string _newJob = "";
|
||||
|
||||
private string? _lastFullName;
|
||||
private string? _lastJobTitle;
|
||||
@@ -36,7 +38,7 @@ namespace Content.Client.Access.UI
|
||||
public IdCardConsoleWindow(
|
||||
IdCardConsoleBoundUserInterface owner,
|
||||
IPrototypeManager prototypeManager,
|
||||
List<ProtoId<AccessLevelPrototype>> accessLevels)
|
||||
List<List<ProtoId<AccessLevelPrototype>>> accessLevels)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
@@ -59,26 +61,20 @@ namespace Content.Client.Access.UI
|
||||
|
||||
JobTitleSaveButton.OnPressed += _ => SubmitData();
|
||||
|
||||
var jobs = _prototypeManager.EnumeratePrototypes<JobPrototype>().ToList();
|
||||
jobs.Sort((x, y) => string.Compare(x.LocalizedName, y.LocalizedName, StringComparison.CurrentCulture));
|
||||
_groupAccessButtons.PopulateForConsole(accessLevels, prototypeManager);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
_jobPrototypeIds.Add(job.ID);
|
||||
JobPresetOptionButton.AddItem(Loc.GetString(job.Name), _jobPrototypeIds.Count - 1);
|
||||
AccessLevelControlContainer.AddChild(departmentGrid);
|
||||
}
|
||||
|
||||
JobPresetOptionButton.OnItemSelected += SelectJobPreset;
|
||||
|
||||
_accessButtons.Populate(accessLevels, prototypeManager);
|
||||
AccessLevelControlContainer.AddChild(_accessButtons);
|
||||
|
||||
foreach (var (id, button) in _accessButtons.ButtonsList)
|
||||
foreach (var (id, button) in _groupAccessButtons.ButtonsList)
|
||||
{
|
||||
button.OnPressed += _ => SubmitData();
|
||||
}
|
||||
@@ -92,72 +88,89 @@ namespace Content.Client.Access.UI
|
||||
if (rsi == null)
|
||||
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
|
||||
: rsi.RSI.TryGetState("CustomId", out var customState) ? customState.Frame0
|
||||
: null,
|
||||
Scale = new Vector2(5, 5)
|
||||
Columns = department.Count
|
||||
};
|
||||
|
||||
_jobIconButtons.Add(jobIcon, newButton);
|
||||
newButton.OnPressed += _ =>
|
||||
foreach (var jobIcon in department)
|
||||
{
|
||||
_lastJobIcon = "JobIcon" + jobIcon;
|
||||
SubmitData();
|
||||
};
|
||||
var newButton = new TextureButton
|
||||
{
|
||||
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
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
JobTitleLineEdit.Text = Loc.GetString(job.Name);
|
||||
args.Button.SelectId(args.Id);
|
||||
|
||||
ClearAllAccess();
|
||||
|
||||
// this is a sussy way to do this
|
||||
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)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex(group, out AccessGroupPrototype? groupPrototype))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
JobPresetOptionButton.Disabled = !interfaceEnabled;
|
||||
|
||||
_accessButtons.UpdateState(state.TargetIdAccessList?.ToList() ??
|
||||
new List<ProtoId<AccessLevelPrototype>>(),
|
||||
_groupAccessButtons.UpdateStateConsole(state.TargetIdAccessList?.ToList() ??
|
||||
new List<ProtoId<AccessLevelPrototype>>(),
|
||||
state.AllowedModifyAccessList?.ToList() ??
|
||||
new List<ProtoId<AccessLevelPrototype>>());
|
||||
|
||||
var jobIndex = _jobPrototypeIds.IndexOf(state.TargetIdJobPrototype);
|
||||
if (jobIndex >= 0)
|
||||
{
|
||||
JobPresetOptionButton.SelectId(jobIndex);
|
||||
}
|
||||
|
||||
//WD-EDIT
|
||||
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)
|
||||
? customState.Frame0
|
||||
: null,
|
||||
|
||||
TextureScale = new Vector2(4, 4)
|
||||
};
|
||||
|
||||
@@ -256,15 +261,18 @@ namespace Content.Client.Access.UI
|
||||
private void SubmitData()
|
||||
{
|
||||
// Don't send this if it isn't dirty.
|
||||
var jobProtoDirty = _lastJobProto != null &&
|
||||
_jobPrototypeIds[JobPresetOptionButton.SelectedId] != _lastJobProto;
|
||||
var jobProtoDirty = _lastJobProto != null && _newJob != _lastJobProto;
|
||||
|
||||
_owner.SubmitData(
|
||||
FullNameLineEdit.Text,
|
||||
JobTitleLineEdit.Text,
|
||||
// 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(),
|
||||
jobProtoDirty ? _jobPrototypeIds[JobPresetOptionButton.SelectedId] : string.Empty,
|
||||
_groupAccessButtons.ButtonGroups
|
||||
.SelectMany(dict => dict)
|
||||
.Where(x => x.Value.Pressed)
|
||||
.Select(x => x.Key)
|
||||
.ToList(),
|
||||
jobProtoDirty ? _newJob : string.Empty,
|
||||
_lastJobIcon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +158,16 @@ namespace Content.Client.Stylesheets
|
||||
public const string StyleClassButtonColorGreen = "ButtonColorGreen";
|
||||
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 StyleNano(IResourceCache resCache) : base(resCache)
|
||||
@@ -1340,6 +1350,55 @@ namespace Content.Client.Stylesheets
|
||||
{
|
||||
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
|
||||
|
||||
@@ -1576,6 +1635,44 @@ namespace Content.Client.Stylesheets
|
||||
.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 ---
|
||||
Element<Button>().Class("ButtonColorGreen")
|
||||
.Prop(Control.StylePropertyModulateSelf, ButtonColorGoodDefault),
|
||||
|
||||
@@ -145,7 +145,12 @@ public sealed class IdCardConsoleSystem : SharedIdCardConsoleSystem
|
||||
if (newJobIcon != null && _prototype.TryIndex<StatusIconPrototype>(newJobIcon, out var jobIcon)) // WD EDIT END
|
||||
{
|
||||
_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)))
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Kitchen.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._White.NiceIdCards;
|
||||
using Content.Shared.Access;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
@@ -9,6 +10,7 @@ using Content.Shared.Database;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Roles;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
@@ -21,6 +23,7 @@ public sealed class IdCardSystem : SharedIdCardSystem
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly MetaDataSystem _metaSystem = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _sharedAppearance = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -144,6 +147,17 @@ public sealed class IdCardSystem : SharedIdCardSystem
|
||||
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)
|
||||
{
|
||||
if (!Resolve(uid, ref id))
|
||||
|
||||
@@ -30,7 +30,7 @@ public sealed partial class IdCardConsoleComponent : Component
|
||||
public readonly List<ProtoId<AccessLevelPrototype>> AccessList;
|
||||
public readonly ProtoId<AccessLevelPrototype> JobPrototype;
|
||||
public readonly string? SelectedIcon; //WD-EDIT
|
||||
|
||||
|
||||
public WriteToTargetIdMessage(string fullName, string jobTitle, List<ProtoId<AccessLevelPrototype>> accessList, ProtoId<AccessLevelPrototype> jobPrototype,
|
||||
string? selectedIcon)
|
||||
{
|
||||
@@ -79,63 +79,35 @@ public sealed partial class IdCardConsoleComponent : Component
|
||||
"Theatre"
|
||||
};
|
||||
|
||||
//WD-EDIT
|
||||
[DataField("jobIcons")]
|
||||
public List<string> JobIcons = new()
|
||||
// WD edit
|
||||
[DataField, AutoNetworkedField]
|
||||
public List<List<ProtoId<AccessLevelPrototype>>> AccessLevelsConsole = new()
|
||||
{
|
||||
"AtmosphericTechnician",
|
||||
"Bartender",
|
||||
"Borg",
|
||||
"Botanist",
|
||||
"Boxer",
|
||||
"Brigmedic",
|
||||
"Captain",
|
||||
"CargoTechnician",
|
||||
"Chaplain",
|
||||
"Chef",
|
||||
"Chemist",
|
||||
"ChiefEngineer",
|
||||
"ChiefMedicalOfficer",
|
||||
"Clown",
|
||||
"CustomId",
|
||||
"Detective",
|
||||
"Geneticist",
|
||||
"HeadOfPersonnel",
|
||||
"HeadOfSecurity",
|
||||
"Inspector",
|
||||
"Janitor",
|
||||
"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"
|
||||
new List<ProtoId<AccessLevelPrototype>> {"Captain", "HeadOfPersonnel", "HeadOfSecurity", "ChiefMedicalOfficer", "ChiefEngineer", "ResearchDirector", "Command"}, // Command
|
||||
new List<ProtoId<AccessLevelPrototype>> {"Armory", "Brig", "Security","Detective", "Lawyer"}, // Security
|
||||
new List<ProtoId<AccessLevelPrototype>> {"Chemistry", "Cryogenics", "Medical"}, // Medical
|
||||
new List<ProtoId<AccessLevelPrototype>> {"Atmospherics", "Engineering", "External", "Maintenance"}, // Engineering
|
||||
new List<ProtoId<AccessLevelPrototype>> {"Research"}, // Researching
|
||||
new List<ProtoId<AccessLevelPrototype>> {"Cargo", "Salvage"}, // Cargo
|
||||
new List<ProtoId<AccessLevelPrototype>> { "Service", "Theatre", "Bar", "Chapel", "Hydroponics", "Janitor", "Kitchen"} // Service
|
||||
};
|
||||
|
||||
//WD-EDIT
|
||||
// Command, Service, Security, Medical, Engineering, Researching, Cargo,
|
||||
[DataField("jobIcons")]
|
||||
public List<List<string>> JobIcons = new()
|
||||
{
|
||||
new List<string> {"Captain", "HeadOfPersonnel", "HeadOfSecurity", "ChiefMedicalOfficer", "ChiefEngineer", "ResearchDirector", "QuarterMaster", "Inspector"},
|
||||
new List<string> {"HeadOfPersonnel", "Lawyer", "Clown", "Bartender", "Reporter", "Chef", "Botanist", "ServiceWorker", "Zookeeper", "Musician", "Librarian", "Janitor", "Chaplain", "Mime", "Boxer", "Passenger", "Visitor", "Borg", "CustomId"},
|
||||
new List<string> {"HeadOfSecurity", "Warden", "SeniorOfficer", "SecurityOfficer", "Detective", "SecurityCadet", "Brigmedic", "Lawyer"},
|
||||
new List<string> {"ChiefMedicalOfficer", "SeniorPhysician", "Paramedic", "Chemist", "MedicalDoctor", "Virologist", "Geneticist", "MedicalIntern", "Psychologist"},
|
||||
new List<string> {"ChiefEngineer", "SeniorEngineer", "AtmosphericTechnician", "StationEngineer", "TechnicalAssistant"},
|
||||
new List<string> {"ResearchDirector", "SeniorResearcher", "Scientist", "Roboticist", "ResearchAssistant"},
|
||||
new List<string> {"QuarterMaster", "ShaftMiner", "CargoTechnician"},
|
||||
};
|
||||
// WD EDIT END
|
||||
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class IdCardConsoleBoundUserInterfaceState : BoundUserInterfaceState
|
||||
{
|
||||
@@ -150,7 +122,7 @@ public sealed partial class IdCardConsoleComponent : Component
|
||||
public readonly List<ProtoId<AccessLevelPrototype>>? AllowedModifyAccessList;
|
||||
public readonly ProtoId<AccessLevelPrototype> TargetIdJobPrototype;
|
||||
public readonly string? TargetIdJobIcon; //WD-EDIT
|
||||
|
||||
|
||||
public IdCardConsoleBoundUserInterfaceState(
|
||||
bool isPrivilegedIdPresent,
|
||||
bool isPrivilegedIdAuthorized,
|
||||
|
||||
9
Content.Shared/_White/NiceIdCards/IdCardsVisuals.cs
Normal file
9
Content.Shared/_White/NiceIdCards/IdCardsVisuals.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared._White.NiceIdCards;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum IdVisuals : byte
|
||||
{
|
||||
State
|
||||
}
|
||||
@@ -5,7 +5,6 @@ id-card-console-window-save-button = Save
|
||||
id-card-console-window-job-title-label = Job title:
|
||||
id-card-console-window-eject-button = Eject
|
||||
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.
|
||||
id-card-console-privileged-id = Privileged ID
|
||||
|
||||
@@ -5,7 +5,6 @@ id-card-console-window-save-button = Сохранить
|
||||
id-card-console-window-job-title-label = Должность:
|
||||
id-card-console-window-eject-button = Извлечь
|
||||
id-card-console-window-insert-button = Вставить
|
||||
id-card-console-window-job-selection-label = Предустановки должностей (задает иконку отдела и должности):
|
||||
access-id-card-console-component-no-hands-error = У вас нет рук.
|
||||
id-card-console-privileged-id = Основной ID
|
||||
id-card-console-target-id = Целевой ID
|
||||
|
||||
@@ -24,6 +24,60 @@
|
||||
- WhitelistChameleon
|
||||
- type: StealTarget
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user