Port honkbots from nyano (#9698)

This commit is contained in:
Rane
2022-07-15 03:54:34 -04:00
committed by GitHub
parent 5c7eea3e42
commit abab5bedcd
18 changed files with 337 additions and 12 deletions

View File

@@ -26,6 +26,25 @@ namespace Content.Server.Sound
[Dependency] private readonly ITileDefinitionManager _tileDefMan = default!;
/// <inheritdoc />
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var soundSpammer in EntityQuery<SpamEmitSoundComponent>())
{
soundSpammer.Accumulator += frameTime;
if (soundSpammer.Accumulator < soundSpammer.RollInterval)
{
continue;
}
soundSpammer.Accumulator -= soundSpammer.RollInterval;
if (_random.Prob(soundSpammer.PlayChance))
{
TryEmitSound(soundSpammer);
}
}
}
public override void Initialize()
{
base.Initialize();