Suspicion improvements:
1. pull settings from cvars. 2. Fix greet. Fixes #1823
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
using Content.Server.GameObjects.Components.Suspicion;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Server.Interfaces.Chat;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Mobs.Roles
|
||||
{
|
||||
@@ -22,26 +21,25 @@ namespace Content.Server.Mobs.Roles
|
||||
public string Objective => Prototype.Objective;
|
||||
public override bool Antagonist { get; }
|
||||
|
||||
public override void Greet()
|
||||
public void GreetSuspicion(List<SuspicionTraitorRole> traitors, IChatManager chatMgr)
|
||||
{
|
||||
base.Greet();
|
||||
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("You're a {0}!", Name));
|
||||
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("Objective: {0}", Objective));
|
||||
|
||||
var chat = IoCManager.Resolve<IChatManager>();
|
||||
chat.DispatchServerMessage(Mind.Session, $"You're a {Name}!");
|
||||
chat.DispatchServerMessage(Mind.Session, $"Objective: {Objective}");
|
||||
|
||||
var traitors = "";
|
||||
|
||||
foreach (var sus in IoCManager.Resolve<IComponentManager>().EntityQuery<SuspicionRoleComponent>())
|
||||
if (traitors.Count == 1)
|
||||
{
|
||||
if (!sus.IsTraitor()) continue;
|
||||
if (traitors.Length > 0)
|
||||
traitors += $", {sus.Owner.Name}";
|
||||
else
|
||||
traitors += sus.Owner.Name;
|
||||
// Only traitor.
|
||||
chatMgr.DispatchServerMessage(Mind.Session, Loc.GetString("You're on your own. Good luck!"));
|
||||
return;
|
||||
}
|
||||
|
||||
chat.DispatchServerMessage(Mind.Session, $"The traitors are: {traitors}");
|
||||
|
||||
var text = string.Join(", ", traitors.Where(p => p != this).Select(p => p.Mind.CharacterName));
|
||||
|
||||
var pluralText = Loc.GetPluralString("Your partner in crime is: {0}",
|
||||
"Your partners in crime are: {0}",
|
||||
traitors.Count-1, text);
|
||||
|
||||
chatMgr.DispatchServerMessage(Mind.Session, pluralText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user