Fix build and warnings

This commit is contained in:
Vera Aguilera Puerto
2020-12-01 17:23:46 +01:00
parent f7c09fbd7e
commit b8220a3cd6
3 changed files with 4 additions and 7 deletions

View File

@@ -20,9 +20,6 @@ namespace Content.Server.GameTicking.GameRules
public class RuleTraitor : GameRule public class RuleTraitor : GameRule
{ {
[Dependency] private readonly IChatManager _chatManager = default!; [Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IGameTicker _gameTicker = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
public override void Added() public override void Added()
{ {

View File

@@ -8,7 +8,7 @@ namespace Content.Server.Objectives.Interfaces
/// <summary> /// <summary>
/// Returns all objectives the provided mind is valid for. /// Returns all objectives the provided mind is valid for.
/// </summary> /// </summary>
IReadOnlyList<ObjectivePrototype> GetAllPossibleObjectives(Mind mind); IEnumerable<ObjectivePrototype> GetAllPossibleObjectives(Mind mind);
/// <summary> /// <summary>
/// Returns a randomly picked objective the provided mind is valid for. /// Returns a randomly picked objective the provided mind is valid for.

View File

@@ -16,14 +16,14 @@ namespace Content.Server.Objectives
[Dependency] private IPrototypeManager _prototypeManager = default!; [Dependency] private IPrototypeManager _prototypeManager = default!;
[Dependency] private IRobustRandom _random = default!; [Dependency] private IRobustRandom _random = default!;
public List<ObjectivePrototype> GetAllPossibleObjectives(Mind mind) public IEnumerable<ObjectivePrototype> GetAllPossibleObjectives(Mind mind)
{ {
return _prototypeManager.EnumeratePrototypes<ObjectivePrototype>().Where(objectivePrototype => objectivePrototype.CanBeAssigned(mind)).ToList(); return _prototypeManager.EnumeratePrototypes<ObjectivePrototype>().Where(objectivePrototype => objectivePrototype.CanBeAssigned(mind));
} }
public ObjectivePrototype? GetRandomObjective(Mind mind) public ObjectivePrototype? GetRandomObjective(Mind mind)
{ {
var objectives = GetAllPossibleObjectives(mind); var objectives = GetAllPossibleObjectives(mind).ToList();
_random.Shuffle(objectives); _random.Shuffle(objectives);
//to prevent endless loops //to prevent endless loops