Pressure & volume pumps can be toggled on/off now. (#3046)

This tidbit might or might not be suitable for a separate component.
Tell me in PR comments I guess.
This commit is contained in:
20kdc
2021-02-04 09:47:04 +00:00
committed by GitHub
parent 29918b2810
commit b9aa789bc4
3 changed files with 11 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ using Content.Server.Atmos;
using Content.Server.GameObjects.Components.NodeContainer; using Content.Server.GameObjects.Components.NodeContainer;
using Content.Server.GameObjects.Components.NodeContainer.Nodes; using Content.Server.GameObjects.Components.NodeContainer.Nodes;
using Content.Shared.GameObjects.Components.Atmos; using Content.Shared.GameObjects.Components.Atmos;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
@@ -16,7 +17,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
/// <summary> /// <summary>
/// Transfer gas from one <see cref="PipeNode"/> to another. /// Transfer gas from one <see cref="PipeNode"/> to another.
/// </summary> /// </summary>
public abstract class BasePumpComponent : Component public abstract class BasePumpComponent : Component, IActivate
{ {
/// <summary> /// <summary>
/// If the pump is currently pumping. /// If the pump is currently pumping.
@@ -100,6 +101,11 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
_appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_initialInletDirection, _initialOutletDirection, PumpEnabled)); _appearance?.SetData(PumpVisuals.VisualState, new PumpVisualState(_initialInletDirection, _initialOutletDirection, PumpEnabled));
} }
public void Activate(ActivateEventArgs eventArgs)
{
PumpEnabled = !PumpEnabled;
}
private void SetPipes() private void SetPipes()
{ {
_inletPipe = null; _inletPipe = null;

View File

@@ -1,6 +1,7 @@
#nullable enable #nullable enable
using System; using System;
using Content.Server.Atmos; using Content.Server.Atmos;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
@@ -9,6 +10,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
{ {
[RegisterComponent] [RegisterComponent]
[ComponentReference(typeof(BasePumpComponent))] [ComponentReference(typeof(BasePumpComponent))]
[ComponentReference(typeof(IActivate))]
public class PressurePumpComponent : BasePumpComponent public class PressurePumpComponent : BasePumpComponent
{ {
public override string Name => "PressurePump"; public override string Name => "PressurePump";

View File

@@ -1,6 +1,7 @@
#nullable enable #nullable enable
using System; using System;
using Content.Server.Atmos; using Content.Server.Atmos;
using Content.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
@@ -9,6 +10,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
{ {
[RegisterComponent] [RegisterComponent]
[ComponentReference(typeof(BasePumpComponent))] [ComponentReference(typeof(BasePumpComponent))]
[ComponentReference(typeof(IActivate))]
public class VolumePumpComponent : BasePumpComponent public class VolumePumpComponent : BasePumpComponent
{ {
[ViewVariables(VVAccess.ReadWrite)] [ViewVariables(VVAccess.ReadWrite)]