Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@
<Label Name="PersonName"
Margin="0 0 0 5"
StyleClasses="LabelBig" />
<BoxContainer Orientation="Horizontal"
Margin="0 0 0 5">
<Label Text="{Loc 'crew-monitoring-user-interface-nationality'}"
FontColorOverride="DarkGray" />
<Label Text=":"
Margin="0 0 6 0"
FontColorOverride="DarkGray" />
<Label Name="PersonNationality" />
</BoxContainer>
<BoxContainer Orientation="Horizontal"
Margin="0 0 0 5">
<Label Text="{Loc 'crew-monitoring-user-interface-job'}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ private void PopulateRecordContainer(GeneralStationRecord stationRecord, Crimina
var na = Loc.GetString("generic-not-available-shorthand");
PersonName.Text = stationRecord.Name;
PersonJob.Text = stationRecord.JobTitle ?? na;
PersonNationality.Text = stationRecord.Nationality ?? na; // Forge-change

// Job icon
if (_proto.TryIndex<JobIconPrototype>(stationRecord.JobIcon, out var proto))
Expand Down
11 changes: 11 additions & 0 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@
ToolTip="{Loc 'humanoid-profile-editor-guidebook-button-tooltip'}"/>
<OptionButton Name="SpeciesButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- _EE: Nationality -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-nationality-label'}" />
<Control HorizontalExpand="True"/>
<TextureButton Name="NationalityInfoButton" Scale="0.3 0.3" VerticalAlignment="Center"
ToolTip="{Loc 'humanoid-profile-editor-guidebook-button-tooltip'}"/>
<OptionButton Name="NationalityButton" HorizontalAlignment="Right" />
</BoxContainer>
<BoxContainer HorizontalExpand="False">
<RichTextLabel Name="NationalityDescriptionLabel" Text="" HorizontalExpand="False" MaxWidth="600"/>
</BoxContainer>
<!-- Age -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-age-label'}" />
Expand Down
66 changes: 64 additions & 2 deletions Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Direction = Robust.Shared.Maths.Direction;
using Content.Shared._EE.Contractors.Prototypes; // Forge-change: take _EE nationality

namespace Content.Client.Lobby.UI
{
Expand Down Expand Up @@ -89,7 +90,7 @@ public sealed partial class HumanoidProfileEditor : BoxContainer
public HumanoidCharacterProfile? Profile;

private List<SpeciesPrototype> _species = new();

private List<NationalityPrototype> _nationalies = new(); // Forge-change: take _EE nationality
private List<(string, RequirementsSelector)> _jobPriorities = new();

private readonly Dictionary<string, BoxContainer> _jobCategories;
Expand Down Expand Up @@ -226,6 +227,20 @@ public HumanoidProfileEditor(
OnSkinColorOnValueChanged();
};

// Forge-change-start: take _EE nationality
#region Contractors

RefreshNationalities();

NationalityButton.OnItemSelected += args =>
{
NationalityButton.SelectId(args.Id);
SetNationality(_nationalies[args.Id].ID);
};

#endregion Contractors
// Forge-change-end

#region Skin

Skin.OnValueChanged += _ =>
Expand Down Expand Up @@ -1049,6 +1064,43 @@ public void RefreshSpecies()
}
}

// Forge-change start: take _EE nationality
public void RefreshNationalities()
{
NationalityButton.Clear();
_nationalies.Clear();

_nationalies.AddRange(_prototypeManager.EnumeratePrototypes<NationalityPrototype>()
.Where(o => _requirements.CheckRoleRequirements(
o.Requirements?.ToHashSet(),
Profile ?? HumanoidCharacterProfile.DefaultWithSpecies(),
out _)));

var nationalityIds = _nationalies.Select(o => o.ID).ToList();

for (var i = 0; i < _nationalies.Count; i++)
{
NationalityButton.AddItem(Loc.GetString(_nationalies[i].NameKey), i);

if (Profile?.Nationality == _nationalies[i].ID)
NationalityButton.SelectId(i);
}

// If our nationality isn't available, reset it to default
if (Profile != null && !nationalityIds.Contains(Profile.Nationality))
SetNationality(SharedHumanoidAppearanceSystem.DefaultNationality);

if(Profile != null)
UpdateNationalityDescription(Profile.Nationality);
}

private void UpdateNationalityDescription(string nationality)
{
var prototype = _prototypeManager.Index<NationalityPrototype>(nationality);
NationalityDescriptionLabel.SetMessage(Loc.GetString(prototype.DescriptionKey));
}
// Forge-change end

public void RefreshAntags()
{
// Frontier: no antags
Expand Down Expand Up @@ -1217,6 +1269,7 @@ public void SetProfile(HumanoidCharacterProfile? profile, int? slot)
RefreshJobs();
RefreshLoadouts();
RefreshSpecies();
RefreshNationalities(); // Forge-change: _EE nationality
RefreshTraits();
RefreshFlavorText();
RefreshTTS(); // Corvax-TTS
Expand Down Expand Up @@ -1686,6 +1739,15 @@ private void SetSpecies(string newSpecies)
ReloadPreview();
}

// Forge-change-start: take _EE nationality
private void SetNationality(string newNationality)
{
Profile = Profile?.WithNationality(newNationality);
IsDirty = true;
ReloadProfilePreview();
}
// Forge-change-end

private void EnforceSpeciesTraitRestrictions()
{
if (Profile == null)
Expand Down Expand Up @@ -1723,7 +1785,7 @@ private void SetName(string newName)
_entManager.System<MetaDataSystem>().SetEntityName(PreviewDummy, newName);
}

private void SetSpawnPriority(SpawnPriorityPreference newSpawnPriority)
private void SetSpawnPriority(SpawnPriorityPreference newSpawnPriority)
{
Profile = Profile?.WithSpawnPriorityPreference(newSpawnPriority);
SetDirty();
Expand Down
1 change: 1 addition & 0 deletions Content.Client/StationRecords/GeneralRecord.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Control xmlns="https://spacestation14.io">
<BoxContainer Orientation="Vertical" Margin="5">
<Label Name="RecordName" StyleClasses="LabelBig"/>
<Label Name="Nationality"/>
<Label Name="Age"/>
<Label Name="Title"/>
<Label Name="Job"/>
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/StationRecords/GeneralRecord.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id)
("fingerprint", record.Fingerprint ?? Loc.GetString("generic-not-available-shorthand")));
Dna.Text = Loc.GetString("general-station-record-console-record-dna",
("dna", record.DNA ?? Loc.GetString("generic-not-available-shorthand")));
Nationality.Text = Loc.GetString("general-station-record-console-record-nationality",
("nationality", record.Nationality ?? Loc.GetString("generic-not-available-shorthand"))); // Forge-change: add _EE nationality to records

if (canDelete && id != null )
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Content.Shared._EE.Contractors.Components;
using Content.Shared._EE.Contractors.Systems;
using Content.Shared.Preferences;
using Robust.Client.GameObjects;
using Robust.Client.Timing;
using Robust.Shared.Timing;
using System.Globalization;


namespace Content.Client._EE.Contractors.Systems;

public sealed class PassportSystem : EntitySystem
{
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IClientGameTiming _timing = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<PassportComponent, SharedPassportSystem.PassportToggleEvent>(OnPassportToggled);
// SubscribeLocalEvent<PassportComponent, SharedPassportSystem.PassportProfileUpdatedEvent>(OnPassportProfileUpdated);
}

// public void OnPassportProfileUpdated(Entity<PassportComponent> passport, ref SharedPassportSystem.PassportProfileUpdatedEvent evt)
// {
// if(!_timing.IsFirstTimePredicted || evt.Handled || !_entityManager.TryGetComponent<SpriteComponent>(passport, out var sprite))
// return;

// var profile = evt.Profile;

// var currentState = sprite.LayerGetState(1);

// if (currentState.Name == null)
// return;

// sprite.LayerSetState(1, currentState.Name.Replace("human", profile.Species.ToString().ToLower(CultureInfo.CurrentCulture)));
// }

private void OnPassportToggled(Entity<PassportComponent> passport, ref SharedPassportSystem.PassportToggleEvent evt)
{
if (!_timing.IsFirstTimePredicted || evt.Handled || !_entityManager.TryGetComponent<SpriteComponent>(passport, out var sprite))
return;

var currentState = sprite.LayerGetState(0);

if (currentState.Name == null)
return;

evt.Handled = true;

// sprite.LayerSetVisible(1, !passport.Comp.IsClosed);

var oldState = passport.Comp.IsClosed? "open" : "closed";
var newState = passport.Comp.IsClosed ? "closed" : "open";

var newStateName = currentState.Name.Replace(oldState, newState);

sprite.LayerSetState(0, newStateName);
}
}
Loading
Loading