diff --git a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs index e72e9d5f73..3568f17306 100644 --- a/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs +++ b/Content.Server/GameTicking/Rules/TraitorRuleSystem.cs @@ -170,12 +170,18 @@ public sealed class TraitorRuleSystem : GameRuleSystem 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); } diff --git a/Content.Server/Traitor/Uplink/UplinkSystem.cs b/Content.Server/Traitor/Uplink/UplinkSystem.cs index e4aa7b5ec1..e8ed868dfb 100644 --- a/Content.Server/Traitor/Uplink/UplinkSystem.cs +++ b/Content.Server/Traitor/Uplink/UplinkSystem.cs @@ -102,7 +102,10 @@ public sealed class UplinkSystem : EntitySystem var implant = _subdermalImplant.AddImplant(user, FallbackUplinkImplant); if (!HasComp(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(pdaUid.ContainedEntity.Value) || HasComp(pdaUid.ContainedEntity.Value)) - return pdaUid.ContainedEntity.Value; + if (HasComp(pdaUid) && HasComp(pdaUid)) + return pdaUid; } } // Also check hands foreach (var item in _handsSystem.EnumerateHeld(user)) { - if (HasComp(item) || HasComp(item)) + if (HasComp(item) && HasComp(item)) return item; }