]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
[HOTFIX] Fix Antags failing to roll. (#40658)
authorPrincess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Thu, 2 Oct 2025 16:52:07 +0000 (09:52 -0700)
committerGitHub <noreply@github.com>
Thu, 2 Oct 2025 16:52:07 +0000 (18:52 +0200)
Use TryGetCached instead of GetCached

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Content.Server/Antag/AntagSelectionSystem.API.cs

index 6703b7b7ca6ae6d90a5d59c10f358bd99a812ce0..5debd10b6e42e861f885abb7c3b39f6231321cdc 100644 (file)
@@ -174,7 +174,10 @@ public sealed partial class AntagSelectionSystem
         if (roles.Count == 0)
             return false;
 
-        var pref = (HumanoidCharacterProfile) _pref.GetPreferences(session.UserId).SelectedCharacter;
+        if (!_pref.TryGetCachedPreferences(session.UserId, out var pref))
+            return false;
+
+        var character = (HumanoidCharacterProfile) pref.SelectedCharacter;
 
         var valid = false;
 
@@ -183,8 +186,7 @@ public sealed partial class AntagSelectionSystem
         {
             var list = new List<ProtoId<AntagPrototype>>{role};
 
-
-            if (pref.AntagPreferences.Contains(role)
+            if (character.AntagPreferences.Contains(role)
                 && !_ban.IsRoleBanned(session, list)
                 && _playTime.IsAllowed(session, list))
                 valid = true;