Files
OldThink/Content.Server/Roles/Job.cs

59 lines
2.0 KiB
C#
Raw Normal View History

using Content.Server.Chat;
2021-06-09 22:19:39 +02:00
using Content.Server.Chat.Managers;
using Content.Server.Chat.Systems;
using Content.Shared.Roles;
2021-06-09 22:19:39 +02:00
namespace Content.Server.Roles
{
public sealed class Job : Role
{
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;
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.Name;
CanBeAntag = jobPrototype.CanBeAntag;
}
public override void Greet()
{
base.Greet();
if (Mind.TryGetSession(out var session))
{
var chatMgr = IoCManager.Resolve<IChatManager>();
var chatSys = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
chatMgr.DispatchServerMessage(session, Loc.GetString("job-greet-introduce-job-name", ("jobName", 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", Prototype.Supervisors)));
if(Prototype.JoinNotifyCrew && Mind.CharacterName != null)
{
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);
}
}
}
}
}
}