fix(SpecialRespawn): Check if prototype exists before attemping to respawn it (#31140)
* Co-Authored-By: deltanedas <deltanedas@users.noreply.github.com> * _ * They're playing basketball Co-authored-by: deltanedas <@deltanedas:kde.org> * They're playing basketball Co-authored-by: deltanedas <deltanedas@users.noreply.github.com> --------- Co-authored-by: deltanedas <deltanedas@users.noreply.github.com>
This commit is contained in:
@@ -11,6 +11,7 @@ using Content.Shared.Respawn;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Respawn;
|
||||
|
||||
@@ -23,6 +24,7 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly TurfSystem _turf = default!;
|
||||
[Dependency] private readonly IChatManager _chat = default!;
|
||||
[Dependency] private readonly IPrototypeManager _proto = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -87,6 +89,10 @@ public sealed class SpecialRespawnSystem : SharedSpecialRespawnSystem
|
||||
if (!TryComp<MapGridComponent>(entityGridUid, out var grid) || MetaData(entityGridUid.Value).EntityLifeStage >= EntityLifeStage.Terminating)
|
||||
return;
|
||||
|
||||
//Invalid prototype
|
||||
if (!_proto.HasIndex(component.Prototype))
|
||||
return;
|
||||
|
||||
if (TryFindRandomTile(entityGridUid.Value, entityMapUid.Value, 10, out var coords))
|
||||
Respawn(uid, component.Prototype, coords);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user