From 0d6fcb60f507cc3abb57d00e3bad716eb0e7701d Mon Sep 17 00:00:00 2001 From: Spatison <137375981+Spatison@users.noreply.github.com> Date: Sun, 12 Jan 2025 12:22:30 +1000 Subject: [PATCH] Fix Silo Distation (#1502) # Description I forgot about it. --- # Changelog :cl: Aviu00 - fix: Fix silo being out of range. (cherry picked from commit 34c2bbca74b5a10d6a8466e728cc48b0acda5655) --- Content.Server/Materials/MaterialSiloSystem.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Content.Server/Materials/MaterialSiloSystem.cs b/Content.Server/Materials/MaterialSiloSystem.cs index 649a82f7af..1573da2313 100644 --- a/Content.Server/Materials/MaterialSiloSystem.cs +++ b/Content.Server/Materials/MaterialSiloSystem.cs @@ -4,6 +4,7 @@ using Content.Server.Station.Components; using Content.Shared.DeviceLinking; using Content.Shared.Lathe; using Content.Shared.Materials; +using Robust.Server.GameStates; using Robust.Shared.Timing; namespace Content.Server.Materials; @@ -11,6 +12,7 @@ namespace Content.Server.Materials; public sealed class MaterialSiloSystem : SharedMaterialSiloSystem { [Dependency] private readonly LatheSystem _lathe = default!; + [Dependency] private readonly PvsOverrideSystem _pvs = default!; public override void Initialize() { @@ -18,6 +20,8 @@ public sealed class MaterialSiloSystem : SharedMaterialSiloSystem SubscribeLocalEvent(OnMapInit); SubscribeLocalEvent(OnMaterialAmountChanged); + SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnShutdown); } private void OnMaterialAmountChanged(Entity ent, ref MaterialAmountChangedEvent args) @@ -67,4 +71,14 @@ public sealed class MaterialSiloSystem : SharedMaterialSiloSystem DeviceLink.LinkDefaults(null, silo.Value, utilizer, silo.Value.Comp, sink); } } + + private void OnStartup(Entity ent, ref ComponentStartup args) + { + _pvs.AddGlobalOverride(ent); + } + + private void OnShutdown(Entity ent, ref ComponentShutdown args) + { + _pvs.RemoveGlobalOverride(ent); + } }