fish-station/Content.Shared/Roles/DepartmentPrototype.cs
VigersRay c0ee7e3cc9 Merge remote-tracking branch 'refs/remotes/wizards/master'
# Conflicts:
#	.github/PULL_REQUEST_TEMPLATE.md
#	Content.Client/Lobby/LobbyUIController.cs
#	Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
#	Content.Client/Players/PlayTimeTracking/JobRequirementsManager.cs
#	Content.Server/Administration/Systems/BwoinkSystem.cs
#	Content.Server/IoC/ServerContentIoC.cs
#	Content.Server/Players/PlayTimeTracking/PlayTimeTrackingSystem.cs
#	Content.Server/Shuttles/Systems/ArrivalsSystem.cs
#	Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs
#	Content.Shared/Roles/JobRequirements.cs
#	Resources/Prototypes/Accents/word_replacements.yml
#	Resources/Prototypes/Catalog/Fills/Lockers/security.yml
#	Resources/Prototypes/Entities/Mobs/Species/base.yml
#	Resources/Prototypes/Loadouts/Jobs/Cargo/cargo_technician.yml
#	Resources/Prototypes/Loadouts/Jobs/Cargo/quartermaster.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/bartender.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/botanist.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/chaplain.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/chef.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/janitor.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/lawyer.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/librarian.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/mime.yml
#	Resources/Prototypes/Loadouts/Jobs/Civilian/passenger.yml
#	Resources/Prototypes/Loadouts/Jobs/Command/captain.yml
#	Resources/Prototypes/Loadouts/Jobs/Command/head_of_personnel.yml
#	Resources/Prototypes/Loadouts/Jobs/Engineering/atmospheric_technician.yml
#	Resources/Prototypes/Loadouts/Jobs/Engineering/chief_engineer.yml
#	Resources/Prototypes/Loadouts/Jobs/Engineering/station_engineer.yml
#	Resources/Prototypes/Loadouts/Jobs/Engineering/technical_assistant.yml
#	Resources/Prototypes/Loadouts/Jobs/Medical/chemist.yml
#	Resources/Prototypes/Loadouts/Jobs/Medical/chief_medical_officer.yml
#	Resources/Prototypes/Loadouts/Jobs/Medical/medical_doctor.yml
#	Resources/Prototypes/Loadouts/Jobs/Medical/medical_intern.yml
#	Resources/Prototypes/Loadouts/Jobs/Medical/paramedic.yml
#	Resources/Prototypes/Loadouts/Jobs/Science/research_director.yml
#	Resources/Prototypes/Loadouts/Jobs/Science/scientist.yml
#	Resources/Prototypes/Loadouts/Jobs/Security/detective.yml
#	Resources/Prototypes/Loadouts/Jobs/Security/head_of_security.yml
#	Resources/Prototypes/Loadouts/Jobs/Security/security_cadet.yml
#	Resources/Prototypes/Loadouts/Jobs/Security/security_officer.yml
#	Resources/Prototypes/Loadouts/Jobs/Security/warden.yml
#	Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml
#	Resources/Prototypes/Recipes/Lathes/medical.yml
#	Resources/Prototypes/Roles/Jobs/Cargo/quartermaster.yml
#	Resources/Prototypes/Roles/Jobs/Command/captain.yml
#	Resources/Prototypes/Roles/Jobs/Command/head_of_personnel.yml
#	Resources/Prototypes/Roles/Jobs/Engineering/chief_engineer.yml
#	Resources/Prototypes/Roles/Jobs/Medical/chief_medical_officer.yml
#	Resources/Prototypes/Roles/Jobs/Science/research_director.yml
#	Resources/Prototypes/Roles/Jobs/Security/head_of_security.yml
#	Resources/Textures/Clothing/Mask/sadmime.rsi/meta.json
#	Resources/Textures/Clothing/Mask/scaredmime.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coat.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatatmos.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcap.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcargo.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatce.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcentcom.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatchem.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatcmo.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatengi.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatgen.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coathop.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coathos.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coathydro.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatjani.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatmed.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatmime.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatminer.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatparamed.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatqm.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatrd.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatrobo.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatsci.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatsec.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatviro.rsi/meta.json
#	Resources/Textures/Clothing/OuterClothing/WinterCoats/coatwarden.rsi/meta.json
#	Resources/Textures/Structures/Power/apc.rsi/base.png
#	Resources/Textures/Structures/Power/apc.rsi/broken.png
#	Resources/Textures/Structures/Power/apc.rsi/display-charging.png
#	Resources/Textures/Structures/Power/apc.rsi/display-full.png
#	Resources/Textures/Structures/Power/apc.rsi/display-lack.png
#	Resources/Textures/Structures/Power/apc.rsi/display-remote.png
#	Resources/Textures/Structures/Power/apc.rsi/emag-unlit.png
#	Resources/Textures/Structures/Power/apc.rsi/frame.png
#	Resources/Textures/Structures/Power/apc.rsi/static.png
2024-08-05 17:22:05 +03:00

76 lines
2.3 KiB
C#

using Robust.Shared.Prototypes;
namespace Content.Shared.Roles;
[Prototype("department")]
public sealed partial class DepartmentPrototype : IPrototype
{
[IdDataField]
public string ID { get; } = string.Empty;
/// <summary>
/// The name LocId of the department that will be displayed in the various menus.
/// </summary>
[DataField(required: true)]
public LocId Name = string.Empty;
/// <summary>
/// A description LocId to display in the character menu as an explanation of the department's function.
/// </summary>
[DataField(required: true)]
public LocId Description = string.Empty;
/// <summary>
/// A color representing this department to use for text.
/// </summary>
[DataField(required: true)]
public Color Color;
[DataField, ViewVariables(VVAccess.ReadWrite)]
public List<ProtoId<JobPrototype>> Roles = new();
[DataField("sort")] public int Sort; // Sunrise-Edit
/// <summary>
/// Whether this is a primary department or not.
/// For example, CE's primary department is engineering since Command has primary: false.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Primary = true;
/// <summary>
/// Departments with a higher weight sorted before other departments in UI.
/// </summary>
[DataField]
public int Weight { get; private set; }
/// <summary>
/// Toggles the display of the department in the priority setting menu in the character editor.
/// </summary>
[DataField]
public bool EditorHidden;
}
/// <summary>
/// Sorts <see cref="DepartmentPrototype"/> appropriately for display in the UI,
/// respecting their <see cref="DepartmentPrototype.Weight"/>.
/// </summary>
public sealed class DepartmentUIComparer : IComparer<DepartmentPrototype>
{
public static readonly DepartmentUIComparer Instance = new();
public int Compare(DepartmentPrototype? x, DepartmentPrototype? y)
{
if (ReferenceEquals(x, y))
return 0;
if (ReferenceEquals(null, y))
return 1;
if (ReferenceEquals(null, x))
return -1;
var cmp = -x.Weight.CompareTo(y.Weight);
return cmp != 0 ? cmp : string.Compare(x.ID, y.ID, StringComparison.Ordinal);
}
}