Fix round start crash (causing instant restart) (#26579)
* Fix round start crash * Make `TryCreateObjective` more error tolerant
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Objectives;
|
using Content.Shared.Objectives;
|
||||||
using Content.Shared.Objectives.Components;
|
using Content.Shared.Objectives.Components;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Shared.Objectives.Systems;
|
namespace Content.Shared.Objectives.Systems;
|
||||||
@@ -11,6 +12,7 @@ namespace Content.Shared.Objectives.Systems;
|
|||||||
public abstract class SharedObjectivesSystem : EntitySystem
|
public abstract class SharedObjectivesSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SharedMindSystem _mind = default!;
|
[Dependency] private readonly SharedMindSystem _mind = default!;
|
||||||
|
[Dependency] private readonly IPrototypeManager _protoMan = default!;
|
||||||
|
|
||||||
private EntityQuery<MetaDataComponent> _metaQuery;
|
private EntityQuery<MetaDataComponent> _metaQuery;
|
||||||
|
|
||||||
@@ -55,6 +57,9 @@ public abstract class SharedObjectivesSystem : EntitySystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public EntityUid? TryCreateObjective(EntityUid mindId, MindComponent mind, string proto)
|
public EntityUid? TryCreateObjective(EntityUid mindId, MindComponent mind, string proto)
|
||||||
{
|
{
|
||||||
|
if (!_protoMan.HasIndex<EntityPrototype>(proto))
|
||||||
|
return null;
|
||||||
|
|
||||||
var uid = Spawn(proto);
|
var uid = Spawn(proto);
|
||||||
if (!TryComp<ObjectiveComponent>(uid, out var comp))
|
if (!TryComp<ObjectiveComponent>(uid, out var comp))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,7 +72,6 @@
|
|||||||
TechnologyDiskStealCollectionObjective: 1 #rnd
|
TechnologyDiskStealCollectionObjective: 1 #rnd
|
||||||
FigurineStealCollectionObjective: 0.3 #service
|
FigurineStealCollectionObjective: 0.3 #service
|
||||||
IDCardsStealCollectionObjective: 1
|
IDCardsStealCollectionObjective: 1
|
||||||
CannabisStealCollectionObjective: 1
|
|
||||||
LAMPStealCollectionObjective: 2 #only for moth
|
LAMPStealCollectionObjective: 2 #only for moth
|
||||||
|
|
||||||
- type: weightedRandom
|
- type: weightedRandom
|
||||||
|
|||||||
Reference in New Issue
Block a user