give revs briefing (#20749)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -58,6 +58,7 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
||||
SubscribeLocalEvent<CommandStaffComponent, MobStateChangedEvent>(OnCommandMobStateChanged);
|
||||
SubscribeLocalEvent<HeadRevolutionaryComponent, MobStateChangedEvent>(OnHeadRevMobStateChanged);
|
||||
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
|
||||
SubscribeLocalEvent<RevolutionaryRoleComponent, GetBriefingEvent>(OnGetBriefing);
|
||||
SubscribeLocalEvent<HeadRevolutionaryComponent, AfterFlashedEvent>(OnPostFlash);
|
||||
}
|
||||
|
||||
@@ -118,6 +119,15 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetBriefing(EntityUid uid, RevolutionaryRoleComponent comp, ref GetBriefingEvent args)
|
||||
{
|
||||
if (!TryComp<MindComponent>(uid, out var mind) || mind.OwnedEntity == null)
|
||||
return;
|
||||
|
||||
var head = HasComp<HeadRevolutionaryComponent>(mind.OwnedEntity);
|
||||
args.Append(Loc.GetString(head ? "head-rev-briefing" : "rev-briefing"));
|
||||
}
|
||||
|
||||
private void OnStartAttempt(RoundStartAttemptEvent ev)
|
||||
{
|
||||
var query = AllEntityQuery<RevolutionaryRuleComponent, GameRuleComponent>();
|
||||
|
||||
@@ -11,15 +11,6 @@ public sealed class RoleBriefingSystem : EntitySystem
|
||||
|
||||
private void OnGetBriefing(EntityUid uid, RoleBriefingComponent comp, ref GetBriefingEvent args)
|
||||
{
|
||||
if (args.Briefing == null)
|
||||
{
|
||||
// no previous briefing so just set it
|
||||
args.Briefing = comp.Briefing;
|
||||
}
|
||||
else
|
||||
{
|
||||
// there is a previous briefing so append to it
|
||||
args.Briefing += "\n" + comp.Briefing;
|
||||
}
|
||||
args.Append(comp.Briefing);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,28 @@ public sealed class RoleSystem : SharedRoleSystem
|
||||
/// Handlers can either replace or append to the briefing, whichever is more appropriate.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public record struct GetBriefingEvent(string? Briefing = null);
|
||||
public sealed class GetBriefingEvent
|
||||
{
|
||||
public string? Briefing;
|
||||
|
||||
public GetBriefingEvent(string? briefing = null)
|
||||
{
|
||||
Briefing = briefing;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If there is no briefing, sets it to the string.
|
||||
/// If there is a briefing, adds a new line to separate it from the appended string.
|
||||
/// </summary>
|
||||
public void Append(string text)
|
||||
{
|
||||
if (Briefing == null)
|
||||
{
|
||||
Briefing = text;
|
||||
}
|
||||
else
|
||||
{
|
||||
Briefing += "\n" + text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ head-rev-role-greeting =
|
||||
Beware, this won't work on Security, Command, or those wearing sunglasses.
|
||||
Viva la revolución!
|
||||
|
||||
head-rev-briefing =
|
||||
Use flashes to convert people to your cause.
|
||||
Kill all heads to take over the station.
|
||||
|
||||
head-rev-initial-name = [color=#5e9cff]{$name}[/color] was one of the Head Revolutionaries.
|
||||
head-rev-initial-name-user = [color=#5e9cff]{$name}[/color] ([color=gray]{$username}[/color]) was one of the Head Revolutionaries.
|
||||
|
||||
@@ -33,6 +37,8 @@ rev-role-greeting =
|
||||
Eliminate all of the command staff.
|
||||
Viva la revolución!
|
||||
|
||||
rev-briefing = Help your head revolutionaries kill every head to take over the station.
|
||||
|
||||
## General
|
||||
|
||||
rev-title = Revolutionaries
|
||||
|
||||
Reference in New Issue
Block a user