]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
place stored changeling identities next to each other (#39452)
authorslarticodefast <161409025+slarticodefast@users.noreply.github.com>
Thu, 7 Aug 2025 12:38:09 +0000 (14:38 +0200)
committerGitHub <noreply@github.com>
Thu, 7 Aug 2025 12:38:09 +0000 (14:38 +0200)
Content.Shared/Changeling/ChangelingIdentitySystem.cs

index 8f704c49be3941453f4aaf45c520cd902e2d3a29..5e1fa25e4c19caca768a4d531e13cad2a990b63b 100644 (file)
@@ -23,6 +23,7 @@ public sealed class ChangelingIdentitySystem : EntitySystem
     [Dependency] private readonly SharedPvsOverrideSystem _pvsOverrideSystem = default!;
 
     public MapId? PausedMapId;
+    private int _numberOfStoredIdentities = 0; // TODO: remove this
 
     public override void Initialize()
     {
@@ -101,7 +102,11 @@ public sealed class ChangelingIdentitySystem : EntitySystem
             return null;
 
         EnsurePausedMap();
-        var mob = Spawn(speciesPrototype.Prototype, new MapCoordinates(Vector2.Zero, PausedMapId!.Value));
+        // TODO: Setting the spawn location is a shitty bandaid to prevent admins from crashing our servers.
+        // Movercontrollers and mob collisions are currently being calculated even for paused entities.
+        // Spawning all of them in the same spot causes severe performance problems.
+        // Cryopods and Polymorph have the same problem.
+        var mob = Spawn(speciesPrototype.Prototype, new MapCoordinates(new Vector2(2 * _numberOfStoredIdentities++, 0), PausedMapId!.Value));
 
         var storedIdentity = EnsureComp<ChangelingStoredIdentityComponent>(mob);
         storedIdentity.OriginalEntity = target; // TODO: network this once we have WeakEntityReference or the autonetworking source gen is fixed