Cleans up the appearance and ambience of various atmos devices. (#9071)
This commit is contained in:
committed by
GitHub
parent
6b619e6376
commit
9090460e0e
@@ -29,6 +29,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<GasPressurePumpComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceUpdateEvent>(OnPumpUpdated);
|
||||
SubscribeLocalEvent<GasPressurePumpComponent, AtmosDeviceDisabledEvent>(OnPumpLeaveAtmosphere);
|
||||
SubscribeLocalEvent<GasPressurePumpComponent, ExaminedEvent>(OnExamined);
|
||||
@@ -38,6 +39,11 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
SubscribeLocalEvent<GasPressurePumpComponent, GasPressurePumpToggleStatusMessage>(OnToggleStatusMessage);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, GasPressurePumpComponent pump, ComponentInit args)
|
||||
{
|
||||
UpdateAppearance(uid, pump);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, GasPressurePumpComponent pump, ExaminedEvent args)
|
||||
{
|
||||
if (!EntityManager.GetComponent<TransformComponent>(pump.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
||||
@@ -52,14 +58,11 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
private void OnPumpUpdated(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = EntityManager.GetComponentOrNull<AppearanceComponent>(pump.Owner);
|
||||
|
||||
if (!pump.Enabled
|
||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|| !nodeContainer.TryGetNode(pump.InletName, out PipeNode? inlet)
|
||||
|| !nodeContainer.TryGetNode(pump.OutletName, out PipeNode? outlet))
|
||||
{
|
||||
appearance?.SetData(PumpVisuals.Enabled, false);
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, false);
|
||||
return;
|
||||
}
|
||||
@@ -68,42 +71,40 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
if (outputStartingPressure >= pump.TargetPressure)
|
||||
{
|
||||
appearance?.SetData(PumpVisuals.Enabled, false);
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, false);
|
||||
return; // No need to pump gas if target has been reached.
|
||||
}
|
||||
|
||||
if (inlet.Air.TotalMoles > 0 && inlet.Air.Temperature > 0)
|
||||
{
|
||||
appearance?.SetData(PumpVisuals.Enabled, true);
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, true);
|
||||
|
||||
// We calculate the necessary moles to transfer using our good ol' friend PV=nRT.
|
||||
var pressureDelta = pump.TargetPressure - outputStartingPressure;
|
||||
var transferMoles = (pressureDelta * outlet.Air.Volume) / (inlet.Air.Temperature * Atmospherics.R);
|
||||
|
||||
var removed = inlet.Air.Remove(transferMoles);
|
||||
_atmosphereSystem.Merge(outlet.Air, removed);
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, removed.TotalMoles > 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent component, AtmosDeviceDisabledEvent args)
|
||||
private void OnPumpLeaveAtmosphere(EntityUid uid, GasPressurePumpComponent pump, AtmosDeviceDisabledEvent args)
|
||||
{
|
||||
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(PumpVisuals.Enabled, false);
|
||||
}
|
||||
pump.Enabled = false;
|
||||
UpdateAppearance(uid, pump);
|
||||
|
||||
DirtyUI(uid, pump);
|
||||
_userInterfaceSystem.TryCloseAll(uid, GasPressurePumpUiKey.Key);
|
||||
}
|
||||
|
||||
private void OnPumpInteractHand(EntityUid uid, GasPressurePumpComponent component, InteractHandEvent args)
|
||||
private void OnPumpInteractHand(EntityUid uid, GasPressurePumpComponent pump, InteractHandEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
if (EntityManager.GetComponent<TransformComponent>(component.Owner).Anchored)
|
||||
if (EntityManager.GetComponent<TransformComponent>(pump.Owner).Anchored)
|
||||
{
|
||||
_userInterfaceSystem.TryOpen(uid, GasPressurePumpUiKey.Key, actor.PlayerSession);
|
||||
DirtyUI(uid, component);
|
||||
DirtyUI(uid, pump);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -119,6 +120,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
_adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
|
||||
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
|
||||
DirtyUI(uid, pump);
|
||||
UpdateAppearance(uid, pump);
|
||||
}
|
||||
|
||||
private void OnOutputPressureChangeMessage(EntityUid uid, GasPressurePumpComponent pump, GasPressurePumpChangeOutputPressureMessage args)
|
||||
@@ -138,5 +140,13 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
_userInterfaceSystem.TrySetUiState(uid, GasPressurePumpUiKey.Key,
|
||||
new GasPressurePumpBoundUserInterfaceState(EntityManager.GetComponent<MetaDataComponent>(pump.Owner).EntityName, pump.TargetPressure, pump.Enabled));
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, GasPressurePumpComponent? pump = null, AppearanceComponent? appearance = null)
|
||||
{
|
||||
if (!Resolve(uid, ref pump, ref appearance, false))
|
||||
return;
|
||||
|
||||
appearance.SetData(PumpVisuals.Enabled, pump.Enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,9 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<GasVolumePumpComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<GasVolumePumpComponent, AtmosDeviceUpdateEvent>(OnVolumePumpUpdated);
|
||||
SubscribeLocalEvent<GasVolumePumpComponent, AtmosDeviceDisabledEvent>(OnVolumePumpLeaveAtmosphere);
|
||||
SubscribeLocalEvent<GasVolumePumpComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<GasVolumePumpComponent, InteractHandEvent>(OnPumpInteractHand);
|
||||
// Bound UI subscriptions
|
||||
@@ -38,6 +40,11 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
SubscribeLocalEvent<GasVolumePumpComponent, GasVolumePumpToggleStatusMessage>(OnToggleStatusMessage);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, GasVolumePumpComponent pump, ComponentInit args)
|
||||
{
|
||||
UpdateAppearance(uid, pump);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, GasVolumePumpComponent pump, ExaminedEvent args)
|
||||
{
|
||||
if (!EntityManager.GetComponent<TransformComponent>(pump.Owner).Anchored || !args.IsInDetailsRange) // Not anchored? Out of range? No status.
|
||||
@@ -52,22 +59,16 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
|
||||
private void OnVolumePumpUpdated(EntityUid uid, GasVolumePumpComponent pump, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
TryComp(uid, out AppearanceComponent? appearance);
|
||||
|
||||
if (!pump.Enabled
|
||||
|| !TryComp(uid, out NodeContainerComponent? nodeContainer)
|
||||
|| !TryComp(uid, out AtmosDeviceComponent? device)
|
||||
|| !nodeContainer.TryGetNode(pump.InletName, out PipeNode? inlet)
|
||||
|| !nodeContainer.TryGetNode(pump.OutletName, out PipeNode? outlet))
|
||||
{
|
||||
appearance?.SetData(PumpVisuals.Enabled, false);
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, false);
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, false);
|
||||
return;
|
||||
}
|
||||
|
||||
appearance?.SetData(PumpVisuals.Enabled, true);
|
||||
|
||||
var inputStartingPressure = inlet.Air.Pressure;
|
||||
var outputStartingPressure = outlet.Air.Pressure;
|
||||
|
||||
@@ -79,8 +80,6 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
if ((outputStartingPressure - inputStartingPressure > pump.OverclockThreshold) && pump.Overclocked)
|
||||
return;
|
||||
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, true);
|
||||
|
||||
// We multiply the transfer rate in L/s by the seconds passed since the last process to get the liters.
|
||||
var transferRatio = (float)(pump.TransferRate * (_gameTiming.CurTime - device.LastProcess).TotalSeconds) / inlet.Air.Volume;
|
||||
|
||||
@@ -99,17 +98,27 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
}
|
||||
|
||||
_atmosphereSystem.Merge(outlet.Air, removed);
|
||||
_ambientSoundSystem.SetAmbience(pump.Owner, removed.TotalMoles > 0f);
|
||||
}
|
||||
|
||||
private void OnPumpInteractHand(EntityUid uid, GasVolumePumpComponent component, InteractHandEvent args)
|
||||
private void OnVolumePumpLeaveAtmosphere(EntityUid uid, GasVolumePumpComponent pump, AtmosDeviceDisabledEvent args)
|
||||
{
|
||||
pump.Enabled = false;
|
||||
UpdateAppearance(uid, pump);
|
||||
|
||||
DirtyUI(uid, pump);
|
||||
_userInterfaceSystem.TryCloseAll(uid, GasVolumePumpUiKey.Key);
|
||||
}
|
||||
|
||||
private void OnPumpInteractHand(EntityUid uid, GasVolumePumpComponent pump, InteractHandEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
if (EntityManager.GetComponent<TransformComponent>(component.Owner).Anchored)
|
||||
if (EntityManager.GetComponent<TransformComponent>(pump.Owner).Anchored)
|
||||
{
|
||||
_userInterfaceSystem.TryOpen(uid, GasVolumePumpUiKey.Key, actor.PlayerSession);
|
||||
DirtyUI(uid, component);
|
||||
DirtyUI(uid, pump);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -125,6 +134,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
_adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
|
||||
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
|
||||
DirtyUI(uid, pump);
|
||||
UpdateAppearance(uid, pump);
|
||||
}
|
||||
|
||||
private void OnTransferRateChangeMessage(EntityUid uid, GasVolumePumpComponent pump, GasVolumePumpChangeTransferRateMessage args)
|
||||
@@ -143,5 +153,13 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
|
||||
_userInterfaceSystem.TrySetUiState(uid, GasVolumePumpUiKey.Key,
|
||||
new GasVolumePumpBoundUserInterfaceState(EntityManager.GetComponent<MetaDataComponent>(pump.Owner).EntityName, pump.TransferRate, pump.Enabled));
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, GasVolumePumpComponent? pump = null, AppearanceComponent? appearance = null)
|
||||
{
|
||||
if (!Resolve(uid, ref pump, ref appearance, false))
|
||||
return;
|
||||
|
||||
appearance.SetData(PumpVisuals.Enabled, pump.Enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,45 +30,32 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<GasFilterComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<GasFilterComponent, AtmosDeviceUpdateEvent>(OnFilterUpdated);
|
||||
SubscribeLocalEvent<GasFilterComponent, AtmosDeviceDisabledEvent>(OnFilterLeaveAtmosphere);
|
||||
SubscribeLocalEvent<GasFilterComponent, InteractHandEvent>(OnFilterInteractHand);
|
||||
// Bound UI subscriptions
|
||||
SubscribeLocalEvent<GasFilterComponent, GasFilterChangeRateMessage>(OnTransferRateChangeMessage);
|
||||
SubscribeLocalEvent<GasFilterComponent, GasFilterSelectGasMessage>(OnSelectGasMessage);
|
||||
SubscribeLocalEvent<GasFilterComponent, GasFilterToggleStatusMessage>(OnToggleStatusMessage);
|
||||
|
||||
SubscribeLocalEvent<GasFilterComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||
}
|
||||
|
||||
private void OnAnchorChanged(EntityUid uid, GasFilterComponent component, ref AnchorStateChangedEvent args)
|
||||
private void OnInit(EntityUid uid, GasFilterComponent filter, ComponentInit args)
|
||||
{
|
||||
if (args.Anchored)
|
||||
return;
|
||||
|
||||
component.Enabled = false;
|
||||
if (TryComp(uid, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(FilterVisuals.Enabled, false);
|
||||
_ambientSoundSystem.SetAmbience(component.Owner, false);
|
||||
}
|
||||
|
||||
DirtyUI(uid, component);
|
||||
_userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key);
|
||||
UpdateAppearance(uid, filter);
|
||||
}
|
||||
|
||||
private void OnFilterUpdated(EntityUid uid, GasFilterComponent filter, AtmosDeviceUpdateEvent args)
|
||||
{
|
||||
var appearance = EntityManager.GetComponentOrNull<AppearanceComponent>(filter.Owner);
|
||||
|
||||
if (!filter.Enabled
|
||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device)
|
||||
|| !nodeContainer.TryGetNode(filter.InletName, out PipeNode? inletNode)
|
||||
|| !nodeContainer.TryGetNode(filter.FilterName, out PipeNode? filterNode)
|
||||
|| !nodeContainer.TryGetNode(filter.OutletName, out PipeNode? outletNode)
|
||||
|| outletNode.Air.Pressure >= Atmospherics.MaxOutputPressure) // No need to transfer if target is full.
|
||||
|| !EntityManager.TryGetComponent(uid, out NodeContainerComponent? nodeContainer)
|
||||
|| !EntityManager.TryGetComponent(uid, out AtmosDeviceComponent? device)
|
||||
|| !nodeContainer.TryGetNode(filter.InletName, out PipeNode? inletNode)
|
||||
|| !nodeContainer.TryGetNode(filter.FilterName, out PipeNode? filterNode)
|
||||
|| !nodeContainer.TryGetNode(filter.OutletName, out PipeNode? outletNode)
|
||||
|| outletNode.Air.Pressure >= Atmospherics.MaxOutputPressure) // No need to transfer if target is full.
|
||||
{
|
||||
appearance?.SetData(FilterVisuals.Enabled, false);
|
||||
_ambientSoundSystem.SetAmbience(filter.Owner, false);
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +65,6 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
|
||||
if (transferRatio <= 0)
|
||||
{
|
||||
appearance?.SetData(FilterVisuals.Enabled, false);
|
||||
_ambientSoundSystem.SetAmbience(filter.Owner, false);
|
||||
return;
|
||||
}
|
||||
@@ -87,8 +73,6 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
|
||||
if (filter.FilteredGas.HasValue)
|
||||
{
|
||||
appearance?.SetData(FilterVisuals.Enabled, true);
|
||||
|
||||
var filteredOut = new GasMixture() {Temperature = removed.Temperature};
|
||||
|
||||
filteredOut.SetMoles(filter.FilteredGas.Value, removed.GetMoles(filter.FilteredGas.Value));
|
||||
@@ -96,28 +80,32 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
|
||||
var target = filterNode.Air.Pressure < Atmospherics.MaxOutputPressure ? filterNode : inletNode;
|
||||
_atmosphereSystem.Merge(target.Air, filteredOut);
|
||||
if (filteredOut.Pressure != 0f)
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(filter.Owner, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ambientSoundSystem.SetAmbience(filter.Owner, false);
|
||||
}
|
||||
_ambientSoundSystem.SetAmbience(filter.Owner, filteredOut.TotalMoles > 0f);
|
||||
}
|
||||
|
||||
_atmosphereSystem.Merge(outletNode.Air, removed);
|
||||
}
|
||||
|
||||
private void OnFilterInteractHand(EntityUid uid, GasFilterComponent component, InteractHandEvent args)
|
||||
private void OnFilterLeaveAtmosphere(EntityUid uid, GasFilterComponent filter, AtmosDeviceDisabledEvent args)
|
||||
{
|
||||
filter.Enabled = false;
|
||||
|
||||
UpdateAppearance(uid, filter);
|
||||
_ambientSoundSystem.SetAmbience(filter.Owner, false);
|
||||
|
||||
DirtyUI(uid, filter);
|
||||
_userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key);
|
||||
}
|
||||
|
||||
private void OnFilterInteractHand(EntityUid uid, GasFilterComponent filter, InteractHandEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
if (EntityManager.GetComponent<TransformComponent>(component.Owner).Anchored)
|
||||
if (EntityManager.GetComponent<TransformComponent>(filter.Owner).Anchored)
|
||||
{
|
||||
_userInterfaceSystem.TryOpen(uid, GasFilterUiKey.Key, actor.PlayerSession);
|
||||
DirtyUI(uid, component);
|
||||
DirtyUI(uid, filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -129,7 +117,6 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
|
||||
private void DirtyUI(EntityUid uid, GasFilterComponent? filter)
|
||||
{
|
||||
|
||||
if (!Resolve(uid, ref filter))
|
||||
return;
|
||||
|
||||
@@ -137,13 +124,21 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
new GasFilterBoundUserInterfaceState(EntityManager.GetComponent<MetaDataComponent>(filter.Owner).EntityName, filter.TransferRate, filter.Enabled, filter.FilteredGas));
|
||||
}
|
||||
|
||||
private void UpdateAppearance(EntityUid uid, GasFilterComponent? filter = null, AppearanceComponent? appearance = null)
|
||||
{
|
||||
if (!Resolve(uid, ref filter, ref appearance, false))
|
||||
return;
|
||||
|
||||
appearance.SetData(FilterVisuals.Enabled, filter.Enabled);
|
||||
}
|
||||
|
||||
private void OnToggleStatusMessage(EntityUid uid, GasFilterComponent filter, GasFilterToggleStatusMessage args)
|
||||
{
|
||||
filter.Enabled = args.Enabled;
|
||||
_adminLogger.Add(LogType.AtmosPowerChanged, LogImpact.Medium,
|
||||
$"{ToPrettyString(args.Session.AttachedEntity!.Value):player} set the power on {ToPrettyString(uid):device} to {args.Enabled}");
|
||||
|
||||
DirtyUI(uid, filter);
|
||||
UpdateAppearance(uid, filter);
|
||||
}
|
||||
|
||||
private void OnTransferRateChangeMessage(EntityUid uid, GasFilterComponent filter, GasFilterChangeRateMessage args)
|
||||
|
||||
@@ -36,25 +36,12 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
SubscribeLocalEvent<GasMixerComponent, GasMixerChangeNodePercentageMessage>(OnChangeNodePercentageMessage);
|
||||
SubscribeLocalEvent<GasMixerComponent, GasMixerToggleStatusMessage>(OnToggleStatusMessage);
|
||||
|
||||
// Shouldn't need re-anchor event
|
||||
SubscribeLocalEvent<GasMixerComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||
SubscribeLocalEvent<GasMixerComponent, AtmosDeviceDisabledEvent>(OnMixerLeaveAtmosphere);
|
||||
}
|
||||
|
||||
private void OnAnchorChanged(EntityUid uid, GasMixerComponent component, ref AnchorStateChangedEvent args)
|
||||
private void OnInit(EntityUid uid, GasMixerComponent mixer, ComponentInit args)
|
||||
{
|
||||
if (args.Anchored)
|
||||
return;
|
||||
|
||||
component.Enabled = false;
|
||||
|
||||
DirtyUI(uid, component);
|
||||
UpdateAppearance(uid, component);
|
||||
_userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, GasMixerComponent component, ComponentInit args)
|
||||
{
|
||||
UpdateAppearance(uid, component);
|
||||
UpdateAppearance(uid, mixer);
|
||||
}
|
||||
|
||||
private void OnMixerUpdated(EntityUid uid, GasMixerComponent mixer, AtmosDeviceUpdateEvent args)
|
||||
@@ -83,8 +70,6 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
if (outputStartingPressure >= mixer.TargetPressure)
|
||||
return; // Target reached, no need to mix.
|
||||
|
||||
|
||||
|
||||
var generalTransfer = (mixer.TargetPressure - outputStartingPressure) * outlet.Air.Volume / Atmospherics.R;
|
||||
|
||||
var transferMolesOne = inletOne.Air.Temperature > 0 ? mixer.InletOneConcentration * generalTransfer / inletOne.Air.Temperature : 0f;
|
||||
@@ -127,30 +112,44 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
|
||||
}
|
||||
|
||||
// Actually transfer the gas now.
|
||||
var transferred = false;
|
||||
|
||||
if (transferMolesOne > 0f)
|
||||
{
|
||||
transferred = true;
|
||||
var removed = inletOne.Air.Remove(transferMolesOne);
|
||||
_atmosphereSystem.Merge(outlet.Air, removed);
|
||||
}
|
||||
|
||||
if (transferMolesTwo > 0f)
|
||||
{
|
||||
transferred = true;
|
||||
var removed = inletTwo.Air.Remove(transferMolesTwo);
|
||||
_atmosphereSystem.Merge(outlet.Air, removed);
|
||||
}
|
||||
_ambientSoundSystem.SetAmbience(mixer.Owner, true);
|
||||
|
||||
if (transferred)
|
||||
_ambientSoundSystem.SetAmbience(mixer.Owner, true);
|
||||
}
|
||||
|
||||
private void OnMixerInteractHand(EntityUid uid, GasMixerComponent component, InteractHandEvent args)
|
||||
private void OnMixerLeaveAtmosphere(EntityUid uid, GasMixerComponent mixer, AtmosDeviceDisabledEvent args)
|
||||
{
|
||||
mixer.Enabled = false;
|
||||
|
||||
DirtyUI(uid, mixer);
|
||||
UpdateAppearance(uid, mixer);
|
||||
_userInterfaceSystem.TryCloseAll(uid, GasFilterUiKey.Key);
|
||||
}
|
||||
|
||||
private void OnMixerInteractHand(EntityUid uid, GasMixerComponent mixer, InteractHandEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
if (EntityManager.GetComponent<TransformComponent>(component.Owner).Anchored)
|
||||
if (EntityManager.GetComponent<TransformComponent>(mixer.Owner).Anchored)
|
||||
{
|
||||
_userInterfaceSystem.TryOpen(uid, GasMixerUiKey.Key, actor.PlayerSession);
|
||||
DirtyUI(uid, component);
|
||||
DirtyUI(uid, mixer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user