Files
wwdpublic/Content.Client/_White/Light/RotatePointLightSystem.cs
RedFoxIV 6d4215b08d dollar store spookston (#258)
* initial sidestream port

* ru locale

* blyatison

* упс

* jannie qol (#6)

* initial sidestream port

* blyadison

* cs1.4 (#4)

* initial sidestream port
* blyatison

* antitryaska (#7)

* initial sidestream port (still fucked though)

* blyatison

* o fugg (#8) speedmerge

* o fugg

* fugg :-DDD

* attempt numero uno (#9)

* fix desword sound (#10)

* раз уж я тут сижу

* whoops

* shit

---------

Co-authored-by: Spatison <137375981+Spatison@users.noreply.github.com>
2025-03-03 14:29:21 +02:00

41 lines
1.3 KiB
C#

using Content.Shared._White.Light.Components;
using Content.Shared._White.RotatePointLight;
using Robust.Client.GameObjects;
using Robust.Shared.Containers;
namespace Content.Client._White.Light;
/// <summary>
/// pointlight's rotation is not a datafield and is restricted by access attribute
/// Fuck robust toolbox, all my homies hate robust toolbox
/// </summary>
public sealed class RotatePointLightSystem : SharedRotatePointLightSystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RotatePointLightComponent, ComponentStartup>(CompStartup);
SubscribeLocalEvent<RotatePointLightComponent, AfterAutoHandleStateEvent>(AfterAutoState);
}
private void CompStartup(EntityUid uid, RotatePointLightComponent comp, ComponentStartup args)
{
UpdateRotation(uid, comp);
}
private void AfterAutoState(EntityUid uid, RotatePointLightComponent comp, AfterAutoHandleStateEvent args)
{
UpdateRotation(uid, comp);
}
protected override void UpdateRotation(EntityUid uid, RotatePointLightComponent comp)
{
if (!TryComp<PointLightComponent>(uid, out var light))
return;
#pragma warning disable RA0002
light.Rotation = comp.Enabled ? comp.Angle : 0;
#pragma warning restore RA0002
}
}