]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix mains wire light (#31066)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Fri, 16 Aug 2024 03:59:46 +0000 (13:59 +1000)
committerGitHub <noreply@github.com>
Fri, 16 Aug 2024 03:59:46 +0000 (23:59 -0400)
No idea how long this was broken; mains wire relies upon this id being accurate which means it needs doing before the calls.

Content.Server/Wires/WiresSystem.cs

index 944b0a0e2500c02ee44b76e62d3bb361e880c275..e4439ae1da3574a63c75d4e08baa44a757b9f941 100644 (file)
@@ -151,19 +151,17 @@ public sealed class WiresSystem : SharedWiresSystem
             for (var i = 0; i < enumeratedList.Count; i++)
             {
                 (int id, Wire d) = enumeratedList[i];
+                d.Id = i;
 
                 if (d.Action != null)
                 {
                     var actionType = d.Action.GetType();
-                    if (types.ContainsKey(actionType))
+                    if (!types.TryAdd(actionType, 1))
                         types[actionType] += 1;
-                    else
-                        types.Add(actionType, 1);
 
                     if (!d.Action.AddWire(d, types[actionType]))
                         d.Action = null;
                 }
-                d.Id = i;
 
                 data.Add(id, new WireLayout.WireData(d.Letter, d.Color, i));
                 wires.WiresList[i] = wireSet[id];