Fix lingering ghost roles (and expand tests to catch it) (#38788)
* Improve and expand `TakeRoleAndReturn` to fail on bug #38292 * fix #38292 and expanded test cases * use validated EntProtoIds for tests remove unusued using declarations * use const strings that match the TestPrototypes
This commit is contained in:
@@ -510,6 +510,11 @@ public sealed class GhostRoleSystem : EntitySystem
|
||||
|
||||
DebugTools.AssertNotNull(player.ContentData());
|
||||
|
||||
// After taking a ghost role, the player cannot return to the original body, so wipe the player's current mind
|
||||
// unless it is a visiting mind
|
||||
if(_mindSystem.TryGetMind(player.UserId, out _, out var mind) && !mind.IsVisitingEntity)
|
||||
_mindSystem.WipeMind(player);
|
||||
|
||||
var newMind = _mindSystem.CreateMind(player.UserId,
|
||||
Comp<MetaDataComponent>(mob).EntityName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user