From 3d6d7820d641450ca6c6903edd20e85af311a8b6 Mon Sep 17 00:00:00 2001 From: c4llv07e <38111072+c4llv07e@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:12:39 +0300 Subject: [PATCH] Fix tray scanner not updating it's range. (#26789) Fix tray scanner not updating it's range on change. Add range value to the tray scanner state.to synchronize it between client and server. --- Content.Shared/SubFloor/SharedTrayScannerSystem.cs | 3 ++- Content.Shared/SubFloor/TrayScannerComponent.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Content.Shared/SubFloor/SharedTrayScannerSystem.cs b/Content.Shared/SubFloor/SharedTrayScannerSystem.cs index da56c8d1c7..6e8393036d 100644 --- a/Content.Shared/SubFloor/SharedTrayScannerSystem.cs +++ b/Content.Shared/SubFloor/SharedTrayScannerSystem.cs @@ -48,7 +48,7 @@ public abstract class SharedTrayScannerSystem : EntitySystem private void OnTrayScannerGetState(EntityUid uid, TrayScannerComponent scanner, ref ComponentGetState args) { - args.State = new TrayScannerState(scanner.Enabled); + args.State = new TrayScannerState(scanner.Enabled, scanner.Range); } private void OnTrayScannerHandleState(EntityUid uid, TrayScannerComponent scanner, ref ComponentHandleState args) @@ -56,6 +56,7 @@ public abstract class SharedTrayScannerSystem : EntitySystem if (args.Current is not TrayScannerState state) return; + scanner.Range = state.Range; SetScannerEnabled(uid, state.Enabled, scanner); } } diff --git a/Content.Shared/SubFloor/TrayScannerComponent.cs b/Content.Shared/SubFloor/TrayScannerComponent.cs index 98e43246a8..acde11ff50 100644 --- a/Content.Shared/SubFloor/TrayScannerComponent.cs +++ b/Content.Shared/SubFloor/TrayScannerComponent.cs @@ -22,9 +22,11 @@ public sealed partial class TrayScannerComponent : Component public sealed class TrayScannerState : ComponentState { public bool Enabled; + public float Range; - public TrayScannerState(bool enabled) + public TrayScannerState(bool enabled, float range) { Enabled = enabled; + Range = range; } } -- 2.52.0