Traitor objectives now include their target's job (#6417)

This commit is contained in:
Rane
2022-02-06 21:25:04 -05:00
committed by GitHub
parent 03a5a71243
commit be7a770b78
5 changed files with 17 additions and 8 deletions

View File

@@ -223,6 +223,11 @@ namespace Content.Server.Mind
return _roles.Any(role => role.GetType() == t);
}
/// <summary>
/// Gets the current job
/// </summary>
public Job? CurrentJob => _roles.OfType<Job>().SingleOrDefault();
/// <summary>
/// Adds an objective to this mind.
/// </summary>

View File

@@ -1,4 +1,5 @@
using Content.Server.Objectives.Interfaces;
using Content.Server.Roles;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -16,16 +17,17 @@ namespace Content.Server.Objectives.Conditions
get
{
var targetName = string.Empty;
var jobName = Target?.CurrentJob?.Name ?? "Unknown";
if (Target == null)
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName));
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
if (Target.CharacterName != null)
targetName = Target.CharacterName;
else if (Target.OwnedEntity is {Valid: true} owned)
targetName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(owned).EntityName;
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName));
return Loc.GetString("objective-condition-kill-person-title", ("targetName", targetName), ("job", jobName));
}
}

View File

@@ -9,6 +9,7 @@ using Robust.Shared.Localization;
using Robust.Shared.Utility;
using Robust.Shared.Serialization.Manager.Attributes;
using Content.Server.Traitor;
using Content.Server.Roles;
namespace Content.Server.Objectives.Conditions
{
@@ -38,16 +39,17 @@ namespace Content.Server.Objectives.Conditions
get
{
var targetName = string.Empty;
var jobName = Target?.CurrentJob?.Name ?? "Unknown";
if (Target == null)
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName));
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName), ("job", jobName));
if (Target.CharacterName != null)
targetName = Target.CharacterName;
else if (Target.OwnedEntity is {Valid: true} owned)
targetName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(owned).EntityName;
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName));
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName), ("job", jobName));
}
}

View File

@@ -1,2 +1,2 @@
objective-condition-kill-person-title = Kill {$targetName}
objective-condition-kill-person-title = Kill {$targetName}, {CAPITALIZE($job)}
objective-condition-kill-person-description = Do it however you like, just make sure they don't last the shift.

View File

@@ -1,2 +1,2 @@
objective-condition-other-traitor-alive-title = Ensure fellow traitor {$targetName} stays alive.
objective-condition-other-traitor-alive-title = Ensure fellow traitor {$targetName}, {CAPITALIZE($job)} stays alive.
objective-condition-other-traitor-alive-description = Identify yourself at your own risk. We just need them alive.