Files
crystall-punk-14/Content.Server/Roles/Job.cs

57 lines
1.8 KiB
C#
Raw Normal View History

2021-06-09 22:19:39 +02:00
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Shared.Roles;
using System.Globalization;
2023-06-18 11:33:19 -07:00
using Content.Server.Mind;
2021-06-09 22:19:39 +02:00
namespace Content.Server.Roles
{
public sealed class Job : Role, IRoleTimer
{
[ViewVariables] public string Timer => Prototype.PlayTimeTracker;
2021-12-14 00:22:43 +01:00
[ViewVariables]
public JobPrototype Prototype { get; }
public override string Name { get; }
2021-12-14 00:22:43 +01:00
public override bool Antagonist => false;
2021-12-14 00:22:43 +01:00
[ViewVariables]
public string? StartingGear => Prototype.StartingGear;
2022-07-10 21:10:03 -04:00
[ViewVariables]
public string? JobEntity => Prototype.JobEntity;
2021-12-14 00:22:43 +01:00
[ViewVariables]
public bool CanBeAntag;
2021-06-09 22:19:39 +02:00
public Job(Mind.Mind mind, JobPrototype jobPrototype) : base(mind)
{
Prototype = jobPrototype;
Name = jobPrototype.LocalizedName;
CanBeAntag = jobPrototype.CanBeAntag;
}
public override void Greet()
{
base.Greet();
2023-06-18 11:33:19 -07:00
var entityManager = IoCManager.Resolve<EntityManager>();
var mindSystem = entityManager.System<MindSystem>();
2023-06-18 11:33:19 -07:00
if (mindSystem.TryGetSession(Mind, out var session))
{
var chatMgr = IoCManager.Resolve<IChatManager>();
chatMgr.DispatchServerMessage(session, Loc.GetString("job-greet-introduce-job-name",
("jobName", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Name))));
if(Prototype.RequireAdminNotify)
chatMgr.DispatchServerMessage(session, Loc.GetString("job-greet-important-disconnect-admin-notify"));
chatMgr.DispatchServerMessage(session, Loc.GetString("job-greet-supervisors-warning", ("jobName", Name), ("supervisors", Loc.GetString(Prototype.Supervisors))));
}
}
}
}