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