CatStation/Content.Server/Vocalization/Systems/DatasetVocalizationSystem.cs
Whatstone f42f8df6d1
Cleanup: ProtoMan Part 2 - remove Client and Server EntitySystem IPrototypeManager instances (#44416)
* Remove all IPrototypeManager instances

* Remove redundant IComponentFactory instances too

* Found some stragglers

* DestructibleSystem.PrototypeManager: no dependency

* not based
2026-06-29 21:33:56 +00:00

30 lines
832 B
C#

using Content.Server.Vocalization.Components;
using Content.Shared.Random.Helpers;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Server.Vocalization.Systems;
/// <inheritdoc cref="DatasetVocalizerComponent"/>
public sealed partial class DatasetVocalizationSystem : EntitySystem
{
[Dependency] private IRobustRandom _random = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<DatasetVocalizerComponent, TryVocalizeEvent>(OnTryVocalize);
}
private void OnTryVocalize(Entity<DatasetVocalizerComponent> ent, ref TryVocalizeEvent args)
{
if (args.Handled)
return;
var dataset = ProtoMan.Index(ent.Comp.Dataset);
args.Message = _random.Pick(dataset);
args.Handled = true;
}
}