diff --git a/Content.Server/Objectives/ObjectivesSystem.cs b/Content.Server/Objectives/ObjectivesSystem.cs index 3f7e92963a..511558216d 100644 --- a/Content.Server/Objectives/ObjectivesSystem.cs +++ b/Content.Server/Objectives/ObjectivesSystem.cs @@ -1,7 +1,10 @@ -using Content.Server.GameTicking; +using Content.Server.GameTicking; using Content.Server.GameTicking.Rules.Components; using Content.Server.Mind; +using Content.Server.Shuttles.Systems; +using Content.Shared.Cuffs.Components; using Content.Shared.Mind; +using Content.Shared.Mobs.Systems; using Content.Shared.Objectives.Components; using Content.Shared.Objectives.Systems; using Content.Shared.Random; @@ -18,6 +21,7 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly MindSystem _mind = default!; + [Dependency] private readonly EmergencyShuttleSystem _emergencyShuttle = default!; public override void Initialize() { @@ -71,12 +75,18 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem { // first get the total number of players that were in these game rules combined var total = 0; + var totalInCustody = 0; foreach (var (_, minds) in summary) { total += minds.Count; + totalInCustody += minds.Where(m => IsInCustody(m)).Count(); } var result = Loc.GetString("objectives-round-end-result", ("count", total), ("agent", agent)); + if (agent == Loc.GetString("traitor-round-end-agent-name")) + { + result += "\n" + Loc.GetString("objectives-round-end-result-in-custody", ("count", total), ("custody", totalInCustody), ("agent", agent)); + } // next add all the players with its own prepended text foreach (var (prepend, minds) in summary) { @@ -123,14 +133,16 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem result += "\n"; + var custody = IsInCustody(mindId, mind) ? Loc.GetString("objectives-in-custody") + " " : ""; + var objectives = mind.AllObjectives.ToArray(); if (objectives.Length == 0) { - result += Loc.GetString("objectives-no-objectives", ("title", title), ("agent", agent)); + result += Loc.GetString("objectives-no-objectives", ("custody", custody), ("title", title), ("agent", agent)); continue; } - result += Loc.GetString("objectives-with-objectives", ("title", title), ("agent", agent)); + result += Loc.GetString("objectives-with-objectives", ("custody", custody), ("title", title), ("agent", agent)); foreach (var objectiveGroup in objectives.GroupBy(o => Comp(o).Issuer)) { @@ -197,6 +209,27 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem return null; } + + /// + /// Returns whether a target is considered 'in custody' (cuffed on the shuttle). + /// + private bool IsInCustody(EntityUid mindId, MindComponent? mind = null) + { + if (!Resolve(mindId, ref mind)) + return false; + + // Ghosting will not save you + bool originalEntityInCustody = false; + EntityUid? originalEntity = GetEntity(mind.OriginalOwnedEntity); + if (originalEntity.HasValue && originalEntity != mind.OwnedEntity) + { + originalEntityInCustody = TryComp(originalEntity, out var origCuffed) && origCuffed.CuffedHandCount > 0 + && _emergencyShuttle.IsTargetEscaping(originalEntity.Value); + } + + return originalEntityInCustody || (TryComp(mind.OwnedEntity, out var cuffed) && cuffed.CuffedHandCount > 0 + && _emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value)); + } } /// diff --git a/Resources/Locale/en-US/objectives/round-end.ftl b/Resources/Locale/en-US/objectives/round-end.ftl index 4c0e5884ca..129d809823 100644 --- a/Resources/Locale/en-US/objectives/round-end.ftl +++ b/Resources/Locale/en-US/objectives/round-end.ftl @@ -3,12 +3,16 @@ objectives-round-end-result = {$count -> *[other] There were {$count} {MAKEPLURAL($agent)}. } +objectives-round-end-result-in-custody = {$custody} out of {$count} {MAKEPLURAL($agent)} were in custody. + objectives-player-user-named = [color=White]{$name}[/color] ([color=gray]{$user}[/color]) objectives-player-user = [color=gray]{$user}[/color] objectives-player-named = [color=White]{$name}[/color] -objectives-no-objectives = {$title} was a {$agent}. -objectives-with-objectives = {$title} was a {$agent} who had the following objectives: +objectives-no-objectives = [bold][color=red]{$custody}[/color]{$title} was a {$agent}. +objectives-with-objectives = [bold][color=red]{$custody}[/color]{$title} was a {$agent} who had the following objectives: objectives-objective-success = {$objective} | [color={$markupColor}]Success![/color] objectives-objective-fail = {$objective} | [color={$markupColor}]Failure![/color] ({$progress}%) + +objectives-in-custody = | IN CUSTODY | \ No newline at end of file