Merge branch 'master-upstream' into expl_int_analyzer
# Conflicts: # Content.Server/GameObjects/Components/Body/Part/BodyPartComponent.cs # Content.Server/GameObjects/Components/Botany/PlantHolderComponent.cs # Content.Server/GameObjects/Components/Chemistry/PillComponent.cs # Content.Server/GameObjects/Components/Interactable/TilePryingComponent.cs # Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs # Content.Server/GameObjects/Components/Items/RCD/RCDAmmoComponent.cs # Content.Server/GameObjects/Components/Items/RCD/RCDComponent.cs # Content.Server/GameObjects/Components/Medical/HealingComponent.cs # Content.Server/GameObjects/Components/Power/WirePlacerComponent.cs # Content.Shared/Chemistry/Solution.cs
This commit is contained in:
@@ -253,18 +253,20 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
}
|
||||
}
|
||||
|
||||
async Task IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.CanReach)
|
||||
{
|
||||
eventArgs.User.PopupMessage(Loc.GetString("You can't reach there!"));
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (eventArgs.User.TryGetComponent(out IActorComponent? actor))
|
||||
{
|
||||
OpenInterface(actor.playerSession, eventArgs.ClickLocation);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -83,13 +83,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||
{
|
||||
Logger.Error($"{typeof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
_gasPort = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||
if (_gasPort == null)
|
||||
{
|
||||
Logger.Error($"{typeof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(GasCanisterPortComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Filters
|
||||
|
||||
if (_inletPipe == null || _filterOutletPipe == null || _outletPipe == null)
|
||||
{
|
||||
Logger.Error($"{typeof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(GasFilterComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
#nullable enable
|
||||
using Content.Server.GameObjects.Components.NodeContainer;
|
||||
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates gas in the attached pipe.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class GasGeneratorComponent : Component
|
||||
{
|
||||
public override string Name => "GasGenerator";
|
||||
|
||||
/// <summary>
|
||||
/// If the generator is producing gas.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool GeneratorEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// What gas is being generated.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public Gas GeneratedGas { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Molar rate of gas generation.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float GasGenerationRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The pipe pressure above which the generator stops producing gas.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float GeneratorPressureCap { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The pipe to which generated gas is added.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private PipeNode? Pipe { get; set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.GeneratorEnabled, "generatorEnabled", true);
|
||||
serializer.DataField(this, x => x.GeneratedGas, "generatedGas", Gas.Oxygen);
|
||||
serializer.DataField(this, x => x.GasGenerationRate, "gasGenerationRate", 10);
|
||||
serializer.DataField(this, x => x.GeneratorPressureCap, "generatorPressureCap", 10);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Owner.EnsureComponentWarn<PipeNetDeviceComponent>();
|
||||
SetPipes();
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, IComponent? component)
|
||||
{
|
||||
base.HandleMessage(message, component);
|
||||
switch (message)
|
||||
{
|
||||
case PipeNetUpdateMessage:
|
||||
Update();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!GeneratorEnabled)
|
||||
return;
|
||||
|
||||
if (Pipe == null || Pipe.Air.Pressure > GeneratorPressureCap)
|
||||
return;
|
||||
|
||||
Pipe.Air.AdjustMoles(GeneratedGas, GasGenerationRate);
|
||||
}
|
||||
|
||||
private void SetPipes()
|
||||
{
|
||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||
{
|
||||
Logger.Error($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
Pipe = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||
if (Pipe == null)
|
||||
{
|
||||
Logger.Error($"{nameof(GasGeneratorComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.NodeContainer;
|
||||
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -16,7 +17,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
/// <summary>
|
||||
/// Transfer gas from one <see cref="PipeNode"/> to another.
|
||||
/// </summary>
|
||||
public abstract class BasePumpComponent : Component
|
||||
public abstract class BasePumpComponent : Component, IActivate
|
||||
{
|
||||
/// <summary>
|
||||
/// 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));
|
||||
}
|
||||
|
||||
public void Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
PumpEnabled = !PumpEnabled;
|
||||
}
|
||||
|
||||
private void SetPipes()
|
||||
{
|
||||
_inletPipe = null;
|
||||
@@ -107,7 +113,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
|
||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||
{
|
||||
Logger.Error($"{typeof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
var pipeNodes = container.Nodes.OfType<PipeNode>();
|
||||
@@ -115,7 +121,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
_outletPipe = pipeNodes.Where(pipe => pipe.PipeDirection == _initialOutletDirection).FirstOrDefault();
|
||||
if (_inletPipe == null || _outletPipe == null)
|
||||
{
|
||||
Logger.Error($"{typeof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(BasePumpComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -8,6 +10,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(BasePumpComponent))]
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class PressurePumpComponent : BasePumpComponent
|
||||
{
|
||||
public override string Name => "PressurePump";
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
@@ -8,6 +10,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(BasePumpComponent))]
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class VolumePumpComponent : BasePumpComponent
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
|
||||
@@ -80,13 +80,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
||||
{
|
||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||
{
|
||||
Logger.Error($"{typeof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
_scrubberOutlet = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||
if (_scrubberOutlet == null)
|
||||
{
|
||||
Logger.Error($"{typeof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(BaseSiphonComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
@@ -80,13 +80,13 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
||||
{
|
||||
if (!Owner.TryGetComponent<NodeContainerComponent>(out var container))
|
||||
{
|
||||
Logger.Error($"{typeof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} did not have a {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
_ventInlet = container.Nodes.OfType<PipeNode>().FirstOrDefault();
|
||||
if (_ventInlet == null)
|
||||
{
|
||||
Logger.Error($"{typeof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
Logger.Error($"{nameof(BaseVentComponent)} on {Owner?.Prototype?.ID}, Uid {Owner?.Uid} could not find compatible {nameof(PipeNode)}s on its {nameof(NodeContainerComponent)}.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Atmos;
|
||||
#nullable enable
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
Reference in New Issue
Block a user