Fix jobs not getting their round start message (#19643)
This commit is contained in:
@@ -21,10 +21,10 @@ public sealed class JobSystem : EntitySystem
|
|||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<JobComponent, RoleAddedEvent>(MindOnDoGreeting);
|
SubscribeLocalEvent<MindComponent, MindRoleAddedEvent>(MindOnDoGreeting);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MindOnDoGreeting(EntityUid mindId, JobComponent component, RoleAddedEvent args)
|
private void MindOnDoGreeting(EntityUid mindId, MindComponent component, ref MindRoleAddedEvent args)
|
||||||
{
|
{
|
||||||
if (!_mind.TryGetSession(mindId, out var session))
|
if (!_mind.TryGetSession(mindId, out var session))
|
||||||
return;
|
return;
|
||||||
@@ -38,9 +38,7 @@ public sealed class JobSystem : EntitySystem
|
|||||||
if (prototype.RequireAdminNotify)
|
if (prototype.RequireAdminNotify)
|
||||||
_chat.DispatchServerMessage(session, Loc.GetString("job-greet-important-disconnect-admin-notify"));
|
_chat.DispatchServerMessage(session, Loc.GetString("job-greet-important-disconnect-admin-notify"));
|
||||||
|
|
||||||
_chat.DispatchServerMessage(session, Loc.GetString("job-greet-supervisors-warning",
|
_chat.DispatchServerMessage(session, Loc.GetString("job-greet-supervisors-warning", ("jobName", prototype.LocalizedName), ("supervisors", Loc.GetString(prototype.Supervisors))));
|
||||||
("jobName", Name),
|
|
||||||
("supervisors", Loc.GetString(prototype.Supervisors))));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MindAddJob(EntityUid mindId, string jobPrototypeId)
|
public void MindAddJob(EntityUid mindId, string jobPrototypeId)
|
||||||
|
|||||||
8
Content.Server/Roles/MindRoleAddedEvent.cs
Normal file
8
Content.Server/Roles/MindRoleAddedEvent.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Content.Server.Roles;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Raised on mind entities when a role is added to them.
|
||||||
|
/// <see cref="RoleAddedEvent"/> for the one raised on player entities.
|
||||||
|
/// </summary>
|
||||||
|
[ByRefEvent]
|
||||||
|
public readonly record struct MindRoleAddedEvent;
|
||||||
@@ -3,7 +3,8 @@
|
|||||||
namespace Content.Server.Roles;
|
namespace Content.Server.Roles;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Event raised on player entities to indicate that a role was added to their mind.
|
/// Raised on player entities when a role is added to them.
|
||||||
|
/// <see cref="RoleAddedEvent"/> for the one raised on mind entities.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="MindId">The mind id associated with the player.</param>
|
/// <param name="MindId">The mind id associated with the player.</param>
|
||||||
/// <param name="Mind">The mind component associated with the mind id.</param>
|
/// <param name="Mind">The mind component associated with the mind id.</param>
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ public sealed class RoleSystem : EntitySystem
|
|||||||
AddComp(mindId, component);
|
AddComp(mindId, component);
|
||||||
var antagonist = IsAntagonistRole<T>();
|
var antagonist = IsAntagonistRole<T>();
|
||||||
|
|
||||||
|
var mindEv = new MindRoleAddedEvent();
|
||||||
|
RaiseLocalEvent(mindId, ref mindEv);
|
||||||
|
|
||||||
var message = new RoleAddedEvent(mindId, mind, antagonist);
|
var message = new RoleAddedEvent(mindId, mind, antagonist);
|
||||||
if (mind.OwnedEntity != null)
|
if (mind.OwnedEntity != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user