Fix some announcements code (#16585)
This commit is contained in:
@@ -17,7 +17,4 @@ public sealed class RoundAnnouncementPrototype : IPrototype
|
|||||||
[DataField("sound")] public SoundSpecifier? Sound;
|
[DataField("sound")] public SoundSpecifier? Sound;
|
||||||
|
|
||||||
[DataField("message")] public string? Message;
|
[DataField("message")] public string? Message;
|
||||||
|
|
||||||
[DataField("presets", customTypeSerializer: typeof(PrototypeIdListSerializer<GamePresetPrototype>))]
|
|
||||||
public List<string> GamePresets = new();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -524,19 +524,18 @@ namespace Content.Server.GameTicking
|
|||||||
{
|
{
|
||||||
if (Preset == null) return;
|
if (Preset == null) return;
|
||||||
|
|
||||||
foreach (var proto in _prototypeManager.EnumeratePrototypes<RoundAnnouncementPrototype>())
|
var options = _prototypeManager.EnumeratePrototypes<RoundAnnouncementPrototype>().ToList();
|
||||||
{
|
|
||||||
if (!proto.GamePresets.Contains(Preset.ID)) continue;
|
if (options.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var proto = _robustRandom.Pick(options);
|
||||||
|
|
||||||
if (proto.Message != null)
|
if (proto.Message != null)
|
||||||
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true);
|
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true);
|
||||||
|
|
||||||
if (proto.Sound != null)
|
if (proto.Sound != null)
|
||||||
SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast());
|
SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast());
|
||||||
|
|
||||||
// Only play one because A
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
- type: roundAnnouncement
|
- type: roundAnnouncement
|
||||||
id: Welcome
|
id: Welcome
|
||||||
sound: /Audio/Announcements/welcome.ogg
|
sound: /Audio/Announcements/welcome.ogg
|
||||||
presets:
|
|
||||||
- Survival
|
|
||||||
- Sandbox
|
|
||||||
- Secret
|
|
||||||
- Traitor
|
|
||||||
|
|||||||
Reference in New Issue
Block a user