-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;
[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()
{
{
// 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)
{
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<ObjectiveComponent>(o).Issuer))
{
return null;
}
+
+ /// <summary>
+ /// Returns whether a target is considered 'in custody' (cuffed on the shuttle).
+ /// </summary>
+ 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<CuffableComponent>(originalEntity, out var origCuffed) && origCuffed.CuffedHandCount > 0
+ && _emergencyShuttle.IsTargetEscaping(originalEntity.Value);
+ }
+
+ return originalEntityInCustody || (TryComp<CuffableComponent>(mind.OwnedEntity, out var cuffed) && cuffed.CuffedHandCount > 0
+ && _emergencyShuttle.IsTargetEscaping(mind.OwnedEntity.Value));
+ }
}
/// <summary>
*[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