From a29bc600b7f42be124a82287cfadf90a9eb85b8b Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Sat, 23 Oct 2021 10:56:37 +0200 Subject: [PATCH] Fix exception when observer tries to take over GhostTakeoverAvailable mob that has a mind. That method is essentially a `TryTake` method, why would it throw instead of returning false... --- .../Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs | 3 ++- .../Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs index bb428b45c9..26dc0011c2 100644 --- a/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostRoleMobSpawnerComponent.cs @@ -57,7 +57,8 @@ namespace Content.Server.Ghost.Roles.Components mind!.TransferTo(mob); - if (++_currentTakeovers < _availableTakeovers) return true; + if (++_currentTakeovers < _availableTakeovers) + return true; Taken = true; diff --git a/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs b/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs index e6e411aa33..4601fd0ebb 100644 --- a/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostTakeoverAvailableComponent.cs @@ -25,7 +25,7 @@ namespace Content.Server.Ghost.Roles.Components var mind = Owner.EnsureComponent(); if (mind.HasMind) - throw new Exception("MindComponent already has a mind!"); + return false; var sessionMind = session.ContentData()?.Mind;