Give nukies the ability to declare war for a TC boost (#19291)

Co-authored-by: Kevin Zheng <kevinz5000@gmail.com>
This commit is contained in:
Morb
2023-08-30 10:56:20 +03:00
committed by GitHub
parent 5bb6a64dbd
commit c99e365ce7
23 changed files with 831 additions and 18 deletions

View File

@@ -1,9 +1,7 @@
using System.Globalization;
using System.Linq;
using Content.Server.Access.Systems;
using Content.Server.Administration.Logs;
using Content.Server.AlertLevel;
using Content.Server.Chat;
using Content.Server.Chat.Systems;
using Content.Server.Interaction;
using Content.Server.Popups;
@@ -16,11 +14,9 @@ using Content.Shared.CCVar;
using Content.Shared.Communications;
using Content.Shared.Database;
using Content.Shared.Emag.Components;
using Content.Shared.Examine;
using Content.Shared.Popups;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.Player;
namespace Content.Server.Communications
{
@@ -262,6 +258,9 @@ namespace Content.Server.Communications
comp.AnnouncementCooldownRemaining = comp.DelayBetweenAnnouncements;
UpdateCommsConsoleInterface(uid, comp);
var ev = new CommunicationConsoleAnnouncementEvent(uid, comp, msg, message.Session.AttachedEntity);
RaiseLocalEvent(ref ev);
// allow admemes with vv
Loc.TryGetString(comp.AnnouncementDisplayName, out var title);
title ??= comp.AnnouncementDisplayName;
@@ -291,6 +290,15 @@ namespace Content.Server.Communications
_popupSystem.PopupEntity(Loc.GetString("comms-console-permission-denied"), uid, message.Session);
return;
}
var ev = new CommunicationConsoleCallShuttleAttemptEvent(uid, comp, mob);
RaiseLocalEvent(ref ev);
if (ev.Cancelled)
{
_popupSystem.PopupEntity(ev.Reason ?? Loc.GetString("comms-console-shuttle-unavailable"), uid, message.Session);
return;
}
_roundEndSystem.RequestRoundEnd(uid);
_adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{ToPrettyString(mob):player} has called the shuttle.");
}
@@ -309,4 +317,29 @@ namespace Content.Server.Communications
_adminLogger.Add(LogType.Action, LogImpact.Extreme, $"{ToPrettyString(mob):player} has recalled the shuttle.");
}
}
/// <summary>
/// Raised on announcement
/// </summary>
[ByRefEvent]
public record struct CommunicationConsoleAnnouncementEvent(EntityUid Uid, CommunicationsConsoleComponent Component, string Text, EntityUid? Sender)
{
public EntityUid Uid = Uid;
public CommunicationsConsoleComponent Component = Component;
public EntityUid? Sender = Sender;
public string Text = Text;
}
/// <summary>
/// Raised on shuttle call attempt. Can be cancelled
/// </summary>
[ByRefEvent]
public record struct CommunicationConsoleCallShuttleAttemptEvent(EntityUid Uid, CommunicationsConsoleComponent Component, EntityUid? Sender)
{
public bool Cancelled = false;
public EntityUid Uid = Uid;
public CommunicationsConsoleComponent Component = Component;
public EntityUid? Sender = Sender;
public string? Reason;
}
}