Use ECS prototype-reload events (#22613)
* Use ECS prototype-reload events * better constructors * Maybe this fixes tests?
This commit is contained in:
@@ -24,14 +24,13 @@ public sealed class ParallaxSystem : SharedParallaxSystem
|
||||
{
|
||||
base.Initialize();
|
||||
_overlay.AddOverlay(new ParallaxOverlay());
|
||||
_protoManager.PrototypesReloaded += OnReload;
|
||||
|
||||
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnReload);
|
||||
SubscribeLocalEvent<ParallaxComponent, AfterAutoHandleStateEvent>(OnAfterAutoHandleState);
|
||||
}
|
||||
|
||||
private void OnReload(PrototypesReloadedEventArgs obj)
|
||||
{
|
||||
if (!obj.ByType.ContainsKey(typeof(ParallaxPrototype)))
|
||||
if (!obj.WasModified<ParallaxPrototype>())
|
||||
return;
|
||||
|
||||
_parallax.UnloadParallax(Fallback);
|
||||
@@ -48,7 +47,6 @@ public sealed class ParallaxSystem : SharedParallaxSystem
|
||||
{
|
||||
base.Shutdown();
|
||||
_overlay.RemoveOverlay<ParallaxOverlay>();
|
||||
_protoManager.PrototypesReloaded -= OnReload;
|
||||
}
|
||||
|
||||
private void OnAfterAutoHandleState(EntityUid uid, ParallaxComponent component, ref AfterAutoHandleStateEvent args)
|
||||
|
||||
Reference in New Issue
Block a user