Content/Light: make lights actually require power after changing the lightbulb (#4953)

This commit is contained in:
E F R
2021-10-22 06:46:22 +00:00
committed by GitHub
parent 5b531b7dcf
commit 85f2fcb86b

View File

@@ -219,11 +219,11 @@ namespace Content.Server.Light.Components
public void UpdateLight() public void UpdateLight()
{ {
var powerReceiver = Owner.GetComponent<ApcPowerReceiverComponent>(); var powerReceiver = Owner.GetComponent<ApcPowerReceiverComponent>();
powerReceiver.Load = (LightBulb != null && _on && LightBulb.State == LightBulbState.Normal) ? LightBulb.PowerUse : 0;
if (LightBulb == null) // No light bulb. if (LightBulb == null) // No light bulb.
{ {
SetLight(false); SetLight(false);
powerReceiver.Load = 0;
_appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Empty); _appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Empty);
return; return;
} }
@@ -234,7 +234,6 @@ namespace Content.Server.Light.Components
if (powerReceiver.Powered && _on) if (powerReceiver.Powered && _on)
{ {
SetLight(true, LightBulb.Color); SetLight(true, LightBulb.Color);
powerReceiver.Load = LightBulb.PowerUse;
_appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.On); _appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.On);
var time = _gameTiming.CurTime; var time = _gameTiming.CurTime;
if (time > _lastThunk + _thunkDelay) if (time > _lastThunk + _thunkDelay)