mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
* 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>
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using Content.Shared._White.Light.Components;
|
|
using Robust.Shared.Containers;
|
|
|
|
namespace Content.Shared._White.RotatePointLight;
|
|
|
|
public abstract class SharedRotatePointLightSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<RotatePointLightComponent, ComponentInit>(CompInit);
|
|
SubscribeLocalEvent<RotatePointLightComponent, EntGotInsertedIntoContainerMessage>(OnInserted);
|
|
SubscribeLocalEvent<RotatePointLightComponent, EntGotRemovedFromContainerMessage>(OnRemoved);
|
|
}
|
|
|
|
private void CompInit(EntityUid uid, RotatePointLightComponent comp, ComponentInit args)
|
|
{
|
|
if (!TryComp<TransformComponent>(uid, out var xform))
|
|
return;
|
|
|
|
comp.Enabled = xform.GridUid == xform.ParentUid ||
|
|
xform.MapUid == xform.ParentUid;
|
|
Dirty(uid, comp);
|
|
UpdateRotation(uid, comp);
|
|
}
|
|
|
|
|
|
private void OnInserted(EntityUid uid, RotatePointLightComponent comp, EntGotInsertedIntoContainerMessage args)
|
|
{
|
|
comp.Enabled = false;
|
|
Dirty(uid, comp);
|
|
UpdateRotation(uid, comp);
|
|
}
|
|
|
|
private void OnRemoved(EntityUid uid, RotatePointLightComponent comp, EntGotRemovedFromContainerMessage args)
|
|
{
|
|
comp.Enabled = true;
|
|
Dirty(uid, comp);
|
|
UpdateRotation(uid, comp);
|
|
}
|
|
|
|
protected virtual void UpdateRotation(EntityUid uid, RotatePointLightComponent comp) { }
|
|
|
|
}
|