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:
@@ -3,6 +3,8 @@ using Content.Server.Objectives.Interfaces;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Server.Traitor;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.GameTicking.Rules;
|
||||
|
||||
namespace Content.Server.Objectives.Conditions
|
||||
{
|
||||
@@ -14,17 +16,10 @@ namespace Content.Server.Objectives.Conditions
|
||||
public IObjectiveCondition GetAssigned(Mind.Mind mind)
|
||||
{
|
||||
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 (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)};
|
||||
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 };
|
||||
}
|
||||
|
||||
public string Title
|
||||
|
||||
Reference in New Issue
Block a user