Skip to content

Commit

Permalink
rename announcementPaths to announcements
Browse files Browse the repository at this point in the history
  • Loading branch information
DEATHB4DEFEAT committed Feb 17, 2024
1 parent c34b6f6 commit d6aa388
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Content.IntegrationTests.Tests.SimpleStation14.Announcers;

[TestFixture]
[TestOf(typeof(AnnouncerPrototype))]
public sealed class AnnouncerPrototypeTest
public sealed partial class AnnouncerPrototypeTests
{
[Test]
public async Task TestAnnouncerFallbacks()
Expand All @@ -20,7 +20,7 @@ await server.WaitAssertion(() =>
{
foreach (var announcer in prototype.EnumeratePrototypes<AnnouncerPrototype>())
{
Assert.That(announcer.AnnouncementPaths.Any(a => a.ID.ToLower() == "fallback"),
Assert.That(announcer.Announcements.Any(a => a.ID.ToLower() == "fallback"),
Is.True,
$"Announcer \"{announcer.ID}\" does not have a fallback announcement");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public sealed partial class AnnouncerSystem
{
// Get the announcement data from the announcer
// Will be the fallback if the data for the announcementId is not found
var announcementType = Announcer.AnnouncementPaths.FirstOrDefault(a => a.ID == announcementId) ??
Announcer.AnnouncementPaths.First(a => a.ID == "fallback");
var announcementType = Announcer.Announcements.FirstOrDefault(a => a.ID == announcementId) ??
Announcer.Announcements.First(a => a.ID == "fallback");

// Return the announcementType.MessageOverride if it exists, otherwise return null
return announcementType.MessageOverride != null ? Loc.GetString(announcementType.MessageOverride) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public sealed class AnnouncerPrototype : IPrototype
[DataField("baseAudioParams")]
public AudioParams? BaseAudioParams { get; }

[DataField("announcementPaths")]
public AnnouncementData[] AnnouncementPaths { get; } = default!;
[DataField("announcements")]
public AnnouncementData[] Announcements { get; } = default!;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public sealed class SharedAnnouncerSystem : EntitySystem

// Get the announcement data from the announcer
// Will be the fallback if the data for the announcementId is not found
var announcementType = announcer.AnnouncementPaths.FirstOrDefault(a => a.ID == announcementId) ??
announcer.AnnouncementPaths.First(a => a.ID.ToLower() == "fallback");
var announcementType = announcer.Announcements.FirstOrDefault(a => a.ID == announcementId) ??
announcer.Announcements.First(a => a.ID.ToLower() == "fallback");

// If the greedy announcementType wants to do the job of announcer, ignore the base path and just return the path
if (announcementType.IgnoreBasePath)
Expand All @@ -46,8 +46,8 @@ public string GetAnnouncementPath(string announcementId, AnnouncerPrototype anno
{
// Get the announcement data from the announcer
// Will be the fallback if the data for the announcementId is not found
var announcementType = announcer.AnnouncementPaths.FirstOrDefault(a => a.ID == announcementId) ??
announcer.AnnouncementPaths.First(a => a.ID.ToLower() == "fallback");
var announcementType = announcer.Announcements.FirstOrDefault(a => a.ID == announcementId) ??
announcer.Announcements.First(a => a.ID.ToLower() == "fallback");

// If the greedy announcementType wants to do the job of announcer, ignore the base path and just return the path
if (announcementType.IgnoreBasePath)
Expand All @@ -72,8 +72,8 @@ public string GetAnnouncementPath(string announcementId, AnnouncerPrototype anno

// Get the announcement data from the announcer
// Will be the fallback if the data for the announcementId is not found
var announcementType = announcer.AnnouncementPaths.FirstOrDefault(a => a.ID == announcementId) ??
announcer.AnnouncementPaths.First(a => a.ID == "fallback");
var announcementType = announcer.Announcements.FirstOrDefault(a => a.ID == announcementId) ??
announcer.Announcements.First(a => a.ID == "fallback");

// Return the announcer.BaseAudioParams if the announcementType doesn't have an override
return announcementType.AudioParams ?? announcer.BaseAudioParams ?? null; // For some reason the formatter doesn't warn me about "?? null" being redundant, so it stays
Expand All @@ -88,8 +88,8 @@ public string GetAnnouncementPath(string announcementId, AnnouncerPrototype anno
{
// Get the announcement data from the announcer
// Will be the fallback if the data for the announcementId is not found
var announcementType = announcer.AnnouncementPaths.FirstOrDefault(a => a.ID == announcementId) ??
announcer.AnnouncementPaths.First(a => a.ID == "fallback");
var announcementType = announcer.Announcements.FirstOrDefault(a => a.ID == announcementId) ??
announcer.Announcements.First(a => a.ID == "fallback");

// Return the announcer.BaseAudioParams if the announcementType doesn't have an override
return announcementType.AudioParams ?? announcer.BaseAudioParams;
Expand All @@ -108,8 +108,8 @@ public string GetAnnouncementPath(string announcementId, AnnouncerPrototype anno

// Get the announcement data from the announcer
// Will be the fallback if the data for the announcementId is not found
var announcementType = announcer.AnnouncementPaths.FirstOrDefault(a => a.ID == announcementId) ??
announcer.AnnouncementPaths.First(a => a.ID == "fallback");
var announcementType = announcer.Announcements.FirstOrDefault(a => a.ID == announcementId) ??
announcer.Announcements.First(a => a.ID == "fallback");

// Return the announcementType.MessageOverride if it exists, otherwise return null
return announcementType.MessageOverride != null ? Loc.GetString(announcementType.MessageOverride) : null;
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/SimpleStation14/Announcers/intern.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
basePath: /Audio/SimpleStation14/Announcements/Intern
baseAudioParams:
volume: -7
announcementPaths:
announcements:
# Communications console
- id: announce
path: announce.ogg
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/SimpleStation14/Announcers/medbot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- type: announcer
id: MedBot
basePath: /Audio/SimpleStation14/Announcements/MedBot
announcementPaths:
announcements:
# Communications console
- id: announce
path: announce.ogg
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/SimpleStation14/Announcers/neil.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
basePath: /Audio/SimpleStation14/Announcements/NEIL
baseAudioParams:
volume: -3
announcementPaths:
announcements:
# Communications console
- id: announce
path: announce.ogg
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/SimpleStation14/Announcers/template
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
basePath: /Audio/Codebase/Announcements/Announcer # Where to start looking for audio files
baseAudioParams: # Default audio parameters for all announcements, all options explained later
volume: -7 # if this example is really loud, lower it to match the others' volume
announcementPaths: # List of all announcements this announcer has audio for, comment out unused ones - don't remove them
announcements: # List of all announcements this announcer has audio for, comment out unused ones - don't remove them
# Template
- id: template # Lowercase of the event ID, add "-complete" to the end for post-event announcements (endings)
ignoreBasePath: false # If true, it will ignore the basePath and use the path as is
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/SimpleStation14/Announcers/voxfem.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- type: announcer
id: VoxFem
basePath: /Audio/SimpleStation14/Announcements/VoxFem
announcementPaths:
announcements:
# Communications console
- id: announce
path: announce.ogg
Expand Down

0 comments on commit d6aa388

Please sign in to comment.