]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix(SpecialRespawn): Check if prototype exists before attemping to respawn it (#31140)
authorBrandon Hu <103440971+Brandon-Huu@users.noreply.github.com>
Tue, 20 Aug 2024 02:32:44 +0000 (02:32 +0000)
committerGitHub <noreply@github.com>
Tue, 20 Aug 2024 02:32:44 +0000 (22:32 -0400)
* 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>
Content.Server/Respawn/SpecialRespawnSystem.cs

index cbda98f2638910a40e7f29f0691bc14008122d84..8c86449008ab4ee9f5b248c01bb1cc7468d7891c 100644 (file)
@@ -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);