* Give 'em something to talk about * Wire panel visuals * Wire graphics tweak * More ads and thanks * More ads for a noisy arcade * New screen for space villain machines * Implement EmitSoundIntervalComponent and a bunch of arcade noises * Require power for sounds * Allow earlier startup intervals * Orange glow * Audio attributions * Include the PR link * Replace EmitSoundInterval with expanded SpamEmitSound * Remove pacman-themed arcade sounds * Documentation good. * Updated methods to use Entity<T> * Refactored SpamEmitSound to get rid of accumulator and chance. * Fixed prewarm logic * Moved stuff to Shared * Fix outdated YAML * Better prediction, auto pause handling * Make enable/disable reset the timer instead of trying to save it.
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Content.Server.Power.Components;
|
|
using Content.Server.Power.EntitySystems;
|
|
using Content.Shared.Sound;
|
|
using Content.Shared.Sound.Components;
|
|
|
|
namespace Content.Server.Sound;
|
|
|
|
public sealed partial class SpamEmitSoundRequirePowerSystem : SharedSpamEmitSoundRequirePowerSystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SpamEmitSoundRequirePowerComponent, PowerChangedEvent>(OnPowerChanged);
|
|
SubscribeLocalEvent<SpamEmitSoundRequirePowerComponent, PowerNetBatterySupplyEvent>(OnPowerSupply);
|
|
}
|
|
|
|
private void OnPowerChanged(Entity<SpamEmitSoundRequirePowerComponent> entity, ref PowerChangedEvent args)
|
|
{
|
|
if (TryComp<SpamEmitSoundComponent>(entity.Owner, out var comp))
|
|
{
|
|
EmitSound.SetEnabled((entity, comp), args.Powered);
|
|
}
|
|
}
|
|
|
|
private void OnPowerSupply(Entity<SpamEmitSoundRequirePowerComponent> entity, ref PowerNetBatterySupplyEvent args)
|
|
{
|
|
if (TryComp<SpamEmitSoundComponent>(entity.Owner, out var comp))
|
|
{
|
|
EmitSound.SetEnabled((entity, comp), args.Supply);
|
|
}
|
|
}
|
|
}
|