threshold cloning
This commit is contained in:
@@ -75,17 +75,17 @@ namespace Content.Server.Atmos.Monitor.Systems
|
|||||||
private void OnAtmosMonitorInit(EntityUid uid, AtmosMonitorComponent component, ComponentInit args)
|
private void OnAtmosMonitorInit(EntityUid uid, AtmosMonitorComponent component, ComponentInit args)
|
||||||
{
|
{
|
||||||
if (component.TemperatureThresholdId != null)
|
if (component.TemperatureThresholdId != null)
|
||||||
component.TemperatureThreshold = _prototypeManager.Index<AtmosAlarmThreshold>(component.TemperatureThresholdId);
|
component.TemperatureThreshold = new(_prototypeManager.Index<AtmosAlarmThreshold>(component.TemperatureThresholdId));
|
||||||
|
|
||||||
if (component.PressureThresholdId != null)
|
if (component.PressureThresholdId != null)
|
||||||
component.PressureThreshold = _prototypeManager.Index<AtmosAlarmThreshold>(component.PressureThresholdId);
|
component.PressureThreshold = new(_prototypeManager.Index<AtmosAlarmThreshold>(component.PressureThresholdId));
|
||||||
|
|
||||||
if (component.GasThresholdIds != null)
|
if (component.GasThresholdIds != null)
|
||||||
{
|
{
|
||||||
component.GasThresholds = new();
|
component.GasThresholds = new();
|
||||||
foreach (var (gas, id) in component.GasThresholdIds)
|
foreach (var (gas, id) in component.GasThresholdIds)
|
||||||
if (_prototypeManager.TryIndex<AtmosAlarmThreshold>(id, out var gasThreshold))
|
if (_prototypeManager.TryIndex<AtmosAlarmThreshold>(id, out var gasThreshold))
|
||||||
component.GasThresholds.Add(gas, gasThreshold);
|
component.GasThresholds.Add(gas, new(gasThreshold));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,15 @@ namespace Content.Shared.Atmos.Monitor
|
|||||||
get => CalculateWarningBound(AtmosMonitorThresholdBound.Lower);
|
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()
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
if (UpperBound <= LowerBound)
|
if (UpperBound <= LowerBound)
|
||||||
|
|||||||
Reference in New Issue
Block a user