Antag menu (#9900)
* Refactor traitor generation code. * RandomTraitorAlive no longer crashes when 1 traitor. Also cleaner/faster * Add Antag menu for admins, add Traitor to the list. * Add zombie to admin-antag menu * Pirates, lone op, make traitor consistent with the rest. * Add name strings * cleaned usings. * Cleanup. Co-authored-by: drakewill <drake@drakewill-crl> Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
106
Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Normal file
106
Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
using Content.Server.GameTicking.Rules;
|
||||||
|
using Content.Server.Mind.Components;
|
||||||
|
using Content.Server.Zombies;
|
||||||
|
using Content.Shared.Administration;
|
||||||
|
using Content.Shared.Database;
|
||||||
|
using Content.Shared.Verbs;
|
||||||
|
using Robust.Server.GameObjects;
|
||||||
|
using Robust.Shared.Configuration;
|
||||||
|
|
||||||
|
namespace Content.Server.Administration.Systems;
|
||||||
|
|
||||||
|
public sealed partial class AdminVerbSystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||||
|
[Dependency] private readonly ZombifyOnDeathSystem _zombify = default!;
|
||||||
|
[Dependency] private readonly TraitorRuleSystem _traitorRule = default!;
|
||||||
|
[Dependency] private readonly NukeopsRuleSystem _nukeopsRule = default!;
|
||||||
|
[Dependency] private readonly PiratesRuleSystem _piratesRule = default!;
|
||||||
|
|
||||||
|
// All antag verbs have names so invokeverb works.
|
||||||
|
private void AddAntagVerbs(GetVerbsEvent<Verb> args)
|
||||||
|
{
|
||||||
|
if (!EntityManager.TryGetComponent<ActorComponent?>(args.User, out var actor))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var player = actor.PlayerSession;
|
||||||
|
|
||||||
|
if (!_adminManager.HasAdminFlag(player, AdminFlags.Fun))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var targetHasMind = TryComp(args.Target, out MindComponent? targetMindComp);
|
||||||
|
if (!targetHasMind || targetMindComp == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Verb traitor = new()
|
||||||
|
{
|
||||||
|
Text = "Make Traitor",
|
||||||
|
Category = VerbCategory.Antag,
|
||||||
|
IconTexture = "/Textures/Structures/Wallmounts/posters.rsi/poster5_contraband.png",
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
if (targetMindComp.Mind == null || targetMindComp.Mind.Session == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_traitorRule.MakeTraitor(targetMindComp.Mind.Session);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.High,
|
||||||
|
Message = Loc.GetString("admin-verb-make-traitor"),
|
||||||
|
};
|
||||||
|
args.Verbs.Add(traitor);
|
||||||
|
|
||||||
|
Verb zombie = new()
|
||||||
|
{
|
||||||
|
Text = "Make Zombie",
|
||||||
|
Category = VerbCategory.Antag,
|
||||||
|
IconTexture = "/Textures/Structures/Wallmounts/signs.rsi/bio.png",
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
TryComp(args.Target, out MindComponent? mindComp);
|
||||||
|
if (mindComp == null || mindComp.Mind == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_zombify.ZombifyEntity(targetMindComp.Owner);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.High,
|
||||||
|
Message = Loc.GetString("admin-verb-make-zombie"),
|
||||||
|
};
|
||||||
|
args.Verbs.Add(zombie);
|
||||||
|
|
||||||
|
|
||||||
|
Verb nukeOp = new()
|
||||||
|
{
|
||||||
|
Text = "Make nuclear operative",
|
||||||
|
Category = VerbCategory.Antag,
|
||||||
|
IconTexture = "/Textures/Structures/Wallmounts/signs.rsi/radiation.png",
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
if (targetMindComp.Mind == null || targetMindComp.Mind.Session == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_nukeopsRule.MakeLoneNukie(targetMindComp.Mind);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.High,
|
||||||
|
Message = Loc.GetString("admin-verb-make-nuclear-operative"),
|
||||||
|
};
|
||||||
|
args.Verbs.Add(nukeOp);
|
||||||
|
|
||||||
|
Verb pirate = new()
|
||||||
|
{
|
||||||
|
Text = "Make Pirate",
|
||||||
|
Category = VerbCategory.Antag,
|
||||||
|
IconTexture = "/Textures/Clothing/Head/Hats/pirate.rsi/icon.png",
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
if (targetMindComp.Mind == null || targetMindComp.Mind.Session == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_piratesRule.MakePirate(targetMindComp.Mind);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.High,
|
||||||
|
Message = Loc.GetString("admin-verb-make-pirate"),
|
||||||
|
};
|
||||||
|
args.Verbs.Add(pirate);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,6 +53,7 @@ namespace Content.Server.Administration.Systems
|
|||||||
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddAdminVerbs);
|
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddAdminVerbs);
|
||||||
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddDebugVerbs);
|
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddDebugVerbs);
|
||||||
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddSmiteVerbs);
|
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddSmiteVerbs);
|
||||||
|
SubscribeLocalEvent<GetVerbsEvent<Verb>>(AddAntagVerbs);
|
||||||
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
SubscribeLocalEvent<RoundRestartCleanupEvent>(Reset);
|
||||||
SubscribeLocalEvent<SolutionContainerManagerComponent, SolutionChangedEvent>(OnSolutionChanged);
|
SubscribeLocalEvent<SolutionContainerManagerComponent, SolutionChangedEvent>(OnSolutionChanged);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ using Robust.Shared.Prototypes;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Content.Server.Traitor;
|
using Content.Server.Traitor;
|
||||||
|
using System.Data;
|
||||||
|
|
||||||
namespace Content.Server.GameTicking.Rules;
|
namespace Content.Server.GameTicking.Rules;
|
||||||
|
|
||||||
@@ -287,6 +288,16 @@ public sealed class NukeopsRuleSystem : GameRuleSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//For admins forcing someone to nukeOps.
|
||||||
|
public void MakeLoneNukie(Mind.Mind mind)
|
||||||
|
{
|
||||||
|
if (!mind.OwnedEntity.HasValue)
|
||||||
|
return;
|
||||||
|
|
||||||
|
mind.AddRole(new TraitorRole(mind, _prototypeManager.Index<AntagPrototype>(NukeopsPrototypeId)));
|
||||||
|
_stationSpawningSystem.EquipStartingGear(mind.OwnedEntity.Value, _prototypeManager.Index<StartingGearPrototype>("SyndicateOperativeGearFull"), null);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
||||||
{
|
{
|
||||||
if (!RuleAdded)
|
if (!RuleAdded)
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ public sealed class PiratesRuleSystem : GameRuleSystem
|
|||||||
if (spawns.Count == 0)
|
if (spawns.Count == 0)
|
||||||
{
|
{
|
||||||
spawns.Add(Transform(_pirateShip).Coordinates);
|
spawns.Add(Transform(_pirateShip).Coordinates);
|
||||||
Logger.WarningS("pirates", $"Fell back to default spawn for nukies!");
|
Logger.WarningS("pirates", $"Fell back to default spawn for pirates!");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < ops.Length; i++)
|
for (var i = 0; i < ops.Length; i++)
|
||||||
@@ -223,6 +223,14 @@ public sealed class PiratesRuleSystem : GameRuleSystem
|
|||||||
}); // Include the players in the appraisal.
|
}); // Include the players in the appraisal.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Forcing one player to be a pirate.
|
||||||
|
public void MakePirate(Mind.Mind mind)
|
||||||
|
{
|
||||||
|
if (!mind.OwnedEntity.HasValue)
|
||||||
|
return;
|
||||||
|
_stationSpawningSystem.EquipStartingGear(mind.OwnedEntity.Value, _prototypeManager.Index<StartingGearPrototype>("PirateGear"), null);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
||||||
{
|
{
|
||||||
if (!RuleAdded)
|
if (!RuleAdded)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Server.GameTicking.Rules.Configurations;
|
using Content.Server.GameTicking.Rules.Configurations;
|
||||||
@@ -34,11 +35,12 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
public override string Prototype => "Traitor";
|
public override string Prototype => "Traitor";
|
||||||
|
|
||||||
private readonly SoundSpecifier _addedSound = new SoundPathSpecifier("/Audio/Misc/tatoralert.ogg");
|
private readonly SoundSpecifier _addedSound = new SoundPathSpecifier("/Audio/Misc/tatoralert.ogg");
|
||||||
private readonly List<TraitorRole> _traitors = new ();
|
public List<TraitorRole> Traitors = new();
|
||||||
|
|
||||||
private const string TraitorPrototypeID = "Traitor";
|
private const string TraitorPrototypeID = "Traitor";
|
||||||
|
|
||||||
public int TotalTraitors => _traitors.Count;
|
public int TotalTraitors => Traitors.Count;
|
||||||
|
public string[] Codewords = new string[3];
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -49,15 +51,16 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
|
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Started() {}
|
public override void Started(){}
|
||||||
|
|
||||||
public override void Ended()
|
public override void Ended()
|
||||||
{
|
{
|
||||||
_traitors.Clear();
|
Traitors.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
||||||
{
|
{
|
||||||
|
MakeCodewords();
|
||||||
if (!RuleAdded)
|
if (!RuleAdded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -84,6 +87,21 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MakeCodewords()
|
||||||
|
{
|
||||||
|
|
||||||
|
var codewordCount = _cfg.GetCVar(CCVars.TraitorCodewordCount);
|
||||||
|
var adjectives = _prototypeManager.Index<DatasetPrototype>("adjectives").Values;
|
||||||
|
var verbs = _prototypeManager.Index<DatasetPrototype>("verbs").Values;
|
||||||
|
var codewordPool = adjectives.Concat(verbs).ToList();
|
||||||
|
var finalCodewordCount = Math.Min(codewordCount, codewordPool.Count);
|
||||||
|
Codewords = new string[finalCodewordCount];
|
||||||
|
for (var i = 0; i < finalCodewordCount; i++)
|
||||||
|
{
|
||||||
|
Codewords[i] = _random.PickAndTake(codewordPool);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnPlayersSpawned(RulePlayerJobsAssignedEvent ev)
|
private void OnPlayersSpawned(RulePlayerJobsAssignedEvent ev)
|
||||||
{
|
{
|
||||||
if (!RuleAdded)
|
if (!RuleAdded)
|
||||||
@@ -91,13 +109,19 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
|
|
||||||
var playersPerTraitor = _cfg.GetCVar(CCVars.TraitorPlayersPerTraitor);
|
var playersPerTraitor = _cfg.GetCVar(CCVars.TraitorPlayersPerTraitor);
|
||||||
var maxTraitors = _cfg.GetCVar(CCVars.TraitorMaxTraitors);
|
var maxTraitors = _cfg.GetCVar(CCVars.TraitorMaxTraitors);
|
||||||
var codewordCount = _cfg.GetCVar(CCVars.TraitorCodewordCount);
|
var numTraitors = MathHelper.Clamp(ev.Players.Length / playersPerTraitor, 1, maxTraitors);
|
||||||
var startingBalance = _cfg.GetCVar(CCVars.TraitorStartingBalance);
|
|
||||||
var maxDifficulty = _cfg.GetCVar(CCVars.TraitorMaxDifficulty);
|
|
||||||
var maxPicks = _cfg.GetCVar(CCVars.TraitorMaxPicks);
|
|
||||||
|
|
||||||
|
var traitorPool = FindPotentialTraitors(ev);
|
||||||
|
var selectedTraitors = PickTraitors(numTraitors, traitorPool);
|
||||||
|
|
||||||
|
foreach (var traitor in selectedTraitors)
|
||||||
|
MakeTraitor(traitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IPlayerSession> FindPotentialTraitors(RulePlayerJobsAssignedEvent ev)
|
||||||
|
{
|
||||||
var list = new List<IPlayerSession>(ev.Players).Where(x =>
|
var list = new List<IPlayerSession>(ev.Players).Where(x =>
|
||||||
x.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job {CanBeAntag: false}) ?? false
|
x.Data.ContentData()?.Mind?.AllRoles.All(role => role is not Job { CanBeAntag: false }) ?? false
|
||||||
).ToList();
|
).ToList();
|
||||||
|
|
||||||
var prefList = new List<IPlayerSession>();
|
var prefList = new List<IPlayerSession>();
|
||||||
@@ -114,85 +138,77 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
prefList.Add(player);
|
prefList.Add(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (prefList.Count == 0)
|
||||||
var numTraitors = MathHelper.Clamp(ev.Players.Length / playersPerTraitor,
|
|
||||||
1, maxTraitors);
|
|
||||||
|
|
||||||
for (var i = 0; i < numTraitors; i++)
|
|
||||||
{
|
{
|
||||||
IPlayerSession traitor;
|
Logger.InfoS("preset", "Insufficient preferred traitors, picking at random.");
|
||||||
if(prefList.Count == 0)
|
prefList = list;
|
||||||
{
|
}
|
||||||
if (list.Count == 0)
|
return prefList;
|
||||||
{
|
}
|
||||||
Logger.InfoS("preset", "Insufficient ready players to fill up with traitors, stopping the selection.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
traitor = _random.PickAndTake(list);
|
|
||||||
Logger.InfoS("preset", "Insufficient preferred traitors, picking at random.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
traitor = _random.PickAndTake(prefList);
|
|
||||||
list.Remove(traitor);
|
|
||||||
Logger.InfoS("preset", "Selected a preferred traitor.");
|
|
||||||
}
|
|
||||||
var mind = traitor.Data.ContentData()?.Mind;
|
|
||||||
if (mind == null)
|
|
||||||
{
|
|
||||||
Logger.ErrorS("preset", "Failed getting mind for picked traitor.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// creadth: we need to create uplink for the antag.
|
public List<IPlayerSession> PickTraitors(int traitorCount, List<IPlayerSession> prefList)
|
||||||
// PDA should be in place already, so we just need to
|
{
|
||||||
// initiate uplink account.
|
var results = new List<IPlayerSession>(traitorCount);
|
||||||
DebugTools.AssertNotNull(mind.OwnedEntity);
|
if (prefList.Count == 0)
|
||||||
|
{
|
||||||
|
Logger.InfoS("preset", "Insufficient ready players to fill up with traitors, stopping the selection.");
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < traitorCount; i++)
|
||||||
|
{
|
||||||
|
results.Add(_random.PickAndTake(prefList));
|
||||||
|
Logger.InfoS("preset", "Selected a preferred traitor.");
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity!);
|
public bool MakeTraitor(IPlayerSession traitor)
|
||||||
var accounts = EntityManager.EntitySysManager.GetEntitySystem<UplinkAccountsSystem>();
|
{
|
||||||
accounts.AddNewAccount(uplinkAccount);
|
var mind = traitor.Data.ContentData()?.Mind;
|
||||||
|
if (mind == null)
|
||||||
if (!EntityManager.EntitySysManager.GetEntitySystem<UplinkSystem>()
|
{
|
||||||
.AddUplink(mind.OwnedEntity!.Value, uplinkAccount))
|
Logger.ErrorS("preset", "Failed getting mind for picked traitor.");
|
||||||
continue;
|
return false;
|
||||||
|
|
||||||
var antagPrototype = _prototypeManager.Index<AntagPrototype>(TraitorPrototypeID);
|
|
||||||
var traitorRole = new TraitorRole(mind, antagPrototype);
|
|
||||||
mind.AddRole(traitorRole);
|
|
||||||
_traitors.Add(traitorRole);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var adjectives = _prototypeManager.Index<DatasetPrototype>("adjectives").Values;
|
// creadth: we need to create uplink for the antag.
|
||||||
var verbs = _prototypeManager.Index<DatasetPrototype>("verbs").Values;
|
// PDA should be in place already, so we just need to
|
||||||
|
// initiate uplink account.
|
||||||
|
DebugTools.AssertNotNull(mind.OwnedEntity);
|
||||||
|
|
||||||
var codewordPool = adjectives.Concat(verbs).ToList();
|
var startingBalance = _cfg.GetCVar(CCVars.TraitorStartingBalance);
|
||||||
var finalCodewordCount = Math.Min(codewordCount, codewordPool.Count);
|
var uplinkAccount = new UplinkAccount(startingBalance, mind.OwnedEntity!);
|
||||||
var codewords = new string[finalCodewordCount];
|
var accounts = EntityManager.EntitySysManager.GetEntitySystem<UplinkAccountsSystem>();
|
||||||
for (var i = 0; i < finalCodewordCount; i++)
|
accounts.AddNewAccount(uplinkAccount);
|
||||||
|
|
||||||
|
if (!EntityManager.EntitySysManager.GetEntitySystem<UplinkSystem>().AddUplink(mind.OwnedEntity!.Value, uplinkAccount))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var antagPrototype = _prototypeManager.Index<AntagPrototype>(TraitorPrototypeID);
|
||||||
|
var traitorRole = new TraitorRole(mind, antagPrototype);
|
||||||
|
mind.AddRole(traitorRole);
|
||||||
|
Traitors.Add(traitorRole);
|
||||||
|
traitorRole.GreetTraitor(Codewords);
|
||||||
|
|
||||||
|
var maxDifficulty = _cfg.GetCVar(CCVars.TraitorMaxDifficulty);
|
||||||
|
var maxPicks = _cfg.GetCVar(CCVars.TraitorMaxPicks);
|
||||||
|
|
||||||
|
//give traitors their objectives
|
||||||
|
var difficulty = 0f;
|
||||||
|
for (var pick = 0; pick < maxPicks && maxDifficulty > difficulty; pick++)
|
||||||
{
|
{
|
||||||
codewords[i] = _random.PickAndTake(codewordPool);
|
var objective = _objectivesManager.GetRandomObjective(traitorRole.Mind);
|
||||||
|
if (objective == null) continue;
|
||||||
|
if (traitorRole.Mind.TryAddObjective(objective))
|
||||||
|
difficulty += objective.Difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var traitor in _traitors)
|
//give traitors their codewords to keep in their character info menu
|
||||||
{
|
traitorRole.Mind.Briefing = Loc.GetString("traitor-role-codewords", ("codewords", string.Join(", ", Codewords)));
|
||||||
traitor.GreetTraitor(codewords);
|
|
||||||
|
|
||||||
//give traitors their objectives
|
SoundSystem.Play(_addedSound.GetSound(), Filter.Empty().AddPlayer(traitor), AudioParams.Default);
|
||||||
var difficulty = 0f;
|
return true;
|
||||||
for (var pick = 0; pick < maxPicks && maxDifficulty > difficulty; pick++)
|
|
||||||
{
|
|
||||||
var objective = _objectivesManager.GetRandomObjective(traitor.Mind);
|
|
||||||
if (objective == null) continue;
|
|
||||||
if (traitor.Mind.TryAddObjective(objective))
|
|
||||||
difficulty += objective.Difficulty;
|
|
||||||
}
|
|
||||||
|
|
||||||
//give traitors their codewords to keep in their character info menu
|
|
||||||
traitor.Mind.Briefing = Loc.GetString("traitor-role-codewords", ("codewords", string.Join(", ",codewords)));
|
|
||||||
}
|
|
||||||
|
|
||||||
SoundSystem.Play(_addedSound.GetSound(), Filter.Empty().AddWhere(s => ((IPlayerSession)s).Data.ContentData()?.Mind?.HasRole<TraitorRole>() ?? false), AudioParams.Default);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRoundEndText(RoundEndTextAppendEvent ev)
|
private void OnRoundEndText(RoundEndTextAppendEvent ev)
|
||||||
@@ -200,9 +216,9 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
if (!RuleAdded)
|
if (!RuleAdded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var result = Loc.GetString("traitor-round-end-result", ("traitorCount", _traitors.Count));
|
var result = Loc.GetString("traitor-round-end-result", ("traitorCount", Traitors.Count));
|
||||||
|
|
||||||
foreach (var traitor in _traitors)
|
foreach (var traitor in Traitors)
|
||||||
{
|
{
|
||||||
var name = traitor.Mind.CharacterName;
|
var name = traitor.Mind.CharacterName;
|
||||||
traitor.Mind.TryGetSession(out var session);
|
traitor.Mind.TryGetSession(out var session);
|
||||||
@@ -264,7 +280,6 @@ public sealed class TraitorRuleSystem : GameRuleSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ev.AddLine(result);
|
ev.AddLine(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ using Content.Server.Objectives.Interfaces;
|
|||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Content.Server.Traitor;
|
using Content.Server.Traitor;
|
||||||
|
using Content.Server.Mind;
|
||||||
|
using Content.Server.GameTicking.Rules;
|
||||||
|
|
||||||
namespace Content.Server.Objectives.Conditions
|
namespace Content.Server.Objectives.Conditions
|
||||||
{
|
{
|
||||||
@@ -14,17 +16,10 @@ namespace Content.Server.Objectives.Conditions
|
|||||||
public IObjectiveCondition GetAssigned(Mind.Mind mind)
|
public IObjectiveCondition GetAssigned(Mind.Mind mind)
|
||||||
{
|
{
|
||||||
var entityMgr = IoCManager.Resolve<IEntityManager>();
|
var entityMgr = IoCManager.Resolve<IEntityManager>();
|
||||||
var allOtherTraitors = new List<Mind.Mind>();
|
var traitors = EntitySystem.Get<TraitorRuleSystem>().Traitors;
|
||||||
|
|
||||||
foreach (var targetMind in entityMgr.EntityQuery<MindComponent>())
|
if (traitors.Count == 0) return new RandomTraitorAliveCondition { _target = mind }; //You were made a traitor by admins, and are the first/only.
|
||||||
{
|
return new RandomTraitorAliveCondition { _target = IoCManager.Resolve<IRobustRandom>().Pick(traitors).Mind };
|
||||||
if (targetMind.Mind?.CharacterDeadIC == false && targetMind.Mind != mind && targetMind.Mind?.HasRole<TraitorRole>() == true)
|
|
||||||
{
|
|
||||||
allOtherTraitors.Add(targetMind.Mind);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new RandomTraitorAliveCondition {_target = IoCManager.Resolve<IRobustRandom>().Pick(allOtherTraitors)};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Title
|
public string Title
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ namespace Content.Shared.Verbs
|
|||||||
public static readonly VerbCategory Admin =
|
public static readonly VerbCategory Admin =
|
||||||
new("verb-categories-admin", "/Textures/Interface/character.svg.192dpi.png");
|
new("verb-categories-admin", "/Textures/Interface/character.svg.192dpi.png");
|
||||||
|
|
||||||
|
public static readonly VerbCategory Antag =
|
||||||
|
new("verb-categories-antag", "/Textures/Interface/VerbIcons/antag-e_sword-temp.192dpi.png", iconsOnly: true) { Columns = 5 };
|
||||||
|
|
||||||
public static readonly VerbCategory Examine =
|
public static readonly VerbCategory Examine =
|
||||||
new("verb-categories-examine", "/Textures/Interface/VerbIcons/examine.svg.192dpi.png");
|
new("verb-categories-examine", "/Textures/Interface/VerbIcons/examine.svg.192dpi.png");
|
||||||
|
|
||||||
|
|||||||
5
Resources/Locale/en-US/administration/antag.ftl
Normal file
5
Resources/Locale/en-US/administration/antag.ftl
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
verb-categories-antag = Antag ctrl
|
||||||
|
admin-verb-make-traitor = Make the target into a traitor.
|
||||||
|
admin-verb-make-zombie = Zombifies the target immediately.
|
||||||
|
admin-verb-make-nuclear-operative = Make target a into lone Nuclear Operative.
|
||||||
|
admin-verb-make-pirate = Make the target into a pirate. Note this doesn't configure the game rule.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Reference in New Issue
Block a user