From 32e2686a4b92561c200c4817f0e235f8f3ac26b2 Mon Sep 17 00:00:00 2001 From: vulppine Date: Wed, 17 Aug 2022 20:52:04 -0700 Subject: [PATCH] threshold cloning --- .../Atmos/Monitor/Systems/AtmosMonitoringSystem.cs | 6 +++--- .../Atmos/Monitor/AtmosAlarmThresholdPrototype.cs | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs index b7f11ba996..d94f97d801 100644 --- a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs +++ b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs @@ -75,17 +75,17 @@ namespace Content.Server.Atmos.Monitor.Systems private void OnAtmosMonitorInit(EntityUid uid, AtmosMonitorComponent component, ComponentInit args) { if (component.TemperatureThresholdId != null) - component.TemperatureThreshold = _prototypeManager.Index(component.TemperatureThresholdId); + component.TemperatureThreshold = new(_prototypeManager.Index(component.TemperatureThresholdId)); if (component.PressureThresholdId != null) - component.PressureThreshold = _prototypeManager.Index(component.PressureThresholdId); + component.PressureThreshold = new(_prototypeManager.Index(component.PressureThresholdId)); if (component.GasThresholdIds != null) { component.GasThresholds = new(); foreach (var (gas, id) in component.GasThresholdIds) if (_prototypeManager.TryIndex(id, out var gasThreshold)) - component.GasThresholds.Add(gas, gasThreshold); + component.GasThresholds.Add(gas, new(gasThreshold)); } } diff --git a/Content.Shared/Atmos/Monitor/AtmosAlarmThresholdPrototype.cs b/Content.Shared/Atmos/Monitor/AtmosAlarmThresholdPrototype.cs index c3270e6b69..68ac59b86d 100644 --- a/Content.Shared/Atmos/Monitor/AtmosAlarmThresholdPrototype.cs +++ b/Content.Shared/Atmos/Monitor/AtmosAlarmThresholdPrototype.cs @@ -52,6 +52,15 @@ namespace Content.Shared.Atmos.Monitor get => CalculateWarningBound(AtmosMonitorThresholdBound.Lower); } + public AtmosAlarmThreshold(AtmosAlarmThreshold other) + { + Ignore = other.Ignore; + UpperBound = other.UpperBound; + LowerBound = other.LowerBound; + UpperWarningPercentage = other.UpperWarningPercentage; + LowerWarningPercentage = other.LowerWarningPercentage; + } + void ISerializationHooks.AfterDeserialization() { if (UpperBound <= LowerBound)