2022-06-03 21:37:35 +10:00
|
|
|
using Content.Server.Chat;
|
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;
|
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-02-16 00:23:23 -07:00
|
|
|
public sealed class Job : Role
|
2019-11-17 11:18:39 -05:00
|
|
|
{
|
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
|
|
|
|
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;
|
2019-11-17 11:18:39 -05:00
|
|
|
Name = jobPrototype.Name;
|
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();
|
|
|
|
|
|
2021-03-16 15:50:20 +01:00
|
|
|
if (Mind.TryGetSession(out var session))
|
|
|
|
|
{
|
2022-06-03 21:37:35 +10:00
|
|
|
var chatMgr = IoCManager.Resolve<IChatManager>();
|
|
|
|
|
var chatSys = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
|
|
|
|
chatMgr.DispatchServerMessage(session, Loc.GetString("job-greet-introduce-job-name", ("jobName", 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-03 21:37:35 +10:00
|
|
|
chatMgr.DispatchServerMessage(session, Loc.GetString("job-greet-supervisors-warning", ("jobName", Name), ("supervisors", Prototype.Supervisors)));
|
2021-10-06 13:51:11 +02:00
|
|
|
|
|
|
|
|
if(Prototype.JoinNotifyCrew && Mind.CharacterName != null)
|
2022-06-03 21:37:35 +10:00
|
|
|
{
|
|
|
|
|
if (Mind.OwnedEntity != null)
|
|
|
|
|
{
|
|
|
|
|
chatSys.DispatchStationAnnouncement(Mind.OwnedEntity.Value,
|
|
|
|
|
Loc.GetString("job-greet-join-notify-crew", ("jobName", Name),
|
|
|
|
|
("characterName", Mind.CharacterName)),
|
|
|
|
|
Loc.GetString("job-greet-join-notify-crew-announcer"), false);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-16 15:50:20 +01:00
|
|
|
}
|
2019-11-17 11:18:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|