]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix some rounds failing to end due to mind roles (#32792) (#32793)
authorPieter-Jan Briers <pieterjan.briers+git@gmail.com>
Sun, 13 Oct 2024 21:00:40 +0000 (23:00 +0200)
committerGitHub <noreply@github.com>
Sun, 13 Oct 2024 21:00:40 +0000 (23:00 +0200)
* Fix some rounds failing to end due to mind roles

Fixes #32791

This is caused by ShowRoundEndScoreboard running into a bug trying to display antags: some player is showing up as antag with MindIsAntagonist(), but has no antag roles listed in MindGetAllRoleInfo().

This was caused by one of the roles of the player having the Antag boolean set, but having no AntagPrototype set.

The responsible mind role appeared to be MindRoleSubvertedSilicon which is missing a set for the SubvertedSilicon antag prototype.

I also added resilience to the round-end code to make it so that an exception showing the scoreboard (and sending the Discord message) would not cause the round end logic to completely abort from an exception.

I am planning to add an integration test to cover this bug (no prototype in mind roles), but I'll leave that for not-the-immediate-hotfix.

* At least one maintainer approved this tiny PR without reading it, not naming names.

Content.Server/GameTicking/GameTicker.RoundFlow.cs
Resources/Prototypes/Roles/MindRoles/mind_roles.yml

index 683061d8edcfe52fa083697e867d6d78a33fd517..e544870bd2715e025251865bca844540fb8c5b86 100644 (file)
@@ -341,8 +341,23 @@ namespace Content.Server.GameTicking
 
             RunLevel = GameRunLevel.PostRound;
 
-            ShowRoundEndScoreboard(text);
-            SendRoundEndDiscordMessage();
+            try
+            {
+                ShowRoundEndScoreboard(text);
+            }
+            catch (Exception e)
+            {
+                Log.Error($"Error while showing round end scoreboard: {e}");
+            }
+
+            try
+            {
+                SendRoundEndDiscordMessage();
+            }
+            catch (Exception e)
+            {
+                Log.Error($"Error while sending round end Discord message: {e}");
+            }
         }
 
         public void ShowRoundEndScoreboard(string text = "")
index eb92fa51ae9deb763970ea5c9144219f45e5932f..926ce512b4141bed350030422ba28865b31c3554 100644 (file)
@@ -46,6 +46,8 @@
   description:
   components:
   - type: SubvertedSiliconRole
+  - type: MindRole
+    antagPrototype: SubvertedSilicon
 
 # Dragon
 - type: entity