diff --git a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs index a3783f666a10b4..abb26a8c8bc158 100644 --- a/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs +++ b/Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs @@ -11,8 +11,7 @@ public sealed partial class GhostRoleComponent : Component [DataField("description")] private string _roleDescription = "Unknown"; - [Access(typeof(GhostRoleSystem), Other = AccessPermissions.None)] - [DataField("rules")] public string _rules = "ghost-role-component-default-rules"; + [DataField("rules")] private string _roleRules = "ghost-role-component-default-rules"; [DataField("requirements")] public HashSet? Requirements; @@ -58,7 +57,15 @@ public string RoleDescription [ViewVariables(VVAccess.ReadWrite)] [Access(typeof(GhostRoleSystem), Other = AccessPermissions.ReadWriteExecute)] // FIXME Friends - public string RoleRules => Loc.GetString(_rules); + public string RoleRules + { + get => Loc.GetString(_roleRules); + set + { + _roleRules = value; + EntitySystem.Get().UpdateAllEui(); + } + } [DataField("allowSpeech")] [ViewVariables(VVAccess.ReadWrite)] diff --git a/Content.Server/Ghost/Roles/GhostRoleSystem.cs b/Content.Server/Ghost/Roles/GhostRoleSystem.cs index f06e0b26f5ffc8..0649e68a317c22 100644 --- a/Content.Server/Ghost/Roles/GhostRoleSystem.cs +++ b/Content.Server/Ghost/Roles/GhostRoleSystem.cs @@ -324,20 +324,11 @@ private void OnMapInit(Entity ent, ref MapInitEvent args) RemCompDeferred(ent); } - private void OnStartup(Entity ent, ComponentStartup args) + private void OnStartup(Entity ent, ref ComponentStartup args) { RegisterGhostRole(ent); } - public void UpdateRules(Entity ent, string rules) - { - if (!Resolve(ent, ref ent.Comp)) - return; - - ent.Comp._rules = rules; - UpdateAllEui(); - } - private void OnShutdown(Entity role, ref ComponentShutdown args) { UnregisterGhostRole(role);