Fix antag objectives always overshooting MaxDifficulty (and kill tries20) (#29830)
* The death of try20 * Add integration test for traitor gamerule * Fix max difficulty being overshot * Check at least one objective is assigned * EntProtoId
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Mind;
|
||||
using Content.Shared.Objectives;
|
||||
using Content.Shared.Objectives.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -40,7 +40,7 @@ public abstract class SharedObjectivesSystem : EntitySystem
|
||||
if (comp.Unique)
|
||||
{
|
||||
var proto = _metaQuery.GetComponent(uid).EntityPrototype?.ID;
|
||||
foreach (var objective in mind.AllObjectives)
|
||||
foreach (var objective in mind.Objectives)
|
||||
{
|
||||
if (_metaQuery.GetComponent(objective).EntityPrototype?.ID == proto)
|
||||
return false;
|
||||
@@ -92,7 +92,18 @@ public abstract class SharedObjectivesSystem : EntitySystem
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the title, description, icon and progress of an objective using <see cref="ObjectiveGetProgressEvent"/>.
|
||||
/// Spawns and assigns an objective for a mind.
|
||||
/// The objective is not added to the mind's objectives, mind system does that in TryAddObjective.
|
||||
/// If the objective could not be assigned the objective is deleted and false is returned.
|
||||
/// </summary>
|
||||
public bool TryCreateObjective(Entity<MindComponent> mind, EntProtoId proto, [NotNullWhen(true)] out EntityUid? objective)
|
||||
{
|
||||
objective = TryCreateObjective(mind.Owner, mind.Comp, proto);
|
||||
return objective != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the title, description, icon and progress of an objective using <see cref="ObjectiveGetInfoEvent"/>.
|
||||
/// If any of them are null it is logged and null is returned.
|
||||
/// </summary>
|
||||
/// <param name="uid"/>ID of the condition entity</param>
|
||||
|
||||
Reference in New Issue
Block a user