]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Objectives that do not fit requirements are now deleted (#38365)
authorbeck-thompson <107373427+beck-thompson@users.noreply.github.com>
Mon, 16 Jun 2025 22:54:11 +0000 (15:54 -0700)
committerGitHub <noreply@github.com>
Mon, 16 Jun 2025 22:54:11 +0000 (18:54 -0400)
* Fix

* Update Content.Server/Objectives/ObjectivesSystem.cs

Thanks Tayrathn!

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
---------

Co-authored-by: Tayrtahn <tayrtahn@gmail.com>
Content.Server/Objectives/ObjectivesSystem.cs

index 39effb9bdb473a17ec11e93a6aa2cdc95616dbef..1b20d65c45f8676bb2fc543d32fa497866b7cf2b 100644 (file)
@@ -244,8 +244,10 @@ public sealed class ObjectivesSystem : SharedObjectivesSystem
             var objectives = group.Weights.ShallowClone();
             while (_random.TryPickAndTake(objectives, out var objectiveProto))
             {
-                if (TryCreateObjective((mindId, mind), objectiveProto, out var objective)
-                    && Comp<ObjectiveComponent>(objective.Value).Difficulty <= maxDifficulty)
+                if (!_prototypeManager.Index(objectiveProto).TryGetComponent<ObjectiveComponent>(out var objectiveComp, EntityManager.ComponentFactory))
+                    continue;
+
+                if (objectiveComp.Difficulty <= maxDifficulty && TryCreateObjective((mindId, mind), objectiveProto, out var objective))
                     return objective;
             }
         }