Skip to content

Commit

Permalink
Fix round start crash (causing instant restart) (space-wizards#26579)
Browse files Browse the repository at this point in the history
* Fix round start crash

* Make `TryCreateObjective` more error tolerant
  • Loading branch information
wrexbe authored Mar 30, 2024
1 parent b8363cd commit a23ff52
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Content.Shared/Objectives/Systems/SharedObjectivesSystem.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -55,6 +57,9 @@ public bool CanBeAssigned(EntityUid uid, EntityUid mindId, MindComponent mind, O
/// </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))
{
Expand Down
1 change: 0 additions & 1 deletion Resources/Prototypes/Objectives/objectiveGroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
TechnologyDiskStealCollectionObjective: 1 #rnd
FigurineStealCollectionObjective: 0.3 #service
IDCardsStealCollectionObjective: 1
CannabisStealCollectionObjective: 1
LAMPStealCollectionObjective: 2 #only for moth

- type: weightedRandom
Expand Down

0 comments on commit a23ff52

Please sign in to comment.