Fixes air sensors not accessing gas mixture on construction + visual fixes (#15224)
This commit is contained in:
@@ -4,16 +4,12 @@ using Content.Server.Atmos.EntitySystems;
|
|||||||
using Content.Server.Atmos.Piping.EntitySystems;
|
using Content.Server.Atmos.Piping.EntitySystems;
|
||||||
using Content.Server.Atmos.Piping.Components;
|
using Content.Server.Atmos.Piping.Components;
|
||||||
using Content.Server.DeviceNetwork;
|
using Content.Server.DeviceNetwork;
|
||||||
using Content.Server.DeviceNetwork.Components;
|
|
||||||
using Content.Server.DeviceNetwork.Systems;
|
using Content.Server.DeviceNetwork.Systems;
|
||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Power.EntitySystems;
|
using Content.Server.Power.EntitySystems;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Content.Shared.Atmos.Monitor;
|
using Content.Shared.Atmos.Monitor;
|
||||||
using Content.Shared.Tag;
|
using Content.Shared.Tag;
|
||||||
using Robust.Server.GameObjects;
|
|
||||||
using Robust.Shared.Audio;
|
|
||||||
using Robust.Shared.Player;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Monitor.Systems;
|
namespace Content.Server.Atmos.Monitor.Systems;
|
||||||
@@ -48,6 +44,18 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<AtmosMonitorComponent, PowerChangedEvent>(OnPowerChangedEvent);
|
SubscribeLocalEvent<AtmosMonitorComponent, PowerChangedEvent>(OnPowerChangedEvent);
|
||||||
SubscribeLocalEvent<AtmosMonitorComponent, BeforePacketSentEvent>(BeforePacketRecv);
|
SubscribeLocalEvent<AtmosMonitorComponent, BeforePacketSentEvent>(BeforePacketRecv);
|
||||||
SubscribeLocalEvent<AtmosMonitorComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
SubscribeLocalEvent<AtmosMonitorComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
|
||||||
|
SubscribeLocalEvent<AtmosMonitorComponent, AtmosDeviceDisabledEvent>(OnAtmosDeviceLeaveAtmosphere);
|
||||||
|
SubscribeLocalEvent<AtmosMonitorComponent, AtmosDeviceEnabledEvent>(OnAtmosDeviceEnterAtmosphere);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAtmosDeviceLeaveAtmosphere(EntityUid uid, AtmosMonitorComponent atmosMonitor, AtmosDeviceDisabledEvent args)
|
||||||
|
{
|
||||||
|
atmosMonitor.TileGas = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAtmosDeviceEnterAtmosphere(EntityUid uid, AtmosMonitorComponent atmosMonitor, AtmosDeviceEnabledEvent args)
|
||||||
|
{
|
||||||
|
atmosMonitor.TileGas = _atmosphereSystem.GetContainingMixture(uid, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAtmosMonitorInit(EntityUid uid, AtmosMonitorComponent component, ComponentInit args)
|
private void OnAtmosMonitorInit(EntityUid uid, AtmosMonitorComponent component, ComponentInit args)
|
||||||
@@ -147,22 +155,12 @@ public sealed class AtmosMonitorSystem : EntitySystem
|
|||||||
if (TryComp<AtmosDeviceComponent>(uid, out var atmosDeviceComponent))
|
if (TryComp<AtmosDeviceComponent>(uid, out var atmosDeviceComponent))
|
||||||
{
|
{
|
||||||
if (!args.Powered)
|
if (!args.Powered)
|
||||||
{
|
|
||||||
if (atmosDeviceComponent.JoinedGrid != null)
|
|
||||||
{
|
{
|
||||||
_atmosDeviceSystem.LeaveAtmosphere(atmosDeviceComponent);
|
_atmosDeviceSystem.LeaveAtmosphere(atmosDeviceComponent);
|
||||||
component.TileGas = null;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else if (args.Powered)
|
|
||||||
{
|
|
||||||
if (atmosDeviceComponent.JoinedGrid == null)
|
|
||||||
{
|
{
|
||||||
_atmosDeviceSystem.JoinAtmosphere(atmosDeviceComponent);
|
_atmosDeviceSystem.JoinAtmosphere(atmosDeviceComponent);
|
||||||
var air = _atmosphereSystem.GetContainingMixture(uid, true);
|
|
||||||
component.TileGas = air;
|
|
||||||
}
|
|
||||||
|
|
||||||
Alert(uid, component.LastAlarmState);
|
Alert(uid, component.LastAlarmState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,22 +62,23 @@
|
|||||||
- AirSensor
|
- AirSensor
|
||||||
- type: AccessReader
|
- type: AccessReader
|
||||||
access: [ [ "Atmospherics" ] ]
|
access: [ [ "Atmospherics" ] ]
|
||||||
- type: GenericVisualizer
|
|
||||||
visuals:
|
|
||||||
enum.PowerDeviceVisuals.Powered:
|
|
||||||
sensor:
|
|
||||||
True: { state: gsensor1 }
|
|
||||||
False: { state: gsensor0 }
|
|
||||||
- type: Construction
|
- type: Construction
|
||||||
graph: AirSensor
|
graph: AirSensor
|
||||||
node: sensor
|
node: sensor
|
||||||
|
- type: Appearance
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
netsync: false
|
netsync: false
|
||||||
drawdepth: FloorObjects
|
drawdepth: FloorObjects
|
||||||
sprite: Structures/Specific/Atmospherics/sensor.rsi
|
sprite: Structures/Specific/Atmospherics/sensor.rsi
|
||||||
layers:
|
layers:
|
||||||
- state: gsensor1
|
- state: gsensor1
|
||||||
map: [ "sensor" ]
|
map: [ "enum.PowerDeviceVisualLayers.Powered" ]
|
||||||
|
- type: GenericVisualizer
|
||||||
|
visuals:
|
||||||
|
enum.PowerDeviceVisuals.Powered:
|
||||||
|
enum.PowerDeviceVisualLayers.Powered:
|
||||||
|
True: { state: gsensor1 }
|
||||||
|
False: { state: gsensor0 }
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: BaseItem
|
parent: BaseItem
|
||||||
|
|||||||
Reference in New Issue
Block a user