From 5b4c813c6d771a658e21ba57a91c7aab85877f04 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Tue, 9 Nov 2021 15:50:55 +0100 Subject: [PATCH] MakeGhostRoleCommand uses EntityUid --- Content.Server/Ghost/Roles/MakeGhostRoleCommand.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Content.Server/Ghost/Roles/MakeGhostRoleCommand.cs b/Content.Server/Ghost/Roles/MakeGhostRoleCommand.cs index 5f7367d98d..4c5d405c74 100644 --- a/Content.Server/Ghost/Roles/MakeGhostRoleCommand.cs +++ b/Content.Server/Ghost/Roles/MakeGhostRoleCommand.cs @@ -32,16 +32,16 @@ namespace Content.Server.Ghost.Roles return; } - if (!entityManager.TryGetEntity(uid, out var entity)) + if (!entityManager.TryGetComponent(uid, out MetaDataComponent? metaData)) { shell.WriteLine($"No entity found with uid {uid}"); return; } - if (entity.TryGetComponent(out MindComponent? mind) && + if (entityManager.TryGetComponent(uid, out MindComponent? mind) && mind.HasMind) { - shell.WriteLine($"Entity {entity.Name} with id {uid} already has a mind."); + shell.WriteLine($"Entity {metaData.EntityName} with id {uid} already has a mind."); return; } @@ -49,17 +49,18 @@ namespace Content.Server.Ghost.Roles var description = args[2]; var rules = args.Length >= 4 ? args[3] : Loc.GetString("ghost-role-component-default-rules"); - if (entity.EnsureComponent(out GhostTakeoverAvailableComponent takeOver)) + if (entityManager.TryGetComponent(uid, out GhostTakeoverAvailableComponent? takeOver)) { - shell.WriteLine($"Entity {entity.Name} with id {uid} already has a {nameof(GhostTakeoverAvailableComponent)}"); + shell.WriteLine($"Entity {metaData.EntityName} with id {uid} already has a {nameof(GhostTakeoverAvailableComponent)}"); return; } + takeOver = entityManager.AddComponent(uid); takeOver.RoleName = name; takeOver.RoleDescription = description; takeOver.RoleRules = rules; - shell.WriteLine($"Made entity {entity.Name} a ghost role."); + shell.WriteLine($"Made entity {metaData.EntityName} a ghost role."); } } }