This commit is contained in:
ShadowCommander
2023-03-26 11:31:13 -07:00
committed by GitHub
parent 0e5dc41fe8
commit bfc4da9377
85 changed files with 1150 additions and 684 deletions

View File

@@ -6,12 +6,15 @@ using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Prototypes;
using System.Linq;
using Content.Server.Mind;
namespace Content.Server.Roles
{
[AdminCommand(AdminFlags.Admin)]
public sealed class AddRoleCommand : IConsoleCommand
{
[Dependency] private readonly EntityManager _entityManager = default!;
public string Command => "addrole";
public string Description => "Adds a role to a player's mind.";
@@ -54,7 +57,8 @@ namespace Content.Server.Roles
}
var role = new Job(mind, jobPrototype);
mind.AddRole(role);
var mindSystem = _entityManager.System<MindSystem>();
mindSystem.AddRole(mind, role);
}
}
}

View File

@@ -2,6 +2,7 @@ using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Shared.Roles;
using System.Globalization;
using Content.Server.Mind;
namespace Content.Server.Roles
{
@@ -35,8 +36,11 @@ namespace Content.Server.Roles
public override void Greet()
{
base.Greet();
var entityManager = IoCManager.Resolve<EntityManager>();
var mindSystem = entityManager.System<MindSystem>();
if (Mind.TryGetSession(out var session))
if (mindSystem.TryGetSession(Mind, out var session))
{
var chatMgr = IoCManager.Resolve<IChatManager>();
chatMgr.DispatchServerMessage(session, Loc.GetString("job-greet-introduce-job-name",

View File

@@ -1,4 +1,5 @@
using Content.Server.Administration;
using Content.Server.Mind;
using Content.Server.Players;
using Content.Shared.Administration;
using Content.Shared.Roles;
@@ -12,6 +13,7 @@ namespace Content.Server.Roles
public sealed class RemoveRoleCommand : IConsoleCommand
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
public string Command => "rmrole";
@@ -43,7 +45,8 @@ namespace Content.Server.Roles
}
var role = new Job(mind, _prototypeManager.Index<JobPrototype>(args[1]));
mind.RemoveRole(role);
var mindSystem = _entityManager.System<MindSystem>();
mindSystem.RemoveRole(mind, role);
}
}
}