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:
Tayrtahn
2024-07-13 00:14:30 -04:00
committed by GitHub
parent de2ab29f34
commit 3388c0dcaa
5 changed files with 184 additions and 18 deletions

View File

@@ -39,7 +39,8 @@ public sealed class AntagRandomObjectivesSystem : EntitySystem
for (var pick = 0; pick < set.MaxPicks && ent.Comp.MaxDifficulty > difficulty; pick++)
{
if (_objectives.GetRandomObjective(mindId, mind, set.Groups) is not {} objective)
var remainingDifficulty = ent.Comp.MaxDifficulty - difficulty;
if (_objectives.GetRandomObjective(mindId, mind, set.Groups, remainingDifficulty) is not { } objective)
continue;
_mind.AddObjective(mindId, mind, objective);