Fix some build warnings (#6832)

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2022-02-21 14:41:50 +11:00
committed by GitHub
parent f9c853f100
commit b87806f7ed
36 changed files with 53 additions and 76 deletions

View File

@@ -16,22 +16,22 @@ namespace Content.Server.Objectives.Conditions
[DataDefinition]
public sealed class RandomTraitorAliveCondition : IObjectiveCondition
{
protected Mind.Mind? Target;
private Mind.Mind? _target;
public IObjectiveCondition GetAssigned(Mind.Mind mind)
{
var entityMgr = IoCManager.Resolve<IEntityManager>();
List<Mind.Mind> _allOtherTraitors = new List<Mind.Mind>();
var allOtherTraitors = new List<Mind.Mind>();
foreach (var targetMind in entityMgr.EntityQuery<MindComponent>())
{
if (targetMind.Mind?.CharacterDeadIC == false && targetMind.Mind != mind && targetMind.Mind?.HasRole<TraitorRole>() == true)
{
_allOtherTraitors.Add(targetMind.Mind);
allOtherTraitors.Add(targetMind.Mind);
}
}
return new RandomTraitorAliveCondition {Target = IoCManager.Resolve<IRobustRandom>().Pick(_allOtherTraitors)};
return new RandomTraitorAliveCondition {_target = IoCManager.Resolve<IRobustRandom>().Pick(allOtherTraitors)};
}
public string Title
@@ -39,14 +39,14 @@ namespace Content.Server.Objectives.Conditions
get
{
var targetName = string.Empty;
var jobName = Target?.CurrentJob?.Name ?? "Unknown";
var jobName = _target?.CurrentJob?.Name ?? "Unknown";
if (Target == null)
if (_target == null)
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName), ("job", jobName));
if (Target.CharacterName != null)
targetName = Target.CharacterName;
else if (Target.OwnedEntity is {Valid: true} owned)
if (_target.CharacterName != null)
targetName = _target.CharacterName;
else if (_target.OwnedEntity is {Valid: true} owned)
targetName = IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(owned).EntityName;
return Loc.GetString("objective-condition-other-traitor-alive-title", ("targetName", targetName), ("job", jobName));
@@ -57,13 +57,13 @@ namespace Content.Server.Objectives.Conditions
public SpriteSpecifier Icon => new SpriteSpecifier.Rsi(new ResourcePath("Objects/Misc/bureaucracy.rsi"), "folder-white");
public float Progress => (!Target?.CharacterDeadIC ?? true) ? 1f : 0f;
public float Progress => (!_target?.CharacterDeadIC ?? true) ? 1f : 0f;
public float Difficulty => 1.75f;
public bool Equals(IObjectiveCondition? other)
{
return other is RandomTraitorAliveCondition kpc && Equals(Target, kpc.Target);
return other is RandomTraitorAliveCondition kpc && Equals(_target, kpc._target);
}
public override bool Equals(object? obj)
@@ -75,7 +75,7 @@ namespace Content.Server.Objectives.Conditions
public override int GetHashCode()
{
return Target?.GetHashCode() ?? 0;
return _target?.GetHashCode() ?? 0;
}
}
}