Lights now go CLUNK when turned on.

This commit is contained in:
Pieter-Jan Briers
2019-03-20 01:12:38 +01:00
parent d5559e44bb
commit c17bc612ff

View File

@@ -1,6 +1,12 @@
using System;
using SS14.Server.GameObjects;
using SS14.Server.GameObjects.EntitySystems;
using SS14.Shared.Audio;
using SS14.Shared.Enums;
using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Timing;
using SS14.Shared.IoC;
namespace Content.Server.GameObjects.Components.Power
{
@@ -8,6 +14,10 @@ namespace Content.Server.GameObjects.Components.Power
{
public override string Name => "PoweredLight";
private static readonly TimeSpan _thunkDelay = TimeSpan.FromSeconds(2);
private TimeSpan _lastThunk;
public override void Initialize()
{
base.Initialize();
@@ -21,6 +31,12 @@ namespace Content.Server.GameObjects.Components.Power
{
sprite.LayerSetState(0, "on");
light.State = LightState.On;
var time = IoCManager.Resolve<IGameTiming>().CurTime;
if (time > _lastThunk + _thunkDelay)
{
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
.Play("/Audio/machines/light_tube_on.ogg", Owner, AudioParams.Default.WithVolume(-10f));
}
}
else
{