Predicted internals (#33800)
* Predicted gas pumps I wanted to try out atmos and first thing I found. * a * Atmos device prediction - Canisters - Tanks - Internals AirMixes aren't predicted so nothing on that front but all the UIs should be a lot closer. * Remove details range * Gas tank prediction * Even more sweeping changes * Alerts * rehg * Popup fix * Fix merge conflicts * Fix * Review
This commit is contained in:
@@ -2,6 +2,8 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Examine;
|
||||
using Content.Shared.NodeContainer;
|
||||
using Content.Shared.NodeContainer.NodeGroups;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.NodeContainer.EntitySystems
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.NodeContainer.NodeGroups;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.NodeContainer;
|
||||
using Content.Shared.NodeContainer.NodeGroups;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Enums;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
|
||||
namespace Content.Server.NodeContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates and maintains a set of <see cref="Node"/>s.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class NodeContainerComponent : Component
|
||||
{
|
||||
//HACK: THIS BEING readOnly IS A FILTHY HACK AND I HATE IT --moony
|
||||
[DataField("nodes", readOnly: true)] public Dictionary<string, Node> Nodes { get; private set; } = new();
|
||||
|
||||
[DataField("examinable")] public bool Examinable = false;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,12 @@
|
||||
using System.Linq;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.NodeContainer;
|
||||
using Content.Shared.NodeContainer.NodeGroups;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.NodeContainer.NodeGroups
|
||||
{
|
||||
/// <summary>
|
||||
/// Maintains a collection of <see cref="Node"/>s, and performs operations requiring a list of
|
||||
/// all connected <see cref="Node"/>s.
|
||||
/// </summary>
|
||||
public interface INodeGroup
|
||||
{
|
||||
bool Remaking { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The list of nodes currently in this group.
|
||||
/// </summary>
|
||||
IReadOnlyList<Node> Nodes { get; }
|
||||
|
||||
void Create(NodeGroupID groupId);
|
||||
|
||||
void Initialize(Node sourceNode, IEntityManager entMan);
|
||||
|
||||
void RemoveNode(Node node);
|
||||
|
||||
void LoadNodes(List<Node> groupNodes);
|
||||
|
||||
// In theory, the SS13 curse ensures this method will never be called.
|
||||
void AfterRemake(IEnumerable<IGrouping<INodeGroup?, Node>> newGroups);
|
||||
|
||||
/// <summary>
|
||||
/// Return any additional data to display for the node-visualizer debug overlay.
|
||||
/// </summary>
|
||||
string? GetDebugData();
|
||||
}
|
||||
|
||||
[NodeGroup(NodeGroupID.Default, NodeGroupID.WireNet)]
|
||||
[Virtual]
|
||||
public class BaseNodeGroup : INodeGroup
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.NodeContainer.NodeGroups;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.NodeContainer.NodeGroups
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Reflection;
|
||||
using Content.Server.Power.Generation.Teg;
|
||||
using Content.Shared.NodeContainer.NodeGroups;
|
||||
using Robust.Shared.Reflection;
|
||||
|
||||
namespace Content.Server.NodeContainer.NodeGroups
|
||||
@@ -51,22 +51,4 @@ namespace Content.Server.NodeContainer.NodeGroups
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public enum NodeGroupID : byte
|
||||
{
|
||||
Default,
|
||||
HVPower,
|
||||
MVPower,
|
||||
Apc,
|
||||
AMEngine,
|
||||
Pipe,
|
||||
WireNet,
|
||||
|
||||
/// <summary>
|
||||
/// Group used by the TEG.
|
||||
/// </summary>
|
||||
/// <seealso cref="TegSystem"/>
|
||||
/// <seealso cref="TegNodeGroup"/>
|
||||
Teg,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ using Content.Server.Atmos;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.NodeContainer.Nodes;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.NodeContainer;
|
||||
using Content.Shared.NodeContainer.NodeGroups;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.NodeContainer.NodeGroups
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.NodeContainer;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Content.Shared.NodeContainer;
|
||||
|
||||
namespace Content.Server.NodeContainer.Nodes
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.NodeContainer.Nodes
|
||||
{
|
||||
/// <summary>
|
||||
/// Organizes themselves into distinct <see cref="INodeGroup"/>s with other <see cref="Node"/>s
|
||||
/// that they can "reach" and have the same <see cref="Node.NodeGroupID"/>.
|
||||
/// </summary>
|
||||
[ImplicitDataDefinitionForInheritors]
|
||||
public abstract partial class Node
|
||||
{
|
||||
/// <summary>
|
||||
/// An ID used as a criteria for combining into groups. Determines which <see cref="INodeGroup"/>
|
||||
/// implementation is used as a group, detailed in <see cref="INodeGroupFactory"/>.
|
||||
/// </summary>
|
||||
[DataField("nodeGroupID")]
|
||||
public NodeGroupID NodeGroupID { get; private set; } = NodeGroupID.Default;
|
||||
|
||||
/// <summary>
|
||||
/// The node group this node is a part of.
|
||||
/// </summary>
|
||||
[ViewVariables] public INodeGroup? NodeGroup;
|
||||
|
||||
/// <summary>
|
||||
/// The entity that owns this node via its <see cref="NodeContainerComponent"/>.
|
||||
/// </summary>
|
||||
[ViewVariables] public EntityUid Owner { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// If this node should be considered for connection by other nodes.
|
||||
/// </summary>
|
||||
public virtual bool Connectable(IEntityManager entMan, TransformComponent? xform = null)
|
||||
{
|
||||
if (Deleting)
|
||||
return false;
|
||||
|
||||
if (entMan.IsQueuedForDeletion(Owner))
|
||||
return false;
|
||||
|
||||
if (!NeedAnchored)
|
||||
return true;
|
||||
|
||||
xform ??= entMan.GetComponent<TransformComponent>(Owner);
|
||||
return xform.Anchored;
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("needAnchored")]
|
||||
public bool NeedAnchored { get; private set; } = true;
|
||||
|
||||
public virtual void OnAnchorStateChanged(IEntityManager entityManager, bool anchored) { }
|
||||
|
||||
/// <summary>
|
||||
/// Prevents a node from being used by other nodes while midway through removal.
|
||||
/// </summary>
|
||||
public bool Deleting;
|
||||
|
||||
/// <summary>
|
||||
/// All compatible nodes that are reachable by this node.
|
||||
/// Effectively, active connections out of this node.
|
||||
/// </summary>
|
||||
public readonly HashSet<Node> ReachableNodes = new();
|
||||
|
||||
internal int FloodGen;
|
||||
internal int UndirectGen;
|
||||
internal bool FlaggedForFlood;
|
||||
internal int NetId;
|
||||
|
||||
/// <summary>
|
||||
/// Name of this node on the owning <see cref="NodeContainerComponent"/>.
|
||||
/// </summary>
|
||||
public string Name = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the owning <see cref="NodeContainerComponent"/> is initialized.
|
||||
/// </summary>
|
||||
/// <param name="owner">The owning entity.</param>
|
||||
public virtual void Initialize(EntityUid owner, IEntityManager entMan)
|
||||
{
|
||||
Owner = owner;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How this node will attempt to find other reachable <see cref="Node"/>s to group with.
|
||||
/// Returns a set of <see cref="Node"/>s to consider grouping with. Should not return this current <see cref="Node"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The set of nodes returned can be asymmetrical
|
||||
/// (meaning that it can return other nodes whose <see cref="GetReachableNodes"/> does not return this node).
|
||||
/// If this is used, creation of a new node may not correctly merge networks unless both sides
|
||||
/// of this asymmetric relation are made to manually update with <see cref="NodeGroupSystem.QueueReflood"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public abstract IEnumerable<Node> GetReachableNodes(TransformComponent xform,
|
||||
EntityQuery<NodeContainerComponent> nodeQuery,
|
||||
EntityQuery<TransformComponent> xformQuery,
|
||||
MapGridComponent? grid,
|
||||
IEntityManager entMan);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.NodeContainer;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ using Content.Server.Atmos;
|
||||
using Content.Server.NodeContainer.EntitySystems;
|
||||
using Content.Server.NodeContainer.NodeGroups;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.NodeContainer;
|
||||
using Content.Shared.NodeContainer.NodeGroups;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.NodeContainer;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Shared.NodeContainer;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user