fix several traitor objective bugs (#12212)

This commit is contained in:
Rane
2022-11-03 22:58:19 -04:00
committed by GitHub
parent de534070ae
commit 6f53e9c459
4 changed files with 24 additions and 47 deletions

View File

@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.Objectives.Interfaces;
using Robust.Shared.Random;
using Robust.Shared.Utility;
@@ -13,21 +14,11 @@ namespace Content.Server.Objectives.Conditions
public IObjectiveCondition GetAssigned(Mind.Mind mind)
{
var entityMgr = IoCManager.Resolve<IEntityManager>();
var traitors = EntitySystem.Get<TraitorRuleSystem>().Traitors;
var traitors = entityMgr.EntitySysManager.GetEntitySystem<TraitorRuleSystem>().GetOtherTraitorsAliveAndConnected(mind).ToList();
List<Traitor.TraitorRole> removeList = new();
foreach (var traitor in traitors)
{
if (traitor.Mind == null)
{
removeList.Add(traitor);
continue;
}
if (traitor.Mind == mind)
{
removeList.Add(traitor);
continue;
}
foreach (var objective in traitor.Mind.AllObjectives)
{
foreach (var condition in objective.Conditions)
@@ -59,9 +50,7 @@ namespace Content.Server.Objectives.Conditions
if (_target == null)
return Loc.GetString("objective-condition-other-traitor-progress-title", ("targetName", targetName), ("job", jobName));
if (_target.CharacterName != null)
targetName = _target.CharacterName;
else if (_target.OwnedEntity is {Valid: true} owned)
if (_target.OwnedEntity is {Valid: true} owned)
targetName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(owned).EntityName;
return Loc.GetString("objective-condition-other-traitor-progress-title", ("targetName", targetName), ("job", jobName));