Placeholder pAIs, ghost role rules window (#4972)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Ghost.Roles.Components
|
||||
{
|
||||
@@ -11,6 +12,8 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
|
||||
[DataField("description")] private string _roleDescription = "Unknown";
|
||||
|
||||
[DataField("rules")] private string _roleRules = "";
|
||||
|
||||
// We do this so updating RoleName and RoleDescription in VV updates the open EUIs.
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -35,6 +38,17 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
}
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string RoleRules
|
||||
{
|
||||
get => _roleRules;
|
||||
set
|
||||
{
|
||||
_roleRules = value;
|
||||
EntitySystem.Get<GhostRoleSystem>().UpdateAllEui();
|
||||
}
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
public bool Taken { get; protected set; }
|
||||
|
||||
@@ -44,7 +58,8 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (_roleRules == "")
|
||||
_roleRules = Loc.GetString("ghost-role-component-default-rules");
|
||||
EntitySystem.Get<GhostRoleSystem>().RegisterGhostRole(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Content.Server.Ghost.Roles
|
||||
|
||||
foreach (var (id, role) in _ghostRoles)
|
||||
{
|
||||
roles[i] = new GhostRoleInfo(){Identifier = id, Name = role.RoleName, Description = role.RoleDescription};
|
||||
roles[i] = new GhostRoleInfo(){Identifier = id, Name = role.RoleName, Description = role.RoleDescription, Rules = role.RoleRules};
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Shared.Administration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Server.Ghost.Roles
|
||||
{
|
||||
@@ -13,11 +14,11 @@ namespace Content.Server.Ghost.Roles
|
||||
{
|
||||
public string Command => "makeghostrole";
|
||||
public string Description => "Turns an entity into a ghost role.";
|
||||
public string Help => $"Usage: {Command} <entity uid> <name> <description>";
|
||||
public string Help => $"Usage: {Command} <entity uid> <name> <description> [<rules>]";
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 3)
|
||||
if (args.Length < 3 || args.Length > 4)
|
||||
{
|
||||
shell.WriteLine($"Invalid amount of arguments.\n{Help}");
|
||||
return;
|
||||
@@ -46,6 +47,7 @@ namespace Content.Server.Ghost.Roles
|
||||
|
||||
var name = args[1];
|
||||
var description = args[2];
|
||||
var rules = args.Length >= 4 ? args[3] : Loc.GetString("ghost-role-component-default-rules");
|
||||
|
||||
if (entity.EnsureComponent(out GhostTakeoverAvailableComponent takeOver))
|
||||
{
|
||||
@@ -55,6 +57,7 @@ namespace Content.Server.Ghost.Roles
|
||||
|
||||
takeOver.RoleName = name;
|
||||
takeOver.RoleDescription = description;
|
||||
takeOver.RoleRules = rules;
|
||||
|
||||
shell.WriteLine($"Made entity {entity.Name} a ghost role.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user