mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* verb category * voltage toggle comp * move stuff * add simple prototype * implement verb action * switch expression * fixed the node not updating * charge the battery * fixed battery not charging * spawn on battery level system * finally works * swap commentary position * can only anchor the extractor on the station * popup message for trying to anchor outside of station * default placement for unanchored version * ops * fix body type * commentary * update visuals of power consumer * add custom sprite * fix light layer not changing * xenoborg circuit * fix xenoborg circuit * add tag * add hand to hold xenoborg circuits * move to material * add xenoborg circuit material * add recipe to mothership core * add a hand to hold circuits to the mothership core * to not confuse * update * ops * another ops * update mothership * update guidebook * update values * more info * fix stack * can store xenoborg circuits * description * also update description * circuit -> crytal * not modified from anything * update description * Revert "update mothership" This reverts commit 84974c56afadac2a99ed2a166244a668d83fff48. * update empty label * small update to sprite * not necessary code * remove empty line * color * make it explode when destroyed * change values * update sprite * update sprite * make it eletrified * flavor text * simplify to only use charge * subscribe to event * new line * remove popup * no need for the setter * no longer networked * feedback popups * Minor tweaks * better to understand * better now? --------- Co-authored-by: beck-thompson <beck314159@hotmail.com>
106 lines
3.7 KiB
C#
106 lines
3.7 KiB
C#
using Content.Shared.NodeContainer.NodeGroups;
|
|
using Robust.Shared.Map.Components;
|
|
|
|
namespace Content.Shared.NodeContainer;
|
|
|
|
/// <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!;
|
|
|
|
public void SetNodeGroupId(NodeGroupID newId)
|
|
{
|
|
NodeGroupID = newId;
|
|
}
|
|
|
|
/// <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;
|
|
}
|
|
|
|
[DataField]
|
|
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();
|
|
|
|
public int FloodGen;
|
|
public int UndirectGen;
|
|
public bool FlaggedForFlood;
|
|
public 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);
|
|
}
|