Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroJr committed Mar 27, 2024
1 parent 5e813a7 commit e802281
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 10 additions & 3 deletions Content.Server/Ghost/Roles/Components/GhostRoleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<JobRequirement>? Requirements;
Expand Down Expand Up @@ -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<GhostRoleSystem>().UpdateAllEui();
}
}

[DataField("allowSpeech")]
[ViewVariables(VVAccess.ReadWrite)]
Expand Down
11 changes: 1 addition & 10 deletions Content.Server/Ghost/Roles/GhostRoleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,11 @@ private void OnMapInit(Entity<GhostRoleComponent> ent, ref MapInitEvent args)
RemCompDeferred<GhostRoleComponent>(ent);
}

private void OnStartup(Entity<GhostRoleComponent> ent, ComponentStartup args)
private void OnStartup(Entity<GhostRoleComponent> ent, ref ComponentStartup args)
{
RegisterGhostRole(ent);
}

public void UpdateRules(Entity<GhostRoleComponent?> ent, string rules)
{
if (!Resolve(ent, ref ent.Comp))
return;

ent.Comp._rules = rules;
UpdateAllEui();
}

private void OnShutdown(Entity<GhostRoleComponent> role, ref ComponentShutdown args)
{
UnregisterGhostRole(role);
Expand Down

0 comments on commit e802281

Please sign in to comment.