]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
PAIs will no longer get uplinks instead of traitors when a player is selected as...
authorbeck-thompson <107373427+beck-thompson@users.noreply.github.com>
Fri, 24 Oct 2025 05:47:05 +0000 (22:47 -0700)
committerGitHub <noreply@github.com>
Fri, 24 Oct 2025 05:47:05 +0000 (05:47 +0000)
* Fix bug, add logging

* Fixes

Content.Server/GameTicking/Rules/TraitorRuleSystem.cs
Content.Server/Traitor/Uplink/UplinkSystem.cs

index e72e9d5f732313a582953470895e09dd2e005ed5..3568f17306f26ec6d59e13c95ca7b0517753cf90 100644 (file)
@@ -170,12 +170,18 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
                     Loc.GetString("traitor-role-uplink-code-short", ("code", string.Join("-", code).Replace("sharp", "#"))));
                 return (code, briefing);
             }
+
+            Log.Error($"MakeTraitor {ToPrettyString(traitor)} failed to generate an uplink code on {ToPrettyString(pda)}.");
         }
         else if (pda is null && uplinked)
         {
             Log.Debug($"MakeTraitor {ToPrettyString(traitor)} - Uplink is implant");
             briefing += "\n" + Loc.GetString("traitor-role-uplink-implant-short");
         }
+        else
+        {
+            Log.Error($"MakeTraitor failed on {ToPrettyString(traitor)} - No uplink could be added");
+        }
 
         return (null, briefing);
     }
index e4aa7b5ec170f888a9292c5f46484ea6290e2eab..e8ed868dfbc352f632f28184f071f4da8f6125c8 100644 (file)
@@ -102,7 +102,10 @@ public sealed class UplinkSystem : EntitySystem
         var implant = _subdermalImplant.AddImplant(user, FallbackUplinkImplant);
 
         if (!HasComp<StoreComponent>(implant))
+        {
+            Log.Error($"Implant does not have the store component {implant}");
             return false;
+        }
 
         SetUplink(user, implant.Value, balance, giveDiscounts);
         return true;
@@ -117,20 +120,19 @@ public sealed class UplinkSystem : EntitySystem
         // Try to find PDA in inventory
         if (_inventorySystem.TryGetContainerSlotEnumerator(user, out var containerSlotEnumerator))
         {
-            while (containerSlotEnumerator.MoveNext(out var pdaUid))
+            while (containerSlotEnumerator.MoveNext(out var containerSlot))
             {
-                if (!pdaUid.ContainedEntity.HasValue)
-                    continue;
+                var pdaUid = containerSlot.ContainedEntity;
 
-                if (HasComp<PdaComponent>(pdaUid.ContainedEntity.Value) || HasComp<StoreComponent>(pdaUid.ContainedEntity.Value))
-                    return pdaUid.ContainedEntity.Value;
+                if (HasComp<PdaComponent>(pdaUid) && HasComp<StoreComponent>(pdaUid))
+                    return pdaUid;
             }
         }
 
         // Also check hands
         foreach (var item in _handsSystem.EnumerateHeld(user))
         {
-            if (HasComp<PdaComponent>(item) || HasComp<StoreComponent>(item))
+            if (HasComp<PdaComponent>(item) && HasComp<StoreComponent>(item))
                 return item;
         }