Skip to content

Commit

Permalink
Character menu issuer localization (space-wizards#29840)
Browse files Browse the repository at this point in the history
* Update CharacterUIController.cs

* TODO Burn this shit

* huh?

* huh!

---------

Co-authored-by: lzk <[email protected]>
  • Loading branch information
2 people authored and themias committed Aug 9, 2024
1 parent 9cd9483 commit 5edcd77
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System.Linq;
using Content.Client.CharacterInfo;
using Content.Client.Gameplay;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.Character.Controls;
using Content.Client.UserInterface.Systems.Character.Windows;
using Content.Client.UserInterface.Systems.Objectives.Controls;
using Content.Shared.Input;
using Content.Shared.Objectives.Systems;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.Player;
Expand Down Expand Up @@ -121,11 +123,17 @@ private void CharacterUpdated(CharacterData data)
Modulate = Color.Gray
};

objectiveControl.AddChild(new Label

var objectiveText = new FormattedMessage();
objectiveText.TryAddMarkup(groupId, out _);

var objectiveLabel = new RichTextLabel
{
Text = groupId,
Modulate = Color.LightSkyBlue
});
StyleClasses = {StyleNano.StyleClassTooltipActionTitle}
};
objectiveLabel.SetMessage(objectiveText);

objectiveControl.AddChild(objectiveLabel);

foreach (var condition in conditions)
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/CharacterInfo/CharacterInfoSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void OnRequestCharacterInfoEvent(RequestCharacterInfoEvent msg, EntitySe
continue;

// group objectives by their issuer
var issuer = Comp<ObjectiveComponent>(objective).Issuer;
var issuer = Comp<ObjectiveComponent>(objective).LocIssuer;
if (!objectives.ContainsKey(issuer))
objectives[issuer] = new List<ObjectiveInfo>();
objectives[issuer].Add(info.Value);
Expand Down
4 changes: 2 additions & 2 deletions Content.Server/Objectives/ObjectivesSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ private void AddSummary(StringBuilder result, string agent, List<(EntityUid, str
var agentSummary = new StringBuilder();
agentSummary.AppendLine(Loc.GetString("objectives-with-objectives", ("custody", custody), ("title", title), ("agent", agent)));

foreach (var objectiveGroup in objectives.GroupBy(o => Comp<ObjectiveComponent>(o).Issuer))
foreach (var objectiveGroup in objectives.GroupBy(o => Comp<ObjectiveComponent>(o).LocIssuer))
{
//TO DO:
//check for the right group here. Getting the target issuer is easy: objectiveGroup.Key
//It should be compared to the type of the group's issuer.
agentSummary.AppendLine(Loc.GetString($"objective-issuer-{objectiveGroup.Key}"));
agentSummary.AppendLine(objectiveGroup.Key);

foreach (var objective in objectiveGroup)
{
Expand Down
7 changes: 5 additions & 2 deletions Content.Shared/Objectives/Components/ObjectiveComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ public sealed partial class ObjectiveComponent : Component
/// <summary>
/// Organisation that issued this objective, used for grouping and as a header above common objectives.
/// </summary>
[DataField(required: true)]
public string Issuer = string.Empty;
[DataField("issuer", required: true)]
private LocId Issuer { get; set; }

[ViewVariables(VVAccess.ReadOnly)]
public string LocIssuer => Loc.GetString(Issuer);

/// <summary>
/// Unique objectives can only have 1 per prototype id.
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Objectives/dragon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- type: Objective
# difficulty isn't used at all since objective are fixed
difficulty: 1.5
issuer: dragon
issuer: objective-issuer-dragon
- type: RoleRequirement
roles:
components:
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Objectives/ninja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- type: Objective
# difficulty isn't used since all objectives are picked
difficulty: 1.5
issuer: spiderclan
issuer: objective-issuer-spiderclan
- type: RoleRequirement
roles:
components:
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Objectives/thief.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id: BaseThiefObjective
components:
- type: Objective
issuer: thief
issuer: objective-issuer-thief
- type: RoleRequirement
roles:
components:
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Objectives/traitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
id: BaseTraitorObjective
components:
- type: Objective
issuer: syndicate
issuer: objective-issuer-syndicate
- type: RoleRequirement
roles:
components:
Expand Down

0 comments on commit 5edcd77

Please sign in to comment.