]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix round start crash (causing instant restart) (#26579)
authorWrexbe (Josh) <81056464+wrexbe@users.noreply.github.com>
Sat, 30 Mar 2024 23:50:29 +0000 (16:50 -0700)
committerGitHub <noreply@github.com>
Sat, 30 Mar 2024 23:50:29 +0000 (10:50 +1100)
* Fix round start crash

* Make `TryCreateObjective` more error tolerant

Content.Shared/Objectives/Systems/SharedObjectivesSystem.cs
Resources/Prototypes/Objectives/objectiveGroups.yml

index 2e1bdc43831dc4a203b9956a4cba088d9741e5aa..07032a00ce988e7f3b88def3f01b914124924195 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Shared.Mind;
 using Content.Shared.Objectives;
 using Content.Shared.Objectives.Components;
+using Robust.Shared.Prototypes;
 using Robust.Shared.Utility;
 
 namespace Content.Shared.Objectives.Systems;
@@ -11,6 +12,7 @@ namespace Content.Shared.Objectives.Systems;
 public abstract class SharedObjectivesSystem : EntitySystem
 {
     [Dependency] private readonly SharedMindSystem _mind = default!;
+    [Dependency] private readonly IPrototypeManager _protoMan = default!;
 
     private EntityQuery<MetaDataComponent> _metaQuery;
 
@@ -55,6 +57,9 @@ public abstract class SharedObjectivesSystem : EntitySystem
     /// </summary>
     public EntityUid? TryCreateObjective(EntityUid mindId, MindComponent mind, string proto)
     {
+        if (!_protoMan.HasIndex<EntityPrototype>(proto))
+            return null;
+
         var uid = Spawn(proto);
         if (!TryComp<ObjectiveComponent>(uid, out var comp))
         {
index 83921ec983ca65fb31792471702807f07c0e849a..ff126eb5d162f70cdd8b282caeb2bfda8f73dba9 100644 (file)
@@ -72,7 +72,6 @@
     TechnologyDiskStealCollectionObjective: 1        #rnd
     FigurineStealCollectionObjective: 0.3          #service
     IDCardsStealCollectionObjective: 1
-    CannabisStealCollectionObjective: 1
     LAMPStealCollectionObjective: 2 #only for moth
 
 - type: weightedRandom