PipeNetDeviceComponent refactor (#2912)
* Removes inheritance of PipeNetDeviceComponent * Enables nullable in piping * Piping error messages report the prototype * Moves PipeNetDevice updating to ComponentMessage * Build fix * Review fixes * review fix 2 Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Atmos;
|
||||
#nullable enable
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
@@ -9,11 +10,14 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
/// Adds itself to a <see cref="IGridAtmosphereComponent"/> to be updated by.
|
||||
/// TODO: Make compatible with unanchoring/anchoring. Currently assumes that the Owner does not move.
|
||||
/// </summary>
|
||||
public abstract class PipeNetDeviceComponent : Component
|
||||
[RegisterComponent]
|
||||
public class PipeNetDeviceComponent : Component
|
||||
{
|
||||
public abstract void Update();
|
||||
public override string Name => "PipeNetDevice";
|
||||
|
||||
protected IGridAtmosphereComponent JoinedGridAtmos { get; private set; }
|
||||
private IGridAtmosphereComponent? JoinedGridAtmos { get; set; }
|
||||
|
||||
private PipeNetUpdateMessage _cachedUpdateMessage = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -27,6 +31,11 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
LeaveGridAtmos();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
SendMessage(_cachedUpdateMessage);
|
||||
}
|
||||
|
||||
private void JoinGridAtmos()
|
||||
{
|
||||
var gridAtmos = EntitySystem.Get<AtmosphereSystem>()
|
||||
@@ -41,4 +50,9 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
JoinedGridAtmos = null;
|
||||
}
|
||||
}
|
||||
|
||||
public class PipeNetUpdateMessage : ComponentMessage
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user