_jobCategories.Clear();
var firstCategory = true;
- foreach (var department in _prototypeManager.EnumeratePrototypes<DepartmentPrototype>())
+ var departments = _prototypeManager.EnumeratePrototypes<DepartmentPrototype>()
+ .OrderByDescending(department => department.Weight)
+ .ThenBy(department => Loc.GetString($"department-{department.ID}"))
+ .ToList();
+
+ foreach (var department in departments)
{
var departmentName = Loc.GetString($"department-{department.ID}");
_jobList.AddChild(category);
}
- var jobs = department.Roles.Select(o => _prototypeManager.Index<JobPrototype>(o)).Where(o => o.SetPreference).ToList();
- jobs.Sort((x, y) => -string.Compare(x.LocalizedName, y.LocalizedName, StringComparison.CurrentCultureIgnoreCase));
+ var jobs = department.Roles.Select(jobId => _prototypeManager.Index<JobPrototype>(jobId))
+ .Where(job => job.SetPreference)
+ .OrderByDescending(job => job.Weight)
+ .ThenBy(job => job.LocalizedName)
+ .ToList();
foreach (var job in jobs)
{
}
}
+
+ if (Profile is not null)
+ {
+ UpdateJobPriorities();
+ }
}
private void OnFlavorTextChange(string content)
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Primary = true;
+
+ /// <summary>
+ /// Departments with a higher weight sorted before other departments in UI.
+ /// </summary>
+ [DataField("weight")]
+ public int Weight { get; private set; } = 0;
}
id: Civilian
description: department-Civilian-description
color: "#9FED58"
+ weight: -10
roles:
- Bartender
- Borg
- ResearchDirector
- Quartermaster
primary: false
+ weight: 100
- type: department
id: Engineering
id: Security
description: department-Security-description
color: "#DE3A3A"
+ weight: 20
roles:
- HeadOfSecurity
- SecurityCadet
id: Specific
description: department-Specific-description
color: "#9FED58"
+ weight: 10
roles:
- Boxer
- Reporter