From: Wrexbe (Josh) <81056464+wrexbe@users.noreply.github.com> Date: Sat, 30 Mar 2024 23:50:29 +0000 (-0700) Subject: Fix round start crash (causing instant restart) (#26579) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=a23ff527d450e02ea4ba71e3e49edc65a4d2eb62;p=space-station-14.git Fix round start crash (causing instant restart) (#26579) * Fix round start crash * Make `TryCreateObjective` more error tolerant --- diff --git a/Content.Shared/Objectives/Systems/SharedObjectivesSystem.cs b/Content.Shared/Objectives/Systems/SharedObjectivesSystem.cs index 2e1bdc4383..07032a00ce 100644 --- a/Content.Shared/Objectives/Systems/SharedObjectivesSystem.cs +++ b/Content.Shared/Objectives/Systems/SharedObjectivesSystem.cs @@ -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 _metaQuery; @@ -55,6 +57,9 @@ public abstract class SharedObjectivesSystem : EntitySystem /// public EntityUid? TryCreateObjective(EntityUid mindId, MindComponent mind, string proto) { + if (!_protoMan.HasIndex(proto)) + return null; + var uid = Spawn(proto); if (!TryComp(uid, out var comp)) { diff --git a/Resources/Prototypes/Objectives/objectiveGroups.yml b/Resources/Prototypes/Objectives/objectiveGroups.yml index 83921ec983..ff126eb5d1 100644 --- a/Resources/Prototypes/Objectives/objectiveGroups.yml +++ b/Resources/Prototypes/Objectives/objectiveGroups.yml @@ -72,7 +72,6 @@ TechnologyDiskStealCollectionObjective: 1 #rnd FigurineStealCollectionObjective: 0.3 #service IDCardsStealCollectionObjective: 1 - CannabisStealCollectionObjective: 1 LAMPStealCollectionObjective: 2 #only for moth - type: weightedRandom