mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 16:47:26 +00:00
* Fix various light sources counting as Light, Give Skia spacewalk * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Replace the Ignore Gravity with Jetpack * Clean up event code + Avoid touching upstream code where possible * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Double cone, strategic untouches * Additional strategic untouch --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
28 lines
787 B
C#
28 lines
787 B
C#
using Content.Shared._DV.Light;
|
|
using Content.Shared.Light.Components;
|
|
|
|
namespace Content.Shared._DV.Light.EntitySystems;
|
|
|
|
public sealed partial class ItemTogglePointLightEnergySystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedPointLightSystem _light = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<ItemTogglePointLightComponent, OnGetLightEnergyEvent>(GetLightEnergy);
|
|
}
|
|
private void GetLightEnergy(Entity<ItemTogglePointLightComponent> ent, ref OnGetLightEnergyEvent args)
|
|
{
|
|
if (!_light.TryGetLight(ent.Owner, out var light))
|
|
return;
|
|
|
|
if (!light.Enabled)
|
|
return;
|
|
|
|
args.LightEnergy = light.Energy;
|
|
args.LightRadius = light.Radius;
|
|
}
|
|
}
|