Update submodule: light cleanup.

This commit is contained in:
Pieter-Jan Briers
2019-07-30 13:31:46 +02:00
parent 15d81c1876
commit 1132e5b6a7
6 changed files with 21 additions and 23 deletions

View File

@@ -5,7 +5,6 @@ using Content.Shared.GameObjects;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Shared.Audio;
using Robust.Shared.Enums;
using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Timing;
@@ -68,7 +67,7 @@ namespace Content.Server.GameObjects.Components.Power
bool CanBurn(int heatResistance)
{
return _lightState == LightState.On && heatResistance < LightBulb.BurningTemperature;
return _lightState && heatResistance < LightBulb.BurningTemperature;
}
void Burn()
@@ -135,8 +134,8 @@ namespace Content.Server.GameObjects.Components.Power
UpdateLight();
}
private LightState _lightState => Owner.GetComponent<PointLightComponent>().State;
private bool _lightState => Owner.GetComponent<PointLightComponent>().Enabled;
/// <summary>
/// Updates the light's power drain, sprite and actual light state.
/// </summary>
@@ -149,7 +148,7 @@ namespace Content.Server.GameObjects.Components.Power
{
device.Load = 0;
sprite.LayerSetState(0, "empty");
light.State = LightState.Off;
light.Enabled = false;
return;
}
@@ -160,7 +159,7 @@ namespace Content.Server.GameObjects.Components.Power
if (device.Powered)
{
sprite.LayerSetState(0, "on");
light.State = LightState.On;
light.Enabled = true;
light.Color = LightBulb.Color;
var time = IoCManager.Resolve<IGameTiming>().CurTime;
if (time > _lastThunk + _thunkDelay)
@@ -172,18 +171,18 @@ namespace Content.Server.GameObjects.Components.Power
else
{
sprite.LayerSetState(0, "off");
light.State = LightState.Off;
light.Enabled = false;
}
break;
case LightBulbState.Broken:
device.Load = 0;
sprite.LayerSetState(0, "broken");
light.State = LightState.Off;
light.Enabled = false;
break;
case LightBulbState.Burned:
device.Load = 0;
sprite.LayerSetState(0, "burned");
light.State = LightState.Off;
light.Enabled = false;
break;
}
}