Lights now use dependencies.
This commit is contained in:
@@ -31,6 +31,8 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class PoweredLightComponent : Component, IInteractHand, IInteractUsing, IMapInit, ISignalReceiver
|
public class PoweredLightComponent : Component, IInteractHand, IInteractUsing, IMapInit, ISignalReceiver
|
||||||
{
|
{
|
||||||
|
[Dependency] private IGameTiming _gameTiming = default!;
|
||||||
|
|
||||||
public override string Name => "PoweredLight";
|
public override string Name => "PoweredLight";
|
||||||
|
|
||||||
private static readonly TimeSpan _thunkDelay = TimeSpan.FromSeconds(2);
|
private static readonly TimeSpan _thunkDelay = TimeSpan.FromSeconds(2);
|
||||||
@@ -40,6 +42,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
|||||||
|
|
||||||
private LightBulbType BulbType = LightBulbType.Tube;
|
private LightBulbType BulbType = LightBulbType.Tube;
|
||||||
[ViewVariables] private ContainerSlot _lightBulbContainer;
|
[ViewVariables] private ContainerSlot _lightBulbContainer;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
private LightBulbComponent LightBulb
|
private LightBulbComponent LightBulb
|
||||||
{
|
{
|
||||||
@@ -209,7 +212,7 @@ namespace Content.Server.GameObjects.Components.Power.ApcNetComponents.PowerRece
|
|||||||
sprite.LayerSetState(0, "on");
|
sprite.LayerSetState(0, "on");
|
||||||
light.Enabled = true;
|
light.Enabled = true;
|
||||||
light.Color = LightBulb.Color;
|
light.Color = LightBulb.Color;
|
||||||
var time = IoCManager.Resolve<IGameTiming>().CurTime;
|
var time = _gameTiming.CurTime;
|
||||||
if (time > _lastThunk + _thunkDelay)
|
if (time > _lastThunk + _thunkDelay)
|
||||||
{
|
{
|
||||||
_lastThunk = time;
|
_lastThunk = time;
|
||||||
|
|||||||
Reference in New Issue
Block a user