autogen parallax state (#15384)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -2,7 +2,6 @@ using Content.Client.Parallax.Data;
|
||||
using Content.Client.Parallax.Managers;
|
||||
using Content.Shared.Parallax;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
@@ -22,8 +21,9 @@ public sealed class ParallaxSystem : SharedParallaxSystem
|
||||
{
|
||||
base.Initialize();
|
||||
_overlay.AddOverlay(new ParallaxOverlay());
|
||||
SubscribeLocalEvent<ParallaxComponent, ComponentHandleState>(OnParallaxHandleState);
|
||||
_protoManager.PrototypesReloaded += OnReload;
|
||||
|
||||
SubscribeLocalEvent<ParallaxComponent, AfterAutoHandleStateEvent>(OnAfterAutoHandleState);
|
||||
}
|
||||
|
||||
private void OnReload(PrototypesReloadedEventArgs obj)
|
||||
@@ -48,11 +48,8 @@ public sealed class ParallaxSystem : SharedParallaxSystem
|
||||
_protoManager.PrototypesReloaded -= OnReload;
|
||||
}
|
||||
|
||||
private void OnParallaxHandleState(EntityUid uid, ParallaxComponent component, ref ComponentHandleState args)
|
||||
private void OnAfterAutoHandleState(EntityUid uid, ParallaxComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not ParallaxComponentState state) return;
|
||||
component.Parallax = state.Parallax;
|
||||
|
||||
if (!_parallax.IsLoaded(component.Parallax))
|
||||
{
|
||||
_parallax.LoadParallaxByName(component.Parallax);
|
||||
|
||||
Reference in New Issue
Block a user