Add vent welding (#19759)

This commit is contained in:
qwerltaz 2023-09-04 06:23:38 +02:00 committed by GitHub
parent 6ec929850c
commit 21b898afcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 12 deletions

View File

@ -11,6 +11,7 @@ using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Server.Tools.Systems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Unary.Components;
@ -46,6 +47,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
SubscribeLocalEvent<GasVentPumpComponent, ExaminedEvent>(OnExamine);
SubscribeLocalEvent<GasVentPumpComponent, SignalReceivedEvent>(OnSignalReceived);
SubscribeLocalEvent<GasVentPumpComponent, GasAnalyzerScanEvent>(OnAnalyzed);
SubscribeLocalEvent<GasVentPumpComponent, WeldableChangedEvent>(OnWeldChanged);
}
private void OnGasVentPumpUpdated(EntityUid uid, GasVentPumpComponent vent, AtmosDeviceUpdateEvent args)
@ -253,7 +255,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
return;
_ambientSoundSystem.SetAmbience(uid, true);
if (!vent.Enabled)
if (vent.Welded)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Welded, appearance);
}
else if (!vent.Enabled)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Off, appearance);
@ -266,11 +273,6 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
{
_appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.In, appearance);
}
else if (vent.Welded)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Welded, appearance);
}
}
private void OnExamine(EntityUid uid, GasVentPumpComponent component, ExaminedEvent args)
@ -308,5 +310,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
args.GasMixtures = gasMixDict;
}
private void OnWeldChanged(EntityUid uid, GasVentPumpComponent component, WeldableChangedEvent args)
{
var isWelded = args.IsWelded;
component.Welded = isWelded;
UpdateState(uid, component);
}
}
}

View File

@ -10,6 +10,7 @@ using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Server.Tools.Systems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Unary.Visuals;
using Content.Shared.Atmos.Monitor;
@ -40,6 +41,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
SubscribeLocalEvent<GasVentScrubberComponent, AtmosAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<GasVentScrubberComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<GasVentScrubberComponent, DeviceNetworkPacketEvent>(OnPacketRecv);
SubscribeLocalEvent<GasVentScrubberComponent, WeldableChangedEvent>(OnWeldChanged);
}
private void OnVentScrubberUpdated(EntityUid uid, GasVentScrubberComponent scrubber, AtmosDeviceUpdateEvent args)
@ -183,7 +185,12 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
return;
_ambientSoundSystem.SetAmbience(uid, true);
if (!scrubber.Enabled)
if (scrubber.Welded)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Welded, appearance);
}
else if (!scrubber.Enabled)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Off, appearance);
@ -196,11 +203,13 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
{
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Siphon, appearance);
}
else if (scrubber.Welded)
{
_ambientSoundSystem.SetAmbience(uid, false);
_appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Welded, appearance);
}
}
private void OnWeldChanged(EntityUid uid, GasVentScrubberComponent component, WeldableChangedEvent args)
{
var isWelded = args.IsWelded;
component.Welded = isWelded;
UpdateState(uid, component);
}
}
}

View File

@ -83,6 +83,7 @@
range: 5
sound:
path: /Audio/Ambience/Objects/gas_vent.ogg
- type: Weldable
- type: entity
parent: GasUnaryBase
@ -173,6 +174,7 @@
range: 5
sound:
path: /Audio/Ambience/Objects/gas_vent.ogg
- type: Weldable
- type: entity
parent: GasUnaryBase