Replace string data fields with LocId where relevant (#20883)

This commit is contained in:
DrSmugleaf
2023-10-10 20:06:24 -07:00
committed by GitHub
parent ef233cf0fe
commit 9bcf67753a
69 changed files with 265 additions and 286 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.UserInterface;
using Content.Shared.Communications;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
namespace Content.Server.Communications
@@ -21,41 +20,41 @@ namespace Content.Server.Communications
/// If a Fluent ID isn't found, just uses the raw string
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("title", required: true)]
public string AnnouncementDisplayName = "comms-console-announcement-title-station";
[DataField(required: true)]
public LocId Title = "comms-console-announcement-title-station";
/// <summary>
/// Announcement color
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("color")]
public Color AnnouncementColor = Color.Gold;
[DataField]
public Color Color = Color.Gold;
/// <summary>
/// Time in seconds between announcement delays on a per-console basis
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("delay")]
public int DelayBetweenAnnouncements = 90;
[DataField]
public int Delay = 90;
/// <summary>
/// Can call or recall the shuttle
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("canShuttle")]
public bool CanCallShuttle = true;
[DataField]
public bool CanShuttle = true;
/// <summary>
/// Announce on all grids (for nukies)
/// </summary>
[DataField("global")]
public bool AnnounceGlobal = false;
[DataField]
public bool Global = false;
/// <summary>
/// Announce sound file path
/// </summary>
[DataField("sound")]
public SoundSpecifier AnnouncementSound = new SoundPathSpecifier("/Audio/Announcements/announce.ogg");
[DataField]
public SoundSpecifier Sound = new SoundPathSpecifier("/Audio/Announcements/announce.ogg");
public PlayerBoundUserInterface? UserInterface => Owner.GetUIOrNull(CommunicationsConsoleUiKey.Key);
}

View File

@@ -188,7 +188,7 @@ namespace Content.Server.Communications
// Calling shuttle checks
if (_roundEndSystem.ExpectedCountdownEnd is null)
return comp.CanCallShuttle;
return comp.CanShuttle;
// Recalling shuttle checks
var recallThreshold = _cfg.GetCVar(CCVars.EmergencyRecallTurningPoint);
@@ -256,27 +256,27 @@ namespace Content.Server.Communications
}
}
comp.AnnouncementCooldownRemaining = comp.DelayBetweenAnnouncements;
comp.AnnouncementCooldownRemaining = comp.Delay;
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;
Loc.TryGetString(comp.Title, out var title);
title ??= comp.Title;
msg += "\n" + Loc.GetString("comms-console-announcement-sent-by") + " " + author;
if (comp.AnnounceGlobal)
if (comp.Global)
{
_chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.AnnouncementSound, colorOverride: comp.AnnouncementColor);
_chatSystem.DispatchGlobalAnnouncement(msg, title, announcementSound: comp.Sound, colorOverride: comp.Color);
if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following global announcement: {msg}");
return;
}
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.AnnouncementColor);
_chatSystem.DispatchStationAnnouncement(uid, msg, title, colorOverride: comp.Color);
if (message.Session.AttachedEntity != null)
_adminLogger.Add(LogType.Chat, LogImpact.Low, $"{ToPrettyString(message.Session.AttachedEntity.Value):player} has sent the following station announcement: {msg}");