SubscribeLocalEvent<CommandStaffComponent, MobStateChangedEvent>(OnCommandMobStateChanged);
SubscribeLocalEvent<HeadRevolutionaryComponent, MobStateChangedEvent>(OnHeadRevMobStateChanged);
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEndText);
+ SubscribeLocalEvent<RevolutionaryRoleComponent, GetBriefingEvent>(OnGetBriefing);
SubscribeLocalEvent<HeadRevolutionaryComponent, AfterFlashedEvent>(OnPostFlash);
}
}
}
+ 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>();
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);
}
}
/// 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;
+ }
+ }
+}
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.
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