Fix some announcements code (#16585)
This commit is contained in:
parent
48ad2e7d22
commit
8edfedfba5
|
|
@ -17,7 +17,4 @@ public sealed class RoundAnnouncementPrototype : IPrototype
|
|||
[DataField("sound")] public SoundSpecifier? Sound;
|
||||
|
||||
[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;
|
||||
|
||||
foreach (var proto in _prototypeManager.EnumeratePrototypes<RoundAnnouncementPrototype>())
|
||||
{
|
||||
if (!proto.GamePresets.Contains(Preset.ID)) continue;
|
||||
var options = _prototypeManager.EnumeratePrototypes<RoundAnnouncementPrototype>().ToList();
|
||||
|
||||
if (proto.Message != null)
|
||||
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true);
|
||||
if (options.Count == 0)
|
||||
return;
|
||||
|
||||
if (proto.Sound != null)
|
||||
SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast());
|
||||
var proto = _robustRandom.Pick(options);
|
||||
|
||||
// Only play one because A
|
||||
break;
|
||||
}
|
||||
if (proto.Message != null)
|
||||
_chatSystem.DispatchGlobalAnnouncement(Loc.GetString(proto.Message), playSound: true);
|
||||
|
||||
if (proto.Sound != null)
|
||||
SoundSystem.Play(proto.Sound.GetSound(), Filter.Broadcast());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,3 @@
|
|||
- type: roundAnnouncement
|
||||
id: Welcome
|
||||
sound: /Audio/Announcements/welcome.ogg
|
||||
presets:
|
||||
- Survival
|
||||
- Sandbox
|
||||
- Secret
|
||||
- Traitor
|
||||
|
|
|
|||
Loading…
Reference in New Issue