Many lighting tweaks (#4709)
This commit is contained in:
@@ -2,6 +2,8 @@ using System;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Light.Components;
|
||||
using Content.Server.MachineLinking.Events;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Light;
|
||||
using Content.Shared.Damage;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -24,6 +26,9 @@ namespace Content.Server.Light.EntitySystems
|
||||
SubscribeLocalEvent<PoweredLightComponent, GhostBooEvent>(OnGhostBoo);
|
||||
SubscribeLocalEvent<PoweredLightComponent, SignalReceivedEvent>(OnSignalReceived);
|
||||
SubscribeLocalEvent<PoweredLightComponent, DamageChangedEvent>(HandleLightDamaged);
|
||||
|
||||
SubscribeLocalEvent<LitOnPoweredComponent, PowerChangedEvent>(OnPowerChanged);
|
||||
SubscribeLocalEvent<LitOnPoweredComponent, PowerNetBatterySupplyEvent>(OnPowerSupply);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -84,5 +89,21 @@ namespace Content.Server.Light.EntitySystems
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPowerChanged(EntityUid uid, LitOnPoweredComponent component, PowerChangedEvent args)
|
||||
{
|
||||
if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
|
||||
{
|
||||
light.Enabled = args.Powered;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPowerSupply(EntityUid uid, LitOnPoweredComponent component, PowerNetBatterySupplyEvent args)
|
||||
{
|
||||
if (EntityManager.TryGetComponent<PointLightComponent>(uid, out var light))
|
||||
{
|
||||
light.Enabled = args.Supply;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user